feat(cli): UTExportedTypeDeclarations support for file associations - #12
Conversation
Code Review by Qodo
1. FileAssociation.name panics via expect
|
| dict.insert( | ||
| "CFBundleTypeName".into(), | ||
| association | ||
| .name | ||
| .as_ref() | ||
| .unwrap_or(&association.ext[0].0) | ||
| .expect("File association must have a name") | ||
| .to_string() | ||
| .into(), | ||
| ); |
There was a problem hiding this comment.
1. fileassociation.name panics via expect 📘 Rule violation ⛯ Reliability
• The new macOS Info.plist generation code calls `association.name.as_ref().expect("File association
must have a name"), which will panic at runtime when name` is omitted in config.
• This violates the requirement to avoid panics for fallible/config-driven operations and prevents
graceful degradation with actionable error context.
Agent prompt
## Issue description
`create_info_plist` panics when a `FileAssociation` has no `name` due to `expect("File association must have a name")`. This is config-driven and should not crash the bundling process.
## Issue Context
`create_info_plist` already returns `crate::Result<()>`, so it can gracefully return an error with context, or it can derive a default name (e.g., from the first extension) as documented.
## Fix Focus Areas
- crates/tauri-bundler/src/bundle/macos/app.rs[348-356]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if association.ext.is_empty() { | ||
| dict.insert( | ||
| "CFBundleTypeExtensions".into(), | ||
| plist::Value::Array( | ||
| association | ||
| .ext | ||
| .iter() | ||
| .map(|ext| ext.to_string().into()) | ||
| .collect(), | ||
| ), | ||
| ); | ||
| } |
There was a problem hiding this comment.
2. cfbundletypeextensions condition inverted 📘 Rule violation ✓ Correctness
• The code inserts CFBundleTypeExtensions only when association.ext.is_empty(), which results in non-empty extension lists not being written to the Info.plist. • This can silently break file associations (a critical edge case) because the configuration is present but not applied.
Agent prompt
## Issue description
`CFBundleTypeExtensions` is only written when `association.ext.is_empty()`, which prevents normal (non-empty) extension lists from being included in `CFBundleDocumentTypes`.
## Issue Context
This likely breaks file association registration on macOS for the common case where `ext` is provided.
## Fix Focus Areas
- crates/tauri-bundler/src/bundle/macos/app.rs[328-339]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if let Some(description) = &association.description { | ||
| dict.insert("UTTypeDescription".into(), description.clone().into()); | ||
| } | ||
| if let Some(content_types) = &association.content_types { | ||
| dict.insert( | ||
| "UTTypeConformsTo".into(), | ||
| plist::Value::Array(content_types.iter().map(|s| s.clone().into()).collect()), | ||
| ); | ||
| } |
There was a problem hiding this comment.
3. uttypeconformsto uses wrong field 📘 Rule violation ✓ Correctness
• The UTExportedTypeDeclarations generation populates UTTypeConformsTo from association.content_types, ignoring the dedicated exported_type.conforms_to field. • This can silently produce incorrect exported type declarations on macOS, making the feature behave unexpectedly without any error surfaced to users.
Agent prompt
## Issue description
`UTTypeConformsTo` is being built from `FileAssociation::content_types` instead of `ExportedFileAssociation::conforms_to`, which likely drops the intended exported type metadata.
## Issue Context
`content_types` maps to `LSItemContentTypes` in `CFBundleDocumentTypes`, while exported type conformance should come from `exported_type.conforms_to`.
## Fix Focus Areas
- crates/tauri-bundler/src/bundle/macos/app.rs[271-289]
- crates/tauri-utils/src/config.rs[1209-1216]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#12