Skip to content

Lexicon contract: check-lexicon tests for files, not for wiring #1342

Closed

Description

@lex00

Part of the lexicon contract epic (#1340).

The defect

38 of check-lexicon's 41 checks test that a file exists. None of them test that the plugin wires it up. Only four checks evaluate behavior: "every shipped example builds", the three intrinsics checks, plus the docs-reachability check from #1325.

Two live casualties:

  • helm ships src/lsp/completions.ts and src/lsp/hover.ts, both with passing tests, and exports helmCompletions/helmHover from its index — but plugin.ts sets neither completionProvider nor hoverProvider. cli/lsp/server.ts:246,282 dispatches through exactly those fields, so helm's LSP support is unreachable in an editor. Tier 1 requires the files, tier 2 requires the tests, both pass.
  • azure has src/codegen/docs.ts but no docs() hook on the plugin. Its docs generate only because the package script calls the CLI directly.

Into the contract

A capability counts as present when the plugin exposes it, not when a file with the right name exists on disk. Rewrite the file-existence checks as registration checks by loading the plugin and inspecting the member:

Today (tier 1) Becomes
src/lsp/completions.ts exists plugin.completionProvider is a function
src/lsp/hover.ts exists plugin.hoverProvider is a function
src/serializer.ts exists plugin.serializer satisfies Serializer (incl. name, rulePrefix)
src/plugin.ts exists the module's default export passes isLexiconPlugin()
At least 1 lint rule in src/lint/rules/ plugin.lintRules() returns ≥ 1
At least 1 post-synth check plugin.postSynthChecks() returns ≥ 1

Same treatment for tier 2's "uncommented mcpTools/mcpResources/skills/detectTemplate/initTemplates", which today are a regex over plugin.ts source text and would pass on a method that throws.

Done when

  • Checks load the plugin and assert on members
  • helm registers its LSP providers; azure registers docs()
  • The source-text regex checks in tier 2 are gone
  • 12/12 still green

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