Migrate last CaptionML/OptionCaptionML occurrences off deprecated syntax - #10517
Draft
Alexander Holstrup (aholstrup1) wants to merge 1 commit into
Draft
Migrate last CaptionML/OptionCaptionML occurrences off deprecated syntax#10517Alexander Holstrup (aholstrup1) wants to merge 1 commit into
Alexander Holstrup (aholstrup1) wants to merge 1 commit into
Conversation
The deprecated multilanguage syntax (CaptionML/OptionCaptionML) is flagged by AL0424, which is currently pinned to Warning in src/rulesets/base.ruleset.json as a temporary mitigation. The last four occurrences in the repository were in two Rapid Start test fixtures. The Danish captions on these fixtures were only implicitly load-bearing: ImportPackageWithTranslatedOptionsAndEnums runs under GlobalLanguage(1030) and relied on them to differ from its ENU sibling test. A checked-in .xlf is not a viable replacement here, because Tests-Rapid Start is registered in build/projects.json as a GDL test project without translations, so it is always compiled with -features:lcgtranslationfile and never takes the XLIFF branch that consumes Translations/*.xlf. Instead, make the test independent of compile-time multilanguage captions and assert the underlying contract directly: the RapidStart export serializes option and enum values as language-independent ordinals rather than localized captions. The global language is now also restored before the assertions so a failure cannot leak Danish into subsequent tests. Promoting AL0424 back to Error is left as a follow-up.
Alexander Holstrup (aholstrup1)
deployed
to
triage
August 21, 2026 14:01 — with
GitHub Actions
Active
Contributor
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
AL0424flags the deprecated multilanguage syntax (CaptionML/OptionCaptionML). It is currently pinned toWarninginsrc/rulesets/base.ruleset.jsonas a temporary mitigation (from #10470), and cannot be promoted back toErrorwhile any occurrence remains.A full scan of all
.alfiles found exactly 4 remaining occurrences, in 2 Rapid Start test fixtures:src/Layers/W1/Tests/Rapid Start/EnumRs.Enum.alCaptionML = ENU = 'Eight'/'Nine'/'Ten', DAN = 'Otte'/'Ni'/'Ti';src/Layers/W1/Tests/Rapid Start/OptionAndEnumRS.Table.alOptionCaptionML = ENU = 'Zero,One,Two', DAN = 'Null,En,To';This PR migrates all four.
Why not a
.xlftranslation fileThe obvious migration is
Caption = 'Eight';+ a checked-inTranslations/Tests-Rapid Start.da-DK.xlf, because the Danish captions look load-bearing:ImportPackageWithTranslatedOptionsAndEnums()runs underGlobalLanguage(1030)and the Danish captions are the only thing distinguishing it from its ENU siblingImportPackageWithOptionsAndEnums(). Dropping them without replacement would silently hollow out the test.That route does not work for this project:
build/projects.jsonregistersTests-Rapid StartasisGDLProject: true+isTest: truewith nohasTranslations, soALAppBuild.psm1computesHasTranslations = false.HasTranslations = false,Build-Applicationalways takes the LCG branch (-features:lcgtranslationfile). The XLIFF branch — the only one that consumes.xlffromTranslations/— is never taken for this project..gitignoreblanket-ignores*.xlfbehind a hand-maintained allowlist. The repo contains exactly one hand-authored.xlf(en-US, for a shipping product app). There is no precedent for a test app carrying a translation to drive runtime behaviour.A checked-in
da-DK.xlfwould very likely be dropped from the test.appthat actually runs, leaving the Danish captions non-functional — the exact silent failure the migration is meant to avoid.What I did instead
Made the test independent of compile-time multilanguage captions and assert the underlying contract directly, which is strictly stronger than the previous implicit probe.
Reading the RapidStart code, the real invariant is that the export is caption-independent:
ConfigXMLExchange.FormatFieldValueusesFormat(FieldRef.Value, 0, 2)forFieldType::Option(enums included) — invariant format.ConfigValidateManagement.EvaluateValueToOption(XMLValue = true) resolves viaEvaluate(OptionNo, Value)into an Integer, so the XML must carry the ordinal.VerifyEnumsAndOptionsAfterApplyingPackage()only ever asserted ordinals — it never asserted a caption string.So the Danish captions only implicitly probed "the round-trip is caption-independent". The test now asserts that explicitly: still under
GlobalLanguage(1030), it verifies the exported XML serializes the option/enum values as language-independent ordinals (0,1,2/8,9,10) rather than localized caption text — using theXMLDOMManagement.LoadXMLDocumentFromFile+FindNodespattern already used elsewhere in the same codeunit.GlobalLanguage(LanguageId)is also now restored immediately after the apply and before the assertions, so a failing assert cannot leak Danish global language into subsequent tests in the suite.No
pragma warning disable AL0424— pragma would suppress the diagnostic without fixing the condition, leaving the captions non-functional and the test hollow, just silently.Linked work
Fixes #
How I validated this
What I tested and the outcome
Verified:
\b\w*ML\s*=\s*[A-Z]{3}\s*=now returns zero matches across all.alfiles (was 4).0,1,2and8,9,10) — see the reasoning above; the import path'sEvaluate(OptionNo, Value)into an Integer proves the XML must hold ordinals, not caption text.AddPrefixModeisfalsefor this codeunit (SetPrefixModeis only ever called inERMRSPackageBaseOperations, a different codeunit with its ownConfig. XML Exchangeinstance), so the exported field nodes are named plainly and the XPath resolves.DataDictionary.Report.al(dataitem/columns literally namedCaptionML, for parsing legacy C/AL text exports),RolecenterSelectorMgt.Codeunit.aland its GB copy (Label 'CaptionML', Locked = true— an XML attribute name), andDataDictionary.rdlc.Not verified — please treat as the main review risk:
npipe:////./pipe/dockerDesktopWindowsEnginenot found), so I could not followLOCAL_DEV_ENV.mdto build a container; the repo also pins abcinsiderartifact. I have deliberately left the build/run checkboxes unticked rather than claim verification I don't have.ImportPackageWithTranslatedOptionsAndEnumsneeds a real run to confirm the new assertions pass. That is the main thing I'd like a reviewer (or CI) to confirm.Risk & compatibility
EnumRs(enum 136605) andOptionAndEnumRS(table 136605) are fixtures used solely byERMRSPackageOperations.Codeunit.alwithin the same test project; no product code references them.AL0424back toErrorinsrc/rulesets/base.ruleset.json. That should only happen once this change has propagated to the NAV repo, so the internal multi-country build doesn't break again.