Skip to content

Epic: pull the lexicon contract's conventions into the contract #1340

Closed

Description

@lex00

Epic. Audit of the lexicon contract at 4b5d35a3, and the work to pull everything it currently leaves to convention into the contract itself.

The contract today

Layer Size Enforced
LexiconPlugin (packages/core/src/lexicon.ts) 6 required members, ~30 optional typecheck only; isLexiconPlugin() checks 6
chant dev check-lexicon 41 checks — 18 tier-1, 14 tier-2, 9 tier-3 tier 1 gated in CI; tiers 2/3 advisory
docs/src/content/docs/lexicon-authoring/ 18 pages not at all

The organising finding: 38 of the 41 checks assert that a file exists. None assert that the plugin wires it up. Only four checks evaluate behavior — "every shipped example builds", the three intrinsics checks — plus the docs-reachability check added in #1325. Everything below follows from that, or from a capability that grew in the lexicons without a contract member to grow into.

Work breakdown

# Gap What goes into the contract
#1341 MCP tool names are double-prefixed in production (gitlab:gitlab:diff, aws:aws:diff) idempotent namespacing owned by core; the :diff / :resource-catalog / read-only-context naming convention written down; a check
#1342 check-lexicon tests for files, not wiring — helm's LSP is unreachable and passes both tiers capability presence means the plugin exposes it; rewrite the existence checks as registration checks
#1343 The completeness checklist documents seven checks that do not exist, and omits two that do doc and tool agree, verified by a drift guard rather than by review
#1344 Per-lexicon config namespaces (k8s, temporal, forgejo) are undeclared, unvalidated, and untypeable a lexicon declares the namespace it owns; core validates it; the documented examples compile
#1345 azure, gcp and fly ship emulators without declaring EmulatorCapability all four emulators declared; image pinning has one home; the capability gets authoring docs
#1346 auditCatalog is unchecked and undocumented; its drift guard hardcodes nine lexicon names checks contribute metadata or fail; the guard enumerates; fly and temporal get catalogs
#1347 Eight members have no authoring docs; lexicon.ts misattributes two of its own docblocks complete the optional-methods table; reattach the docblocks; guard against future drift
#1348 The ownership marker channel is an obligation with no declaration and no check declare the channel; verify total verdicts behaviorally
#1349 declarativeRules, init, codeActionProvider have zero adopters; rulePrefix is declared but unchecked no advertised member without an adopter; rule ids verified against the declared prefix

The through-line

Each item is the same shape: something load-bearing is agreed by convention among the lexicons, and nothing in core knows about it. A convention holds until the twelfth lexicon, or the second author, or a refactor — gitlab:gitlab:diff is what that looks like when it stops holding, and it has been shipping.

The fix in every case is the same: name the thing in the contract, validate it once in core, document it where an author will look, and gate it.

Order

  1. Lexicon contract: MCP tool names are double-prefixed in production #1341 — a live user-facing bug
  2. Lexicon contract: the completeness checklist documents seven checks that don't exist #1343 — the docs currently mislead about what is verified
  3. Lexicon contract: check-lexicon tests for files, not for wiring #1342 — the structural fix; makes several of the others checkable
  4. Lexicon contract: three lexicons ship an emulator without declaring the emulator capability #1345, Lexicon contract: auditCatalog is unchecked, undocumented, and its drift guard is hardcoded #1346, Lexicon contract: three members have zero adopters; rulePrefix is declared but unchecked #1349 — capability adoption, mechanical once Lexicon contract: check-lexicon tests for files, not for wiring #1342 lands
  5. Lexicon contract: per-lexicon config namespaces are undeclared, unvalidated, and untypeable #1344, Lexicon contract: ownership marker channel is an obligation with no declaration and no check #1348 — new contract surface, needs design
  6. Lexicon contract: eight members have no authoring docs, and lexicon.ts misattributes two docblocks #1347 — documentation, last so it describes the finished contract

Activity

  1. changed the title [-]Lexicon contract: audit of what it enforces, what the docs claim, and what lexicons do outside it[/-] [+]Epic: pull the lexicon contract's conventions into the contract[/+] on Aug 3, 2026
  2. lex00 commented on Aug 3, 2026

    @lex00
    ContributorAuthor

    All nine children are closed and merged.

    What went in

    # Gap What is now in the contract
    #1341 MCP names doubled in production (gitlab:gitlab:diff, aws:aws:diff) idempotent namespacing owned by core, the naming convention written down, a tier-1 check on the registered name
    #1342 38 of 41 checks tested for files, not wiring seven tier-1 and five tier-2 checks load the plugin and ask it — which caught helm's unregistered LSP providers and azure's unregistered docs()
    #1343 The checklist documented seven checks that did not exist and omitted two that did the doc's first column is the check's own name, with a drift guard in both directions
    #1344 Config namespaces undeclared, unvalidated, untypeable configSchema validated at load, and the same schema derives the ChantConfig augmentation
    #1345 Three of four emulators undeclared emulator takes one or many; all five declared; images pinned; freshness generalized
    #1346 auditCatalog unchecked and undocumented checks contribute metadata or warn; the drift guard enumerates lexicons instead of listing nine
    #1347 Eight members with no authoring docs; two docblocks on the wrong members complete member table with an AST-backed guard; docblocks reattached and pinned by test
    #1348 The ownership marker obligation had no declaration and no check ownershipChannel per read path, enforced behaviorally by the conformance suite and statically by check-lexicon
    #1349 Three members with zero adopters; rulePrefix declared but unchecked the seams are exercised rather than deleted; rule ids gated against declared prefixes

    Tier 1 went from 18 checks to 21, all twelve lexicons passing.

    Bugs this surfaced that were not the point of the audit

    • chant serve mcp was handing agents gitlab:gitlab:diff and aws:aws:diff, with every doc naming the single-prefixed form
    • --live --env <local> against azure silently read real Azure — core's endpoint map asserted azure had no ambient variable while describe-resources.ts read AZURE_ENDPOINT_URL on every call
    • helm's LSP support was unreachable in an editor for as long as the lexicon has existed
    • a forgejo config typo left the dialect on its defaults, silently
    • fly's and temporal's six post-synth checks reached chant audit with no metadata

    The through-line

    Each item was the same shape: something load-bearing agreed by convention among the lexicons, with nothing in core that knew about it. gitlab:gitlab:diff is what that looks like when a convention stops holding, and it had been shipping.

    Four of the fixes are guards rather than corrections, so these classes cannot silently return.

    Follow-ups filed

    #1388 (CI typechecks neither lexicon tests nor examples — gating half merged, 85-file backlog remains), #1390 (aws spec pinning, merged), #1400, #1417, #1418.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions