fix(actions): strip r# from raw-ident fluent arg keys (FJ-40) #50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/ftl-raw-ident-arg-FJ-40"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
fj actions dispatch <name> <ref> -I k=vpanicked while formatting its own success message even though the dispatch API call succeeded (Resolver error: Unknown variable: $reffollowed by afailed to format localized textpanic).Root cause
The
ftl_arg!macro set each Fluent argument key withstringify!($var_name). For the raw identifierr#ref(used becauserefis a Rust keyword),stringify!(r#ref)yields"r#ref", so the argument was stored underr#refwhilemsg-actions-dispatch-successlooks up the bare$ref. The variable stayed unbound, Fluent raised a resolver error, andftl_println!panicked.Fix
Added a
fluent_keyhelper that strips a leadingr#from the stringified identifier and routed bothftl_arg!arms through it. This is the general fix: any current or future raw-ident argument now binds to the bare Fluent variable the template references, not just$ref.Tests
raw_ident_arg_binds_bare_fluent_variable: formats the realmsg-actions-dispatch-successviaftl_try_format!(which returnsNoneon any resolver error) and asserts the ref and name interpolate.fluent_key_strips_raw_ident_prefix: direct unit test of the helper.cargo fmt --check,cargo clippy --all-targets -- -D warnings, and the fullcargo testsuite pass in the rust-builder-glibc image. The--jsonoutput path is untouched.Closes FJ-40.