[meta][Milestone 2] Migrate startup path from DTD to Fluent
Categories
(Firefox :: General, enhancement, P3)
Tracking
()
People
(Reporter: zbraniecki, Assigned: nordzilla)
References
(Blocks 1 open bug, )
Details
(Keywords: meta)
Attachments
(3 files, 1 obsolete file)
Reporter | ||
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
|
||
Reporter | ||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Reporter | ||
Comment 11•6 years ago
|
||
Reporter | ||
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Reporter | ||
Comment 14•6 years ago
|
||
Comment 15•6 years ago
|
||
Comment 16•6 years ago
|
||
Comment 17•6 years ago
|
||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 18•6 years ago
|
||
Reporter | ||
Comment 19•6 years ago
|
||
Hi Peter,
I updated my patch to dump data in a better structure and applied your feedback from while ago.
In .properties I was able to get the stack to the call that triggers the call, and I expect to be able to find a similar stack for Fluent.
Can you recommend a way to get a document and DTD file for the entity? Is it possible in this parser?
Comment 20•6 years ago
|
||
(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #19)
Hi Peter,
I updated my patch to dump data in a better structure and applied your feedback from while ago.
In .properties I was able to get the stack to the call that triggers the call, and I expect to be able to find a similar stack for Fluent.
Can you recommend a way to get a document and DTD file for the entity? Is it possible in this parser?
Not 100% sure if this is what you want, but I believe https://searchfox.org/mozilla-central/rev/ec806131cb7bcd1c26c254d25cd5ab8a61b2aeb6/parser/htmlparser/nsExpatDriver.cpp#530 is a consumer callback called by expat for every dtd file referenced from a document that it's parsing. Note that they're loaded as soon as they're referenced, not as soon as we get an entity for which the DTD is needed (which in any case we can't know, ie how would the parser know which of the DTDs has the relevant entity?). OpenInputStreamFromExternalDTD
, which is called from there, has some handy local variables that I think get you what you want here? There are some different cases but the loading / triggering principal should either end up being system, or null, or have the document's URI. Off-hand I don't know how many of the loads on startup would use a document (I mean, I'd hope all of them, but who knows).
Does that help?
Reporter | ||
Comment 21•5 years ago
|
||
Does that help?
Yes! I was able to use it to get DTD and XML paths for the documents! Thank you!
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 22•5 years ago
|
||
I morphed this bug into what we call "Milestone 2" - making the whole startup path use Fluent and spun-off "Milestone 1" - making browser.xhtml use Fluent (bug 1579477).
Updated•4 years ago
|
Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Comment 23•3 years ago
|
||
The list of bugs blocking this should now be up to date, at least according to the most recent arewefluentyet M2 data.
There are additionally two bedrock bugs blocking this, due to showing the privacy policy on first load:
- mozilla/bedrock#11058: Specify sameSite property on cookies set by JS
- mozilla/bedrock#11326: Styles should not use the non-standard
zoom
property
Comment 24•2 years ago
|
||
With the completion of the DTD migration in bug 1786543, the benefits of the remaining part of the M2 goal (migration of .properties strings formatted during startup) is not really distinguishable from the benefits of migrating all .properties strings to Fluent, i.e. the remainder of M3.
To that end, I'm thinking of closing this as WONTFIX and seeking other ways of separating out other parts of the M3 change to provide intermediate goals, such as bug 1790189. This would allow us to simplify the arewefluentyet scripting quite a bit, and to better align the nominal goals with our actual practice.
If you have any concerns about this, please voice them here. I'm particularly interested in hearing if there's something I've missed, and that there would be a real-world benefit to getting rid of all .properties/StringBundle formatting during startup.
Comment 25•2 years ago
|
||
(In reply to Eemeli Aro [:eemeli] from comment #24)
With the completion of the DTD migration in bug 1786543, the benefits of the remaining part of the M2 goal (migration of .properties strings formatted during startup) is not really distinguishable from the benefits of migrating all .properties strings to Fluent, i.e. the remainder of M3.
To that end, I'm thinking of closing this as WONTFIX
FWIW rather than wontfix I'd argue in favour of moving the goalpost of this milestone back to just DTD and resolving this fixed (which is certainly how the bug originally got filed, see comment 0 which only mentions DTDs). We're not intentionally refusing to fix .properties
things even if someone were to provide patches (which is how I think we try to treat WONTFIX), we're just most of the way done here.
and seeking other ways of separating out other parts of the M3 change to provide intermediate goals, such as bug 1790189. This would allow us to simplify the arewefluentyet scripting quite a bit, and to better align the nominal goals with our actual practice.
If you have any concerns about this, please voice them here. I'm particularly interested in hearing if there's something I've missed, and that there would be a real-world benefit to getting rid of all .properties/StringBundle formatting during startup.
The only benefit I'm aware of for the .properties usage is cached stringbundles and their effect on runtime language switching (ie they'll show whatever got cached on startup, so you get a mixed-language app until you restart). This is a bit more pronounced during startup than "stuff we load later", because the startup path is guaranteed to have run by the time we prompt the (new) user if their Fx locale differs from their OS locale during onboarding. As a result, it may be worth focusing on .properties file usage in that startup path to make that experience better. But that's a pretty limited justification.
An alternative would be focusing on an automated transformation from .properties to sync fluent use (potentially manually converting PluralForm use), which would remove the API surface completely and tidy up the loose end that way, but would leave potentially-undesirable/un-ergonomic fluent use when it should have been moved into markup or used async APIs. I'm not sure if this has been discussed already and rejected for reasons I'm not aware of.
Reporter | ||
Comment 26•2 years ago
|
||
I understand the M2 is costly to produce as it is hard to automate. My quiet hope was that we'll get to finish M2 rather than deprecate the milestone.
As Gijs pointed out, there are characteristics that are specific to startup that disproportionally affect UX.
If you were to reconsider addressing M2 rather than closing it:
- The number 220 is misleading as many calls are repeated. The actual number of callsites is likely much lower (~50?)
- Bug 1733498 is by far the biggest chunk of the remaining 220 .properties calls. If you were successful in moving this, I'd expect the picture to look much cleaner
If you decide to close M2, I'm comfortable with marking it as FIXED since DTDs have been removed, and as you suggested, figuring out between focusing on automated migrations, or migrating pluralized strings first.
Comment 27•2 years ago
•
|
||
(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #26)
I understand the M2 is costly to produce as it is hard to automate. My quiet hope was that we'll get to finish M2 rather than deprecate the milestone.
Besides the calls being repeated, when I tried locally I got results completely different from the existing data generated by Eric. Not sure if that was caused by using a different platform, or if it depends on how long you wait before closing the browser (since calls are duplicated)?
Dropping M2 will likely allow us to generate the data in GitHub actions, unless we hit space limitations when cloning the unified repo. Worst case scenario, it's easy to reproduce on different machines.
Reporter | ||
Comment 28•2 years ago
|
||
Besides the calls being repeated, when I tried locally I got results completely different from the existing data generated by Eric. Not sure if that was caused by using a different platform, or if it depends on how long you wait before closing the browser (since calls are duplicated)?
I think it's platform dependent. I remember getting different results between Mac and Linux. I don't remember them to be "completely" different, but rather ~10-20% off which I accounted for larger stdev/noise.
Comment 29•2 years ago
|
||
There are probably especially differences caused by macOS having to open a "real" hidden window (for the menubar that gets shown when all other windows closed but the app stays open), as well as just platform differences generally given different OS-specific code may need their own locale stuff - though I'd expect Windows and Linux to match more closely.
Assignee | ||
Comment 30•2 years ago
•
|
||
I don't have a strong preference either way regarding stopping or continuing to update the M2 milestone.
While the M2 milestone is certainly harder to automate, it doesn't take long to run on my desktop computer, and is something that I can easily do in the background while working on other tasks. In that regard I have no issue continuing to manually update the milestones, though I understand that the ability to fully automate the process would be desirable.
There was a gap in arewefluentyet recently because I was out of town without my computers, but it is now back up to date as of this week.
Whatever we decide here is fine with me.
Comment 32•2 years ago
|
||
(In reply to :Gijs (he/him) from comment #25)
FWIW rather than wontfix I'd argue in favour of moving the goalpost of this milestone back to just DTD and resolving this fixed (which is certainly how the bug originally got filed, see comment 0 which only mentions DTDs). We're not intentionally refusing to fix
.properties
things even if someone were to provide patches (which is how I think we try to treat WONTFIX), we're just most of the way done here.
That does sound more appropriate than what I initially suggested.
The only benefit I'm aware of for the .properties usage is cached stringbundles and their effect on runtime language switching (ie they'll show whatever got cached on startup, so you get a mixed-language app until you restart). This is a bit more pronounced during startup than "stuff we load later", because the startup path is guaranteed to have run by the time we prompt the (new) user if their Fx locale differs from their OS locale during onboarding. As a result, it may be worth focusing on .properties file usage in that startup path to make that experience better. But that's a pretty limited justification.
It's also not a guaranteed benefit from a Fluent transition, unless that's going to DOM localization. In code that's calling Localization formatting methods directly, we may need to listen to intl:app-locale-changed
events and reformatting then as necessary. I'm sure this isn't currently done everywhere that it ought to be.
An alternative would be focusing on an automated transformation from .properties to sync fluent use (potentially manually converting PluralForm use), which would remove the API surface completely and tidy up the loose end that way, but would leave potentially-undesirable/un-ergonomic fluent use when it should have been moved into markup or used async APIs. I'm not sure if this has been discussed already and rejected for reasons I'm not aware of.
In practice I've found that at least for the .properties we still have, the shape of the migrated Fluent API is rather different. In JS it's because in these cases we're often able to go to DOM localization, and in C++ it's because the APIs are just rather differently shaped, esp. when variables/placeholders are involved. There's also the matter that we don't really get any localiser benefit from such automated transitions. My current thinking is that we ought to be able to build the lower-level Intl.MessageFormat/MF2 APIs with this use case in mind, and be able to do a much more automated transition to that, rather than Fluent.
(In reply to Zibi Braniecki [:zbraniecki][:gandalf] from comment #26)
If you were to reconsider addressing M2 rather than closing it:
- The number 220 is misleading as many calls are repeated. The actual number of callsites is likely much lower (~50?)
I last looked at M2 in detail in March; back then we were down to 32 unique .properties strings in 14 files, with a pretty even split on ones being formatted from only JS, only C++, and both. I think we've since been able to drop that by about 6 strings. The easy work here has been done; the remainder is a slog. The M2 definition is also a bit fuzzy around the edges as different platforms produce slightly different results, and has odd dependencies like this. So chasing this tail to its completion is expensive, and doesn't really bring all that much benefit.
- Bug 1733498 is by far the biggest chunk of the remaining 220 .properties calls. If you were successful in moving this, I'd expect the picture to look much cleaner
Thanks for reminding me about that; seeing now if the abandoned patch for that might still land one day.
Updated•2 years ago
|
Description
•