bcquality/custom/knowledge/architecture/namespace-must-be-verified-from-source.md
Michael Dieringer dd5637b1db Custom-laget bestaar nu begge CI-checks: 72 validator-fejl -> 0
Normalisering af alle 39 custom knowledge-filer til READ-kontraktens
skema (validate_frontmatter.py + Test-KnowledgeIndex.ps1 begge groenne):

- R01/R02: 28 filer manglede frontmatter eller brugte aeldre skemaer
  (title/category/severity/rule-id m.fl.) - alle har nu praecis de 6
  kraevede noegler; keywords haandskrevet pr. fil da de driver
  worklist-selektionen i INDEX/knowledge-index
- R09: manglende Description-sektion - regel-agtige foersteoverskrifter
  (Core Rule/Rule/Regel/Core Principle) omdoebt, eller sektion indsat
  efter titlen hvor intro-tekst fandtes
- R10: fenced code blocks konverteret til 4-space indrykkede blokke
  i alle filer (indhold uaendret)
- R11: 4 filer over 100 linjer fortaettet redaktionelt uden semantisk
  tab (ai-eval-scores 143->100, git-lifecycle 121->97,
  permission-sets 113->99, test-feature-scenario-tags 105->91)
- R05: AL0197->al0197, add_repo->add-repo; keyword-lister trimmet
  til maks 10

Ingen regler er fjernet eller aendret i betydning - kun form.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 23:47:31 +02:00

2.5 KiB

bc-version domain keywords technologies countries application-area
all
architecture
namespace
verification
bcapps
source-of-truth
al
w1
all

AL Language Namespace Verification Rule

Description

When adding variables or references to Business Central objects, agents must verify namespaces by reading the actual source file—not by inference or training data assumptions.

Key Principle

The documentation emphasizes: "The authoritative source for a namespace is always the object's own source file." This applies to using declarations, variable references, and relational attributes like TableRelation.

Verification Process

The prescribed workflow involves three steps:

  1. Locate the object's source file using glob patterns or symbol search
  2. Read the namespace declaration from line one
  3. Add the verified namespace to the consuming file's using statements

Critical Distinction

A file may compile in an agent's local build but display errors in VS Code because the AL Language Server uses different namespace resolution. "The definitive compilation result is what VS Code shows—not the agent's internal build."

What to Avoid

The anti-pattern warns against incomplete namespaces like using SettlementVoucher; and guessed namespaces such as using Microsoft.Purchases.Vendor; without verification.

Pre-Delivery Checklist

Before delivering code, agents must:

  • Enumerate all using statements
  • Confirm each namespace derives from actual source inspection or symbol lookup
  • Correct any assumed namespaces by re-reading the source

This rule reflects that Microsoft's namespace structure changed significantly from BC24 onward, making assumptions increasingly unreliable.

BCApps Reference

BCApps is the authoritative source for all Microsoft namespace paths post-BC24. The entire Microsoft.* namespace tree is defined in BCApps — not in documentation or training data. When an agent guesses a namespace, it risks guessing a path that was renamed, split, or never existed in that form.

  • Source: https://github.com/microsoft/BCApps/tree/main/src
  • Example: BCPTSuiteAPI.Page.al declares namespace System.Tooling; — guessing System.Performance or Microsoft.BC.Tools would compile locally but break in VS Code's language server.
  • Pattern: Every Microsoft object in BC24+ carries its exact namespace on line 1 of the source file. Reading that line is the only reliable verification method.