Skip to content

Gate the complexity lens by-execution (discoverable test fn witnesses) - #5085

Merged
briansrls merged 3 commits into
mainfrom
session/swift-lark-813
Jun 17, 2026
Merged

briansrls merged 3 commits into
mainfrom
session/swift-lark-813

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Gate CI on the complexity lens (src/v2/lens/complexity.dag) by-execution.

The lens is the asymptotic projection of lens/cost.dag's SymbolicCost (ratified
U2: it consumes cost_lens and never re-derives cost). It had five witness files
under src/v2/lens/complexity/ that declared expected_* claims and *_actual_*
helpers — but no test fn Bool assertion, and weren't named *_test.dag. The
live CI gate is claim_batch --roster-from-discovery, which discovers test fn
witnesses in *_test.dag across src/v2. So discovery skipped them: the lens was
specified without execution (the §5 trap). (The hand-roster in
src/v2/workflow/lens_ci_gate.dag that references the lens is no longer consumed by
anything — it's a dead leftover from the pre-discovery gate; left untouched here.)

This converts four witnesses to discoverable test fn *_test.dag form, asserting
the lens output against the declared expectation:

  • map_id — Cardinality(Transform) → LinearCost / linear complexity.
  • nested — nested Cardinality → product cost / multidimensional quadratic
    bound over two distinct size variables.
  • while_external_condition — fail-closed (§5): a Loop with an undeclared bound
    must Violate, never fabricate a finite bound; the projection propagates the
    Violation.
  • algebra_receipts — degree-4 product algebra (two degree-2 polynomials over
    distinct variables) and variable-sensitive dominance (two linear bounds over
    different variables are incomparable).

Each assertion is actual == declared_expected, structurally discriminating (a
RED control comparing the linear cost against zero_cost() returns false/exit 1).

Finding (not fixed here, out of scope)

The fifth witness, typescript_wave2a_type_alias_task, declared a linear
expectation that is wrong: the lens actually projects constant complexity for
that subject — a Cardinality over a zero-cost emitted record body, because
cost.dag's IterativeCost multiplies the linear traversal base by the zero-cost
body → zero. Whether IterativeCost should preserve the linear traversal term when
the body is zero-cost is a cost.dag modeling question (U2: not my authority to
re-derive cost). Left as-is (reverted to its original ungated descriptive form) and
flagged for a cost-model review rather than cementing a debatable behavior.

Test plan

  • claim_batch --source-root src/v2 --roster-from-discovery --scan-dir src/v2/test
    (the CI floor): 186 witnesses passed, 0 FAIL (was 178; +8 new complexity-lens
    witnesses now discovered and green).
  • Per-witness gunbc run ... --claim-run: all 8 green; RED control confirms the
    equality assertions discriminate.

Closes #5085 work item (node://adhoc-191c6374-90e).

@gunbai-bot gunbai-bot Bot changed the title Gate CI on the complexity lens (src/v2/lens/complexity.dag). The lens is the asymptotic PROJECTION of lens/cost.dag's SymbolicCost (ratified U2: it CONSUMES cost_lens and never re-derives cost — do NOT create a second cost authority). It's referenced in src/v2/workflow/lens_ci_gate.dag but likely no Gate the complexity lens by-execution (discoverable test fn witnesses) Jun 17, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 17, 2026 07:09
@briansrls
briansrls merged commit 00cbaf8 into main Jun 17, 2026
1 of 2 checks passed
@briansrls
briansrls deleted the session/swift-lark-813 branch June 17, 2026 07:33
briansrls added a commit that referenced this pull request Jun 17, 2026
…ty_gate witnesses to discoverable test fn *_test.dag (#5087)

The budget gate — complexity_bound_dominates(declared_budget, computed_class) over
the source-bridged COMPREP `add` subject — was written as plain fn ..._claim_holds
in non-*_test.dag files, so claim_batch --roster-from-discovery ran it ZERO times
(coverage-by-illusion; the lens_ci_gate.dag roster that named it is dead/unconsumed).

Rename source_bridged_add_budget.dag and budget_roster_completeness.dag to
*_test.dag and mark the gate functions test fn so the CI floor discovers them:
- source_bridged_add_budget_claim_holds: real add body costs, its ConstantComplexity
  budget dominates the computed class, and a too-tight constant budget does NOT
  dominate a linear class (over-budget -> RED, §6 lattice control).
- complexity_budget_roster_family_gate_holds: fail-closed family fold over the real
  roster (empty -> false, never vacuous green) + embedded planted-bad-row red.
- complexity_budget_roster_unrated_declared_budget_semantic_red_holds: explicit
  planted-bad-row discrimination (unrated budget appended -> family fold rejects).

Verified by execution: all 3 green AND present in claim_batch's discovered roster
(178 -> 181 witnesses, 0 FAIL). Disjoint from #5085 (complexity lens). The gate
grows as bind/branch/loop subjects get rostered later.

Co-authored-by: Brian Searls <briansrls@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant