Repository navigation
Description
Summary
Add an automated spec inventory gate so drift in keywords, user-facing attributes, CLI commands/flags, and stdlib module names is caught by with build :test instead of rediscovered during requirements audits.
Spec
The inventory should be derived from the normative spec tables:
docs/with-specification.md:9608-9634for CLI commands and stable flags.docs/with-specification.md:9922-9967for stdlib layering and module map.docs/with-specification.md:11179-11208for the user-facing and implementation-internal attribute index.- Section 29.11 for the keyword inventory.
Current state
There is already a precedent for build-time spec drift checks. build.w:457-463 defines requirements-informative-check, and build.w:923 makes the test group depend on it.
The compiler's keyword set is in src/Token.w:26-68. Attribute parsing currently accepts user-facing and internal attributes in src/Parser.w:520-667, including internal entries such as bench, stack_size, callconv, and compiler_hook. The CLI command table and help text live in src/main.w:601-742 and src/main.w:2485-2564. The checked-in stdlib module files are under lib/std/.
No single gate currently compares those implementation inventories to the spec tables.
Implementation plan
- Add
scripts/check-spec-inventory.py. - Parse
docs/with-specification.mdfor:- keyword table in §29.11,
- attribute table in §29.14 plus the internal-attribute note,
- CLI tool table and additional stable flags in §18.5,
- stdlib module map and layer-1
std.osrequirement in §18.6.
- Parse implementation inventories from:
src/Token.wkeyword token names,src/Parser.waccepted@[...]attribute names,src/main.wcommand dispatch/help and stable flags,lib/std/*.wmodule filenames.
- Include a narrow allowlist for implementation-internal diagnostic surfaces called out by the spec, not a generic ignore bucket.
- Wire the script into
build.wbesiderequirements-informative-checkand make:testdepend on it.
Test plan
- Run the new script directly and verify it fails on a deliberately edited temporary mismatch.
- Run
with build :testafter wiring to confirm the gate is part of the normal test graph. - Add focused script-level fixtures if the project already has script tests; otherwise keep the parser small and deterministic enough that the build target is the test.
Acceptance criteria
- Drift between the spec inventories and implementation inventories fails loudly.
- Internal commands/attributes are allowed only when the spec marks them implementation-internal.
- The gate is included in
with build :test. with build,with build :fixpoint,with build :test, andwith build :test-greenpass before this issue is closed.
Dependencies
Related to #386 because a regenerated requirements file makes the same source-of-truth relationship explicit, but this gate should read the spec directly rather than trusting stale requirements output.
Activity
Spec v7.0/v7.1: resolve contradictions, integrate rulings, collection…
Requirements triage campaign: checkbox, verdict, and issue-link every…
ehartford commentedon Jun 10, 2026
Implemented in 6b8b2a6. Added the spec inventory gate, wired it into :test, documented current internal attributes, added std.testing facade coverage, and regenerated requirements.