Skip to content

complexity enforcement for affected set floor - #6540

Merged
briansrls merged 40 commits into
mainfrom
session/smart-eagle-362
Jul 14, 2026
Merged

briansrls merged 40 commits into
mainfrom
session/smart-eagle-362

Conversation

@briansrls

@briansrls briansrls commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

PR-2 of complexity-as-compilation: the AuditOnly stopped-line ledger over the gated v2 compile door (DESIGN §5 factory model). Builds on PR-1 (#6527, merged), which enrolled the accumulator-copy lens as a required root-grain compile lens so a complexity violation is a compile failure.

v2.workflow.compile_door_ledger drives real affected-set .dag paths through the gated door (compile_source_root_ingest_with_admission) and produces one typed, counted DoorLedgerRow per path — DoorCompiled | DoorRefused{reason} — aggregated into a cause histogram: the burn-down list toward "v2 compiles the repo". A shared module-graph census runs once per call; each row's import_closure is fed into the door ingest.

The per-lens flip-to-Blocking triggers are modeled as data in the carrier (known_frontier_causes; DESIGN §6, no parallel-ledger doc): each frontier cause → owning lane (ThisLaneCalibration | SharedSelfHostCriticalPath | MigrationOwned) → named flip trigger. Attribution is fail-closed — an unknown cause is UNATTRIBUTED, never silently bucketed.

Deliberately NOT a CI floor gate

The seed compile path has no lens stage, so there is no stopped line to gate. A per-PR affected-set gate now would either block every PR (the whole corpus refuses) or pass despite refusals — the DESIGN §5 absorbing fallback. Gate wiring is deferred behind a named trigger: v2 interpreted compile becomes the actual compile path (the migration). The ledger's CI presence today is the frontier-pinning witnesses; when a cause zeroes, the matching assertion goes red and the flip-trigger table advances.

Honest frontier finding (no fail-open receipt)

No real import-carrying module demonstrates closure-feeding as load-bearing pre-migration: admit_named_exports admits field names too, so std.bit self-collides on its own repeated field bits (in Nibble and Byte) at the subject admission step, before admit_imports; std.currency reds earlier at parse (its coproduct syntax, not the import — std.bit imports too yet parses). This is the same flat-merge the namespace-only containment flip dissolves. The histogram exercises the door deep (modules reach resolve/infer/lens), but the peer-is-load-bearing property is counted, not faked.

Scope hygiene

The probe's real-module receipts (determinism, error_primitives) graduated into the ledger histogram (their durable home; DESIGN §2, one authority per receipt). door_real_module_probe now retains only its unique synthetic quad receipt, which nimble-boar-198 tracks and updates/deletes at the namespace-only flip.

Test plan

All witnesses green by execution (claim_batch --source-root dag --source-root src/v2 --claim-run --wet):

  • ledger_cause_histogram_over_mixed_affected_set (long lane) — determinism → fact_density_hollow_alias_locus, error_primitives → resolve_reason_unbound_symbol, bit → resolve_ambiguous_export: three distinct correctly-attributed causes over one real affected set; also asserts all_refused_causes_attributed.
  • every_pinned_cause_is_attributed_to_its_lane + unknown_cause_is_fail_closed_unattributed (regular lane, fast/pure).
  • quad_with_peer_reds_at_resolve_ambiguous_export (slimmed probe).

CI: the affected-set floor pass (discovery-resolve + affected witnesses + compile-clean --target dag).

Brian Searls and others added 30 commits July 13, 2026 01:29
…ator-copy) + gate probe

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e (model + witness)

Enrollment mechanism for complexity enforcement scoped to the affected set (the
changed .dag paths the floor already observes), not the corpus:

- v2.lens.complexity_accumulator_copy.roster_gate: FileSuspectVerdict +
  file_suspect_verdict(path) — typed suspect-only verdict (no ceiling, no -1
  ingest-regression sentinel a caller can misread as zero suspects).
- v2.workflow.complexity_affected_gate: affected_complexity_verdict(changed_paths)
  runs the accumulator-copy lens over changed .dag paths, SUSPECTS-ONLY (refusal
  ratchet is per-file offline-roster residue, not gated on an arbitrary diff);
  ingest-regress -> Unanalyzable refusal (fail-closed §5, never a silent widen).
  affected_complexity_floor_gate() is a nullary self-observing gate: it reads the
  diff via the floor's own git-diff host effect, so it enrolls as one gate row
  with no Rust executor change.
- Fixture + witness test with a discriminating RED control (a proven Poly2
  accumulator-copy refuses; the suspect-free floor runner passes; non-.dag paths
  filtered; a mixed diff refuses on the suspect). All green by execution locally.

Not yet wired into ci_floor_plan (the flip lands separately, after this fixture is
in main, so the live gate does not self-red on the RED-control fixture).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s fast-lane budget)

The gate witnesses do source_findings (parse+normalize) per real file, ~5s each,
over the 5000ms per-PR discovery fast-lane budget (operator 5s rule 2026-07-12).
Slow witnesses live in a long/ test dir and run via the dedicated lane, not per-PR
discovery — same home as the sibling accumulator_copy_fold_analysis_test. Module
renamed to v2.test.long.complexity_affected_gate.
…lexity violation = compile failure

Operator direction 2026-07-13: complexity enforcement is a normal feature of
compilation (a Poly2 suspect FAILS compile, same citizenship as a type error),
and compilation is already affected-set-scoped in CI — so enrolled lenses
inherit diff scoping from compile. The witness lane reverts to red control.
Interpreted-door contract per sharp-bee-290: single gate authority
(validate_then_compile), no seed-side Rust realization, no fallbacks.

- v2.lens.complexity_accumulator_copy.compile_gate (new): the lens as a compile
  citizen. Poly2Suspect REJECTS (diagnostic located at the finding node, full
  finding ledger in the rejection tail); Unclassifiable refusal causes ride the
  Accepted diagnostics channel — typed per-cause, located, counted, non-gating
  (the stopped-line ledger, never silently dropped).
- 00_compile.dag: always_required_root_lenses() — a second required-roster
  GRAIN on the same door (root-grain, run once), because the lens is a rooted
  carrier-threading walk and per-subtree-node invocation would be O(n^2): the
  enforcement of the complexity lens must not violate the complexity lens.
  Wired by prepending root-required lenses to the caller-lens run inside
  validate_then_compile; fires on every door call regardless of caller lenses.
- Witnesses (long lane, green by execution): quadratic snippet REJECTS with
  accumulator_copy_poly2_suspect; identity fold ACCEPTS clean; unregistered-
  combiner-carrying-carrier ACCEPTS with counted refusal ledger; resolved add
  fixture passes the door with empty caller lenses (roster runs, clean passes).
- Dissolved: the #6527 per-lens witness-lane runner (complexity_affected_gate
  workflow module, FileSuspectVerdict roster_gate additions, diff-scoped gate
  test, suspect fixture) — the parallel-plumbing anti-pattern this replaces.

Known pre-existing red (NOT introduced here, verified by stash-run on the
unmodified tree): lens/application rejecting_lens_blocks_before_compile
_claim_holds FAILs on main — a rotted offline claim, tracked separately.

End-to-end door RED (real module through tokenize->resolve->infer->gate) is
homed in the PR-2 CI transport stage whose red control ingests a real corpus
module; an import-free snippet cannot pass resolve (proven by execution).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s module compiles through the gated v2 door to the lens gates

Feasibility receipts for the CI transport stage (interpreted door, real bytes),
each pinned as a witness that goes red when its cause zeroes:

- std.determinism (real bytes via filesystem_read, zero imports) passes
  assemble->resolve->infer and reds at the PRE-EXISTING per-node fact_density
  lens (fact_density_hollow_alias_locus). The door WORKS on real corpus
  modules; the existing required roster is not corpus-calibrated.
- std.error_primitives reds at resolve (resolve_reason_unbound_symbol —
  generic type params).
- A synthetic import+peer pair reds at resolve (resolve_ambiguous_export);
  also found: packaged parse() reds import-carrying source
  (parse_grammar_choice_overlap_residue) where parse_production accepts it.

Consequence by receipt (not caution): the transport stage must be the
AuditOnly stopped-line ledger — per-(module, stage, cause) counted refusals
over the affected set — whose cause histogram is the burn-down list toward
v2-compiles-the-repo, each cause-zero a named flip-to-Blocking trigger.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Brian Searls and others added 5 commits July 13, 2026 21:17
… door output

Wires the previously-unexercised all_refused_causes_attributed helper into the
mixed-affected-set witness: every cause the ledger counts is attributed to an
owning lane, proven over live door output (not just the synthetic ownership
table). Removes a dead helper and links the histogram to the flip-trigger table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 13, 2026 22:03
@gunbai-bot

gunbai-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Addressed the cost-shape nit from the review (cause_ownership_lookup not short-circuiting): replaced the whole-table fold with a short-circuiting generic list_find_first that returns on the first hit, per the standing bare-minimum-cost ruling (2026-07-10 — 'n is small here' is not time-stable; known_frontier_causes grows as causes are modeled). Homed locally with a promotion note (facts-before-abstraction: promote to std/algebra when a 2nd consumer inhabits it). Verified green by execution (fast attribution witnesses + the long histogram witness). Also merged origin/main. New head 82ff86c. — sent from smart-eagle-362

Brian Searls and others added 3 commits July 13, 2026 23:24
…tion)

door_ledger_over_affected_set reads the PR's changed .dag modules off the git
diff (floor_observe_git_diff_name_status_for_ci — the same name-status
observation the CI floor uses) and ledgers exactly those through the door.
Pure core affected_ledger_from_diff (diff-as-data) is split from the shell
wrapper so both arms are provable by execution: a diff-observation FAILURE
refuses fail-closed (AffectedDiffRefused, carries the observation's reason,
never widens to the whole corpus — the §5 absorbing-fallback guard the
affected-set floor was repaired to remove); a diff OK ledgers the .dag-filtered
changed paths. AuditOnly: a counted histogram over the affected set, never a
gate (no stopped line while the seed is the compile path).

Tests (fast, no shell/door): dag_module_paths filter (5→3, 2→0, 0→0),
affected_set_diff_failure_refuses_fail_closed, affected_set_non_dag_changes_ledger_empty.
The live git-observation half is floor_diff_observe's own tested code; door_ledger
itself is the histogram witness.

Removes the throwaway timing probe (measurement receipt, not a witness):
small-closure module ~53s through the interpreted door, one large-closure module
(04_infer) did not finish in 10min — whole-corpus is days+, dominated by the
interpreted door and redundant per-module closure re-resolution, which is why the
affected set is the viable unit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rove both arms

Both arms of the affected-set entry are now green by execution over synthetic
diff data: diff-failure refuses fail-closed (no whole-corpus widen), diff-ok
ledgers the .dag-filtered changed paths. The live git-observation half remains
floor_diff_observe's tested code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gunbai-bot

gunbai-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

On the non-blocking note (cause_is_attributed / ledger_all_compiled as Bool-over-Optional/coproduct): verified these are faithful projections for boolean consumers, not the state-space conflation DESIGN flags. cause_is_attributed collapses Optional, a clean 2-state (found / not-found) — not an Option overloaded to mean >2 things — and the full ownership (lane, flip trigger) stays available via cause_ownership_lookup where the detail is needed. ledger_all_compiled is a refused-count == 0 summary with the whole histogram still exposed by ledger_cause_histogram / ledger_cause_count. No richer state is discarded that a consumer needs, so no split into named variants is warranted. Leaving as-is. — sent from smart-eagle-362

@briansrls
briansrls merged commit 0a293cf into main Jul 14, 2026
3 checks passed
@briansrls
briansrls deleted the session/smart-eagle-362 branch July 14, 2026 00:06
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