Skip to content

feat(LC0091): report translatable properties set in modify blocks - #691

Merged
Arthurvdv merged 4 commits into
mainfrom
feat/lc0091-modify-changes
Nov 26, 2026
Merged

Arthurvdv merged 4 commits into
mainfrom
feat/lc0091-modify-changes

Conversation

@Arthurvdv

@Arthurvdv Arthurvdv commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Closes #690
Closes #668

Summary

Properties set in a modify(...) block were unchecked: the compiler writes them as <Root> - Change <target> - Property <name> trans-units, but SymbolKind.Change was not registered.

  • EnumProvider.SymbolKind.Change is added to the RegisterSymbolAction list and flows through the default ReportTranslatableProperties branch. That is the whole analyzer change (one registration plus the comment above the default branch). No filter, no special case.
  • The control, action and analysis-view walks, IsLockedByCompiler, IsPropertyLocked and the NETSTANDARD2_1 stub are unchanged.
  • The add wrapper (SourceChangeAddSymbol), move changes and a table extension's field group addlast carry no properties, so GetProperty finds nothing on them and nothing is reported twice (proven by the count test below).

SDK evidence (nav-sdk-source, net10.0; SourceChangeModifySymbol.cs identical in net8.0):

  • Symbols/SourceChangeModifySymbol.cs:139 calls NotifyCompilationAboutSymbolCompletion, so every modify block raises a symbol event; Name is the target name (:31), Properties are the block's properties (:54). Subclasses: control, action, view, analysis view, field, report dataset, plus SynthesizedSourceChangeModifyActionSymbol (actionref changes, which carry only a synthesized Visible).
  • Symbols/ChangeSymbol.cs:17: Kind => SymbolKind.Change.
  • Symbols/Symbol.cs:168: Properties is empty by default; neither SourceChangeAddSymbol nor the SourceChangeMove*Symbol classes override it.
  • Translation/LabelWriterVisitor.cs: DefaultVisit (:51) writes a Change's properties like any symbol's. ShouldVisitMember (:328) skips only the members of a move change or of a change inside a view, never the change's own properties. IsObsolete (:285) reads IsObsoleteRemoved, which no change symbol overrides (the 7 overrides are field, key, page reference, record, synthesized key, table extension, table), so a modify block is never locked by its target's obsolete state.
  • Symbols/RequestPageExtensionObjectMembers.cs:53: BuildDeclaredMembersCore builds members from Declaration.Layout only.

Tests

Fixture triples (empty-XLIFF HasDiagnostic, Locked<…> and Translated<…> NoDiagnostic), 50 items, 150 files:

  • Page extension: PageExtensionModifyField{Caption,ToolTip,OptionCaption,InstructionalText,AboutTitle,AboutText}, PageExtensionModifyGroup{Caption,InstructionalText,AboutTitle,AboutText}, PageExtensionModifyPart{Caption,ToolTip,AboutTitle,AboutText}, PageExtensionModifyAction{Caption,ToolTip,AboutTitle,AboutText}, PageExtensionModifyActionGroup{Caption,ToolTip,AboutTitle,AboutText}, PageExtensionModifyViewCaption, PageExtensionModifyAnalysisViewCaption (gated 18.0.36, net10.0 SDK, like the existing analysis-view cases)
  • Page customization: PageCustomizationModify{Field,Group,Part,Action}{AboutTitle,AboutText}, PageCustomizationModifyActionGroup{Caption,AboutTitle,AboutText}, PageCustomizationModifyViewCaption, PageCustomizationViewCaption (added view; passed before the change, proving the View registration already covers it)
  • Table extension: TableExtensionModifyField{Caption,ToolTip,OptionCaption}
  • Report extension request page: ReportExtensionModifyRequestPageField{Caption,ToolTip,OptionCaption,InstructionalText,AboutTitle,AboutText}
  • Modify inside a page view's layout: PageViewModifyField{AboutTitle,AboutText}, PageExtensionViewModifyField{AboutTitle,AboutText} (view added by a page extension)

Plus HasDiagnostic/TableExtensionModifyFieldCaptionInObsoleteRemovedTable, HasDiagnostic/TableExtensionModifyObsoletePendingFieldCaption, HasDiagnostic/PageExtensionAddAndModifyViewCaption, and the namespaced pair NamespacePageExtensionModifyFieldCaption / NamespacePageExtensionModifyFieldCaptionTranslated (RequireMinimumVersion("18.0.38.52553", …)).

New XLIFF constants TranslatedModifyChangePropertiesXliffContent (50 units, helper CreateFixtureWithTranslatedModifyChangePropertiesXliff, which also carries MyAnalysisView.analysis.json; method NoDiagnosticTranslatedModifyChangeProperties) and NamespaceTranslatedPageExtensionModifyFieldCaptionXliffContent (method NoDiagnosticTranslatedModifyChangePropertiesWithNamespaces).

Trans-unit IDs were not computed by hand: each fixture (markers stripped, plus a Locked variant) was compiled as its own scratch app ("features": ["TranslationFile", "NoImplicitWith"], runtime 16.0, platform 29.0.0.0, System symbols only; runtime 17.0 for the analysis view; runtime 18.0 + TranslationsWithNamespaces for the namespaced one) with the local al compile, and the <trans-unit id> values (with al-object-target) and Xliff Generator notes were copied from Translations/TestApp.g.xlf. Every fixture compiled with no error; every Locked = true variant drops its unit. All 50 IDs are distinct; the view-layout fixtures modify controls of their own (MyViewField, MyExtViewField) because a modify inside a view hashes under the page without a view segment and would otherwise collide with the page extension field units.

The fixture commit (d88bd4c) failed before the analyzer change: 59 failures, all There is no issue reported for LC0091 / too few diagnostics (52 HasDiagnostic: the 49 new modify cases, the add-and-modify view fixture and the two obsolete fixtures; 1 HasDiagnosticWithNamespaces; 6 count cases); all Locked and translated cases passed (334 passed).

No double report. HasSingleDiagnosticForMemberAddedByExtension is renamed HasSingleDiagnosticPerMarker and now asserts exactly one LC0091 diagnostic per marker (diagnostic count equals marker count, each marker matched once). New cases: PageExtensionAddAndModifyViewCaption (adds MyExtView and modifies MyView, two markers, two diagnostics), PageCustomizationViewCaption, PageExtensionModifyFieldCaption, PageViewModifyFieldAboutTitle, PageExtensionViewModifyFieldAboutTitle, TableExtensionModifyFieldCaption, ReportExtensionModifyRequestPageFieldCaption; all pass after the change.

Pinned-ID check: changing PageCustomization 4276993442 - Change 3066929535 - Property 2879900210 to …3066929536… made NoDiagnosticTranslatedModifyChangeProperties("TranslatedPageCustomizationModifyActionGroupCaption") fail with Missing translation for 'Caption' in language(s): da-DK (1 failed, 392 passed); reverted.

Findings that differ from the issue

  • A modify inside a page view's layout is not a non-report. It rejects Caption, ToolTip, InstructionalText and OptionCaption (AL0246), but AboutTitle and AboutText compile cleanly and the compiler writes Page MyPage - Change MyViewField - Property AboutTitle. ShouldVisitMember skips the members of a change inside a view, not the change's own properties. LC0091 now reports these (fixtures above), also for a view a page extension adds.
  • More rows emitted than the table lists: page extension modify(part) ToolTip and modify(action group) ToolTip; page customization modify(part) AboutTitle/AboutText and modify(action group) Caption/AboutTitle/AboutText (customization action group Caption is accepted, unlike field/group/part/action Caption); report extension request page field InstructionalText, AboutText and OptionCaption (on an Option variable).
  • Page customization trans-units have root PageCustomization <h> but al-object-target="Page <h>".

Deliberate non-reports (re-checked with the compiler)

  • Report extension requestpage { actions { modify(...) } } compiles and writes no unit (RequestPageExtensionObjectMembers builds from the layout only).
  • Report extension dataset { modify(...) }: RequestFilterHeading and Caption fail with AL0246.
  • Page customization modify of field/group/part/action rejects Caption, ToolTip, InstructionalText (AL0246); modify(view) rejects ToolTip (AL0124).
  • Obsolete probe: a table extension modify of a field in a Removed table compiles (warning AL0520) and the compiler still writes Table MyTable - Change MyField - Property Caption, so LC0091 reports it (IsLockedByCompiler sees the Change, which is never Removed; no change needed). A modify of a field that is itself Removed fails with AL0433. A Pending field's modify is written and reported.

Docs

.claude/rules/diagnostics/lc0091-translatable-text-should-be-translated.md: Change design decision (default branch, add wrappers/moves/field group adds carry no properties, no filter), PageCustomization row, obsolete gate note for modify blocks, deliberate non-reports, SDK facts (modify symbol events, empty default Properties, LabelWriterVisitor handling of changes), test notes (ID shape <Root> - Change <hash> - Property <hash>, customization root, view-layout hashing, analysis view gating, count test).

Companion docs PR: ALCops/alcops.dev#244

Verification

  • dotnet build ALCops.sln: 0 errors (6 pre-existing MSB3277 test-project warnings only)
  • dotnet test ALCops.sln: all passed (LinterCop 851, PlatformCop 784, ApplicationCop 634, FormattingCop 246, DocumentationCop 107, TestAutomationCop 30, Common 169)
  • LC0091 (net10.0): 393 passed, 0 failed
  • LC0091 against the net8.0 analyzer binary (GITHUB_ACTIONS=true dotnet test src/ALCops.LinterCop.Test/ --filter "FullyQualifiedName~TranslatableTextShouldBeTranslated" -c Release -p:NavTargetFramework=net8.0): 375 passed, 18 skipped (version-gated namespace, page object ToolTip and analysis view cases), 0 failed
  • dotnet build src/ALCops.LinterCop/ALCops.LinterCop.csproj -c Release -p:ContinuousIntegrationBuild=true --no-incremental: netstandard2.1, net8.0, net10.0 built, 0 warnings, 0 errors (src/ALCops.Common unchanged)
  • dotnet format ALCops.sln --verify-no-changes: exit 0
  • Validate-Rules.ps1: OK, 70 rules files (15 guides, 55 rule docs) pass all checks

🤖 Generated with Claude Code

Arthurvdv and others added 3 commits November 26, 2026 11:40
Fixtures for the translatable properties set in modify(...) blocks,
which LC0091 does not report yet: page extension field, group, part,
action, action group, view and analysis view changes; page
customization field, group, part, action, action group and view
changes, plus the view a customization adds; table extension field
changes; report extension request page field changes; and the
field changes inside a page view's layout, on the page and in a view a
page extension adds. Each comes as empty XLIFF, Locked = true, and
translated against trans-unit IDs generated by the AL compiler.

Also a table extension modify on a Removed table and on a Pending
field, whose units the compiler still writes, a namespaced page
extension field Caption, and a page extension that adds one view and
modifies another. The exact-count test now asserts one diagnostic per
marker so it covers fixtures with more than one marker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A modify(...) block is a Change symbol that raises its own symbol event
and carries the properties the block sets; the compiler writes them as
"<Root> - Change <target> - Property <name>" trans-units. LC0091 now
registers SymbolKind.Change and checks it like every other symbol kind
that carries its own properties. The Change that wraps a member an
extension adds and a move change carry no properties, so they report
nothing and the added member is still reported once.

This covers page extension, page customization, table extension and
report extension request page modify blocks, and the control changes
inside a page view's layout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Records why Change is registered without a filter (modify blocks carry
the properties they set; add wrappers, moves and table extension field
group adds carry none), that page customizations now reach their modify
blocks and added views, that modify blocks never lock on the target's
obsolete state, the new deliberate non-reports (report extension
request page action changes, AL0246 and AL0433 rejections), the SDK
facts behind them, and the trans-unit ID shape of modify blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sized changes

The promoted-group change a page extension or page customization
synthesizes from PromotedActionCategories carries a synthesized Caption
without a syntax reference, which the locked check skips; the count
test now proves that neither extension kind reports it twice, and the
rule doc states the mechanism instead of the actionref-only wording.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Arthurvdv
Arthurvdv merged commit a4b85fb into main Nov 26, 2026
55 checks passed
@Arthurvdv
Arthurvdv deleted the feat/lc0091-modify-changes branch November 26, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant