0%

§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 in uses clauses, 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 via uses integration test).
    • Pub form: pub capset Logging = Logger;.
    • Single member: capset Logger = Log;.
    • Trailing comma: capset Net = Http, Dns,;.
  • Author compiler_repo/tests/spec/capabilities/capset.ori:
    • Function using a capset: @process () -> void uses Net = ... where Net = Http, Dns, Tls.
    • Transitive: capset A = B; capset B = Http; and a function uses A.
    • Mixed: uses Net, Logger (capset + bare capability).
    • Order-independence: deduplicated expansion regardless of member ordering.
  • 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 capset referencing only pub capabilities works across module boundaries.
    • #compile_fail("E1224") test for pub capset referencing private capability.
  • Run cargo st and verify all four files green.
  • Phase audit: confirm no #skip annotations land without BUG-XX-NNN references per .claude/rules/test-disposition.md.

Spec References

  • Proposal §Design + §Expansion + §Validation.
  • Spec 20-capabilities.md §20.11.
  • tests.md §Discipline and tests.md §Matrix Testing Rule.
  • test-disposition.md for any #skip/#fail/#compile_fail annotation 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).