Closed Bug 1685180 Opened 3 years ago Closed 1 year ago

Fluent should debug assert (MOZ_ASSERT) for strings where replaced variables are not provided

Categories

(Core :: Internationalization: Localization, enhancement, P3)

Desktop
All
enhancement

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox86 --- wontfix
firefox109 --- fixed

People

(Reporter: Gijs, Assigned: gregtatum)

References

Details

Attachments

(4 files)

See bug 1684190 for context.

When data-l10n-id, setAttributes, or formatValues or similar is used with a fluent message that includes a $variable, and the data-l10n-args and/or args part of the API call does not include that variable (Note: different from just setting it to "") then fluent should assert on debug builds, and/or in automation for opt builds, so we catch missing variable issues like the one in bug 1684190 immediately.

I agree.

In bug 1613705 with the move to Rust I'm improving our errors wrangling from Fluent to surface, and will add ability to crash in automation at least.

Priority: -- → P3
Type: defect → enhancement
See Also: → 1684190

What would it take to fix this / get this prioritized?

Flags: needinfo?(earo)

Erik, do you think this could/should be fixed by adding an appropriate debug_assert! to fluent-rs, or should we handle this at a higher level?

Flags: needinfo?(earo) → needinfo?(enordin)

I think it would make sense to add debug_assert! calls upstream, but I want to double check with people like Zibi who originally designed Fluent-rs and may have a better idea of how that may affect other users.

I've opened an issue of it on GitHub.

https://github.com/projectfluent/fluent-rs/issues/265

I'm leaving this NI open to make sure I follow up on this.

Zibi mentioned this: https://searchfox.org/mozilla-central/rev/3c194fa1d6f339036d2ec9516bd310c6ad612859/intl/l10n/Localization.h#45

I haven't looked at the specific bindings myself in our codebase, but it seems like it should be handled in our own usage of fluent-rs rather than in upstream.

Assignee: nobody → gtatum

I don't think these are actual bugs, as these are crashing due to
missing dynamic data. I felt it was fine to add empty strings here.

Depends on D161996

Attachment #9303973 - Attachment description: Bug 1685180 - Provide empty strings for missing fluent args; r?nordzilla → Bug 1685180 - Ensure tests all properly set fluent args; r?nordzilla
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/be4603eff17c
Debug assert Fluent strings where replaced variables are not provided; r=nordzilla
https://hg.mozilla.org/integration/autoland/rev/c05d7c567c19
Ensure tests all properly set fluent args; r=nordzilla,settings-reviewers,Gijs
Flags: needinfo?(gtatum)
Flags: needinfo?(gtatum)

Also toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_pbmode.js

Which is bug 1801716

Flags: needinfo?(gtatum)
Pushed by gtatum@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7b60e053cb45
Debug assert Fluent strings where replaced variables are not provided; r=nordzilla
https://hg.mozilla.org/integration/autoland/rev/2ce6ad4ea83c
Ensure tests all properly set fluent args; r=nordzilla,settings-reviewers,Gijs
https://hg.mozilla.org/integration/autoland/rev/f69ffa081b91
Remove test case for missing l10n args; r=nordzilla
https://hg.mozilla.org/integration/autoland/rev/8e10d2d72d9b
Ensure more programmatic fluent args have values; r=nordzilla
Flags: needinfo?(enordin)
Regressions: 1801716
Regressions: 1804990
See Also: → 1807249
See Also: → 1803770
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: