Repository navigation
feat(LC0091): report translatable properties of child symbol kinds - #688
Merged
Merged
Conversation
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]>
This was referenced Nov 26, 2026
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.
Closes #684
Part of #668
Summary
The compiler writes trans-units for the translatable properties of members below object level (
Translation/LabelWriterVisitor.csDefaultVisit->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'sOptionCaption.FieldGroup,View,ReportDataItem,ReportColumn,ReportLayout,QueryColumn,QueryFilterandXmlPortNodeare registered as symbol kinds of their own and check one static list,MemberPropertyKinds(Caption,ToolTip,OptionCaption,RequestFilterHeading,Summary), throughReportTranslatableProperty;GetPropertyreturns null for the kinds a member does not declare. No walk from the parent object, so nothing is reported twice.Fieldbranch also checksOptionCaption.Changeis not registered (differs from the plan): the only change that would carry its own properties, a table extension's field groupaddlast, 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(Summaryalready existed). Same lazy parse-by-name pattern; the enum values shift between SDK versions.IsLockedByCompilerand the Moved gate apply unchanged:GetContainingObjectTypeSymbolrecurses throughContainingSymboluntil it reaches an object (Microsoft.Dynamics.Nav.CodeAnalysis/SymbolExtensions.cs:53-79).#if NETSTANDARD2_1.SDK evidence (
nav-sdk-source, net10.0; net8.0 identical here):SourceViewSymbol,SourceReportDataItemSymbol,SourceReportColumnSymbol,SourceReportLayoutSymbol,SourceQueryDataItemSymbol,SourceQueryColumnSymbol,SourceQueryFilterSymbol,SourceXmlPortNodeSymboland everySourceChangeAdd*SymbolcallNotifyCompilationAboutSymbolCompletion(Symbols/Symbol.cs:402-413); field groups raise theirs fromSymbols/FieldNameListMembers.cs:276.Diagnostics/AnalyzerDriverBase.cs:830-855dispatches by(int)symbol.Kindwithout filtering.SourceChangeAddViewSymbol,SourceChangeAddReportDataItemSymbol:71,SourceChangeAddReportColumnSymbol:59create ordinarySource*Symbolmembers.IReportTypeSymbolexposes onlyFlattenedDataItems,IQueryTypeSymbolonlyQueryType, no interface exposes query filters, andIChangeSymbolexposes onlyChangeKindandType(no change target kind).InternalSyntax/ObjectParser.csproperty tables: field groupCaption:5381; viewCaption:6129 (3.0); report columnCaption:4264,ToolTip:4263 (16.0),OptionCaption:4220; dataitemRequestFilterHeading:4129; layoutCaption:6411,Summary:6384 (9.0); query columnCaption:3503,ToolTip:3539 (14.0); query filterCaption:3651; xmlport table elementRequestFilterHeading:5155. All gates at or below the 16.0 test floor.Tests
Per item the empty-XLIFF
HasDiagnostic, theLocked = trueNoDiagnosticand the translatedNoDiagnosticfixture (17 items, 51 files):TableFieldOptionCaption,TableFieldGroupCaptionPageViewCaption,PageExtensionViewCaption(added view)ReportColumn{Caption,ToolTip,OptionCaption},ReportDataItemRequestFilterHeading,ReportLayout{Caption,Summary}ReportExtensionColumnCaption,ReportExtensionDataItemRequestFilterHeading,ReportExtensionLayoutCaption(added column, dataitem, layout)QueryColumn{Caption,ToolTip},QueryFilterCaptionXmlPortTableElementRequestFilterHeadingPlus
HasDiagnostic/TableFieldGroupCaptionInObsoleteRemovedTable(the compiler still writes a field group's unit in a Removed table, see below) and the namespaced pairNamespaceReportColumnCaption/NamespaceReportColumnCaptionTranslated(RequireMinimumVersion("18.0.38.52553", ...)).New XLIFF constants
TranslatedChildSymbolPropertiesXliffContent(17 units, helperCreateFixtureWithTranslatedChildSymbolPropertiesXliff, methodNoDiagnosticTranslatedChildSymbolProperties) andNamespaceTranslatedReportColumnCaptionXliffContent(methodNoDiagnosticTranslatedChildSymbolPropertiesWithNamespaces). NewHasDiagnostic/NoDiagnosticcases are added to the existing methods.Trans-unit IDs were not computed by hand: each fixture (markers stripped, plus a
Lockedvariant) was compiled as its own scratch app ("features": ["TranslationFile", "NoImplicitWith"], runtime 16.0, platform 29.0.0.0, System symbols only; runtime 18.0 +TranslationsWithNamespacesfor the namespaced one) with the localal compile(AL 30.0.42.11883), and the<trans-unit id>values (includingal-object-targetfor the extension units) plusXliff Generatornotes were copied fromTranslations/TestApp.g.xlf. All fixtures compiled without errors or warnings; everyLockedvariant 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 existingTranslationIdHelpermatches 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 newHasDiagnosticcases,NamespaceReportColumnCaption, and the 3 count cases below); theLocked/translated cases passed.No double report.
HasDiagnosticAtAllMarkersonly checks that some diagnostic exists at each marker (RoslynTestKitAnalyzerTestFixture.HasDiagnostic), so it cannot catch a duplicate. The newHasSingleDiagnosticForMemberAddedByExtensionrunsCompilationWithAnalyzersdirectly onPageExtensionViewCaption,ReportExtensionColumnCaptionandReportExtensionDataItemRequestFilterHeadingand asserts exactly one LC0091 diagnostic, located at the single marker. All three pass.Pinned-ID check: changing
Report 2858589782 - ReportColumn 3647812821 - Property 2879900210to...3647812822...madeNoDiagnosticTranslatedChildSymbolProperties("TranslatedReportExtensionColumnCaption")fail withMissing translation for 'Caption' in language(s): da-DK(1 failed, 230 passed); reverted.Deliberate non-reports found
fieldgroup(...)(AL0104 syntax error), andObjectParser.ParseFieldGroupChange(:11401-11418) always builds an emptyPropertyListforaddlast(<group>; <fields>) { }, althoughFieldGroupAddChangeSyntaxhas a property-list slot;addlast(Brick; MyField) { Caption = '...'; }fails with AL0104. So there is no tableextension field group fixture, andChangeis not registered.SynthesizedReportLayoutSymbol(ReportObjectMembersHelper.cs:160-175, fromRDLCLayout/WordLayout/ExcelLayout) has no properties and never raises a symbol event; the compiler writes no unit for it (checked withal compile). Correction to the plan: it does carry the property'sDeclaringSyntaxReference, so the reason is the missing event and properties, notAnalysisScope.ShouldSkipSymbolAnalysis.Captionin a Removed table.FieldGroupSymboldoes not overrideIsObsoleteRemovedandLabelWriterVisitor.IsObsoletelocks only fields by their table, so the compiler writes the unit (checked withal compile) and LC0091 reports it.Captionis emitted (Report MyReport - ReportColumn MyColumn - Property Caption), so it is included.al compilegenerates 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 theMemoryFileSystem(confirmed: no compile errors). A report withrenderingneedsDefaultRenderingLayout(AL0721).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, whyChangeis not registered, table fieldOptionCaption), 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)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-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 errorsdotnet format ALCops.sln --verify-no-changes: exit 0Validate-Rules.ps1: OK, 69 rules files (15 guides, 54 rule docs) pass all checks🤖 Generated with Claude Code