Skip to content

feat(LC0091): report translatable properties of child symbol kinds - #688

Merged
Arthurvdv merged 3 commits into
mainfrom
feat/lc0091-child-symbol-kinds
Nov 26, 2026
Merged

Arthurvdv merged 3 commits into
mainfrom
feat/lc0091-child-symbol-kinds

Conversation

@Arthurvdv

@Arthurvdv Arthurvdv commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Closes #684
Part of #668

Summary

The compiler writes trans-units for the translatable properties of members below object level (Translation/LabelWriterVisitor.cs DefaultVisit -> VisitSymbolWithProperties -> VisitMembersOfSymbol), but LC0091 never visited field groups, page views, report dataitems, columns and layouts, query columns and filters, or xmlport nodes, and did not check a table field's OptionCaption.

  • FieldGroup, View, ReportDataItem, ReportColumn, ReportLayout, QueryColumn, QueryFilter and XmlPortNode are registered as symbol kinds of their own and check one static list, MemberPropertyKinds (Caption, ToolTip, OptionCaption, RequestFilterHeading, Summary), through ReportTranslatableProperty; GetProperty returns null for the kinds a member does not declare. No walk from the parent object, so nothing is reported twice.
  • The Field branch also checks OptionCaption.
  • Change is not registered (differs from the plan): the only change that would carry its own properties, a table extension's field group addlast, can never declare any (see non-reports), and the view/dataitem/column add changes wrap ordinary members that raise their own events.
  • EnumProvider (Common): SymbolKind.FieldGroup, View, ReportColumn, ReportLayout, QueryColumn, QueryFilter; PropertyKind.RequestFilterHeading (Summary already existed). Same lazy parse-by-name pattern; the enum values shift between SDK versions.
  • IsLockedByCompiler and the Moved gate apply unchanged: GetContainingObjectTypeSymbol recurses through ContainingSymbol until it reaches an object (Microsoft.Dynamics.Nav.CodeAnalysis/SymbolExtensions.cs:53-79).
  • The analyzer is still an empty stub under #if NETSTANDARD2_1.

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

  • Symbol events: SourceViewSymbol, SourceReportDataItemSymbol, SourceReportColumnSymbol, SourceReportLayoutSymbol, SourceQueryDataItemSymbol, SourceQueryColumnSymbol, SourceQueryFilterSymbol, SourceXmlPortNodeSymbol and every SourceChangeAdd*Symbol call NotifyCompilationAboutSymbolCompletion (Symbols/Symbol.cs:402-413); field groups raise theirs from Symbols/FieldNameListMembers.cs:276. Diagnostics/AnalyzerDriverBase.cs:830-855 dispatches by (int)symbol.Kind without filtering.
  • SourceChangeAddViewSymbol, SourceChangeAddReportDataItemSymbol:71, SourceChangeAddReportColumnSymbol:59 create ordinary Source*Symbol members.
  • Public parent API gaps: IReportTypeSymbol exposes only FlattenedDataItems, IQueryTypeSymbol only QueryType, no interface exposes query filters, and IChangeSymbol exposes only ChangeKind and Type (no change target kind).
  • InternalSyntax/ObjectParser.cs property tables: field group Caption :5381; view Caption :6129 (3.0); report column Caption :4264, ToolTip :4263 (16.0), OptionCaption :4220; dataitem RequestFilterHeading :4129; layout Caption :6411, Summary :6384 (9.0); query column Caption :3503, ToolTip :3539 (14.0); query filter Caption :3651; xmlport table element RequestFilterHeading :5155. All gates at or below the 16.0 test floor.

Tests

Per item the empty-XLIFF HasDiagnostic, the Locked = true NoDiagnostic and the translated NoDiagnostic fixture (17 items, 51 files):

  • TableFieldOptionCaption, TableFieldGroupCaption
  • PageViewCaption, PageExtensionViewCaption (added view)
  • ReportColumn{Caption,ToolTip,OptionCaption}, ReportDataItemRequestFilterHeading, ReportLayout{Caption,Summary}
  • ReportExtensionColumnCaption, ReportExtensionDataItemRequestFilterHeading, ReportExtensionLayoutCaption (added column, dataitem, layout)
  • QueryColumn{Caption,ToolTip}, QueryFilterCaption
  • XmlPortTableElementRequestFilterHeading

Plus HasDiagnostic/TableFieldGroupCaptionInObsoleteRemovedTable (the compiler still writes a field group's unit in a Removed table, see below) and the namespaced pair NamespaceReportColumnCaption / NamespaceReportColumnCaptionTranslated (RequireMinimumVersion("18.0.38.52553", ...)).

New XLIFF constants TranslatedChildSymbolPropertiesXliffContent (17 units, helper CreateFixtureWithTranslatedChildSymbolPropertiesXliff, method NoDiagnosticTranslatedChildSymbolProperties) and NamespaceTranslatedReportColumnCaptionXliffContent (method NoDiagnosticTranslatedChildSymbolPropertiesWithNamespaces). New HasDiagnostic / NoDiagnostic cases are added to the existing methods.

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 18.0 + TranslationsWithNamespaces for the namespaced one) with the local al compile (AL 30.0.42.11883), and the <trans-unit id> values (including al-object-target for the extension units) plus Xliff Generator notes were copied from Translations/TestApp.g.xlf. All fixtures compiled without errors or warnings; every Locked variant drops its unit. Nested members hash under their object only (Report <h> - ReportColumn <h> - Property <h>, no dataitem segment; namespaced: Namespace MyCompany.App - Report MyReport - ReportColumn MyColumn - Property Caption), and the existing TranslationIdHelper matches all of them. Extension-added members use distinct names (MyExtView, MyExtColumn, MyExtDataItem, MyExtLayout) because they fold into the target's ID.

The fixture commit (9ffaeaa) failed before the analyzer change: 22 failures, all There is no issue reported for LC0091 / zero diagnostics (the 18 new HasDiagnostic cases, NamespaceReportColumnCaption, and the 3 count cases below); the Locked/translated cases passed.

No double report. HasDiagnosticAtAllMarkers only checks that some diagnostic exists at each marker (RoslynTestKit AnalyzerTestFixture.HasDiagnostic), so it cannot catch a duplicate. The new HasSingleDiagnosticForMemberAddedByExtension runs CompilationWithAnalyzers directly on PageExtensionViewCaption, ReportExtensionColumnCaption and ReportExtensionDataItemRequestFilterHeading and asserts exactly one LC0091 diagnostic, located at the single marker. All three pass.

Pinned-ID check: changing Report 2858589782 - ReportColumn 3647812821 - Property 2879900210 to ...3647812822... made NoDiagnosticTranslatedChildSymbolProperties("TranslatedReportExtensionColumnCaption") fail with Missing translation for 'Caption' in language(s): da-DK (1 failed, 230 passed); reverted.

Deliberate non-reports found

  • Table extension field groups cannot carry a Caption. A table extension cannot declare fieldgroup(...) (AL0104 syntax error), and ObjectParser.ParseFieldGroupChange (:11401-11418) always builds an empty PropertyList for addlast(<group>; <fields>) { }, although FieldGroupAddChangeSyntax has a property-list slot; addlast(Brick; MyField) { Caption = '...'; } fails with AL0104. So there is no tableextension field group fixture, and Change is not registered.
  • Legacy layouts. SynthesizedReportLayoutSymbol (ReportObjectMembersHelper.cs:160-175, from RDLCLayout/WordLayout/ExcelLayout) has no properties and never raises a symbol event; the compiler writes no unit for it (checked with al compile). Correction to the plan: it does carry the property's DeclaringSyntaxReference, so the reason is the missing event and properties, not AnalysisScope.ShouldSkipSymbolAnalysis.
  • Not a non-report: a field group's Caption in a Removed table. FieldGroupSymbol does not override IsObsoleteRemoved and LabelWriterVisitor.IsObsolete locks only fields by their table, so the compiler writes the unit (checked with al compile) and LC0091 reports it.
  • Report column Caption is emitted (Report MyReport - ReportColumn MyColumn - Property Caption), so it is included.
  • Report layout file: al compile generates a missing layout file during emit (Emit/ReportLayoutsGenerator.cs:15-33); compilation without emit, like the test harness, never reads it. Layout fixtures need no file in the MemoryFileSystem (confirmed: no compile errors). A report with rendering needs DefaultRenderingLayout (AL0721).
  • Properties set inside modify(...) blocks stay unchecked (group D).

Docs

.claude/rules/diagnostics/lc0091-translatable-text-should-be-translated.md: design decisions (direct registration of member kinds and why not a parent walk, why Change is not registered, table field OptionCaption), deliberate non-reports (table extension field groups, legacy layouts, modify blocks), SDK facts (symbol events, public API gaps, field group add parser, synthesized layouts, field groups never lock, ID shapes, runtime gates, layout file only read at emit), test notes (ID generation, count test rationale).

Companion docs PR: ALCops/alcops.dev#243

Verification

  • dotnet build ALCops.sln: 0 errors (pre-existing MSB3277 test-project warnings only)
  • dotnet test ALCops.sln: all passed (LinterCop 689, PlatformCop 784, ApplicationCop 634, FormattingCop 243, DocumentationCop 107, TestAutomationCop 30, Common 169)
  • LC0091 (net10.0): 231 passed, 0 failed
  • LC0091 against the net8.0 analyzer binary (GITHUB_ACTIONS=true dotnet test src/ALCops.LinterCop.Test -c Release -p:NavTargetFramework=net8.0 ...): 218 passed, 13 skipped (version-gated: namespace, page object ToolTip and analysis view cases), 0 failed
  • Three-TFM Release build (-c Release -p:ContinuousIntegrationBuild=true --no-incremental) of ApplicationCop, DocumentationCop, FormattingCop, LinterCop, PlatformCop, TestAutomationCop: netstandard2.1, net8.0, net10.0 built for each, 0 warnings, 0 errors
  • dotnet format ALCops.sln --verify-no-changes: exit 0
  • Validate-Rules.ps1: OK, 69 rules files (15 guides, 54 rule docs) pass all checks

🤖 Generated with Claude Code

Arthurvdv and others added 3 commits November 26, 2026 09:19
Fixtures for the translatable properties of child symbols LC0091 does
not report yet: table field OptionCaption; field group Caption (also in
a Removed table, whose field group units the compiler still writes);
page view Caption; report column Caption, ToolTip and OptionCaption;
report dataitem RequestFilterHeading; report layout Caption and
Summary; query column Caption and ToolTip; query filter Caption; xmlport
table element RequestFilterHeading; plus the view, column, dataitem and
layout an extension adds, and a namespaced report column. The
translated variants use trans-unit IDs generated by the AL compiler.

A separate test counts the diagnostics for a member an extension adds,
since the marker assertions do not catch a duplicate report.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…report, query and xmlport members

Field groups, page views, report dataitems, columns and layouts, query
columns and filters, and xmlport nodes each raise their own symbol
event, including the views, dataitems and columns an extension adds, so
LC0091 registers them directly and checks Caption, ToolTip,
OptionCaption, RequestFilterHeading and Summary from one static list;
GetProperty returns null for the kinds a member does not declare. Table
fields also check OptionCaption. This matches the trans-units the
compiler writes for these members.

Adds the missing EnumProvider.SymbolKind (FieldGroup, View,
ReportColumn, ReportLayout, QueryColumn, QueryFilter) and
EnumProvider.PropertyKind (RequestFilterHeading) members.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Records why field groups, views, report, query and xmlport members are
registered directly instead of walked from their object, why Change is
not registered, the table extension field group and legacy layout
non-reports, and the SDK and trans-unit ID facts behind them.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(LC0091): field groups, views, report, query and xmlport child symbols

1 participant