§05 Spec tests — capset conformance corpus
Goal
Author the Ori-language spec test files that exercise capset declarations end-to-end. Pairs with §02 / §03 / §04 to provide conformance coverage as those phases land.
Implementation Sketch
Spec tests exercise the full pipeline (lex → parse → typeck → eval) so they cannot land before §02 + §03 ship. Each test file follows the existing compiler_repo/tests/spec/ convention: top-of-file use std.testing { assert, assert_eq }; import, one @t tests _ () -> void = { ... } per scenario, #skip / #fail / #compile_fail annotations only with BUG-XX-NNN references per .claude/rules/test-disposition.md.
Four test files map to the proposal’s documented surface:
tests/spec/declarations/capsets.ori— declaration shape only (parser conformance). Owned by §02.tests/spec/capabilities/capset.ori— happy-path usage inusesclauses, transitive expansion. Owned by §03.tests/spec/capabilities/capset-errors.ori— E1221 / E1222 / E1223 with#compile_fail("E1221")etc. Owned by §03 + §04.tests/spec/capabilities/capset-visibility.ori— E1224 visibility scenarios + happy-path. Owned by §03 + §04.
Implementation Items
- Author
compiler_repo/tests/spec/declarations/capsets.ori:- Basic:
capset Net = Http, Dns, Tls;declares correctly (assert via reflection or viausesintegration test). - Pub form:
pub capset Logging = Logger;. - Single member:
capset Logger = Log;. - Trailing comma:
capset Net = Http, Dns,;.
- Basic:
- Author
compiler_repo/tests/spec/capabilities/capset.ori:- Function using a capset:
@process () -> void uses Net = ...whereNet = Http, Dns, Tls. - Transitive:
capset A = B; capset B = Http;and a functionuses A. - Mixed:
uses Net, Logger(capset + bare capability). - Order-independence: deduplicated expansion regardless of member ordering.
- Function using a capset:
- Author
compiler_repo/tests/spec/capabilities/capset-errors.ori:#compile_fail("E1221")test for empty capset.#compile_fail("E1222")test for cyclic capsets.#compile_fail("E1223")test for non-capability member.
- Author
compiler_repo/tests/spec/capabilities/capset-visibility.ori:- Happy path:
pub capsetreferencing onlypubcapabilities works across module boundaries. #compile_fail("E1224")test forpub capsetreferencing private capability.
- Happy path:
- Run
cargo stand verify all four files green. - Phase audit: confirm no
#skipannotations land withoutBUG-XX-NNNreferences per.claude/rules/test-disposition.md.
Spec References
- Proposal §Design + §Expansion + §Validation.
- Spec
20-capabilities.md §20.11. tests.md §Disciplineandtests.md §Matrix Testing Rule.test-disposition.mdfor any#skip/#fail/#compile_failannotation guidance.
Tests
This IS the test section — no further test sub-section.
Intelligence Reconnaissance
scripts/intel-query.sh file-symbols "compiler_repo/tests/spec/capabilities/" --repo ori to inventory existing capability spec tests for sibling-pattern reference. scripts/intel-query.sh similar "test_capability_usage" --repo ori for assertion-shape conventions.
Roadmap drain
When this section lands green, the following roadmap pointers retire:
plans/roadmap/section-00-parser.md§0.3.9 (Capset Declarations audit checkboxes).plans/roadmap/section-00-parser.md§0.8 line 968 (Capset declaration spec tests gap).plans/roadmap/section-06-capabilities.md§6.13 (full capset implementation block).
Each gains its <!-- blocked-by:plans/capset/... --> pointer when this feature plan is created (Phase D of the lazy-migration tooling pass); the audit checkboxes in those locations CLOSE when their blocked-by target closes (i.e., when this feature plan finishes).