Skip to content

Gate #104 Phase-1: cost lens witness-shaped public read + symbolic_cost_lookup wedge - #3137

Merged
briansrls merged 46 commits into
mainfrom
session/nimble-dove-181
May 15, 2026
Merged

briansrls merged 46 commits into
mainfrom
session/nimble-dove-181

Conversation

@briansrls

@briansrls briansrls commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase-1 wedge for R3 §1.8 gate #104 (lens_read_witness_shape_dissolved): the cost lens public port read path is witness-shaped (Witness<SymbolicCost> via resolve_producer attribution and UnknownCost when no producer), with a table-only Lookup surface exposed as symbolic_cost_lookup for algebra/analyzer callers. The Behavior fold accumulator remains Lookup<SymbolicCost> so emit_rust_module / regen_lens stay compositionally sane.

Follow-on deferrals (not claimed by this PR): Phase 2 monomorphized accessor sweep, Phase 3 lookup.dag terminal deletion, additional lens carriers (complexity / infer_helpers / …), universal-coverage TestClaim authoring (Verification lane / separate dispatch per Substrate Mgr), and the Substrate brief (parallel work-item on their side citing §1.8 row #104).

Phase 1 receipt (ledger-safe)

Wedge slice: cost-lens public read path witness-shaped. Phase 2/3 (monomorphized accessor sweep + lookup.dag terminal deletion) + universal-coverage TestClaim + Substrate Mgr brief deferred to follow-on dispatches per §1.8 row #104 incremental progression. §1.8 row #104 STAYS at DECLARED — substantive evidence accruing, not yet promoted.

Ledger / promotion discipline (feedback_only_claim_what_actually_exists)

Test plan

  • cargo fmt --all --check
  • cargo check -p v3-compiler
  • Integration / CI on current HEAD (session/nimble-dove-181); branch hygiene commit: rustdoc + rustfmt-only touch-ups.

Worker attestation

  • Title describes the change (gate Add transport middleware pipeline with retry, rate limit, and metrics #104 Phase-1 cost-lens wedge; not raw session naming).
  • Body summarises wedge scope vs deferred program (above).
  • Hygiene-only final commit pushed; substantive logic already on branch earlier in series.
  • No secrets / large binaries.
  • Substrate Mgr (warm-wolf-698, msg_f1f1b82a-62d4-42b0-9876-f199cba8a66f): Ready flip authorized once hygiene clean — this PR aligns with Phase-1 substantive wedge framing only.

P5 / Pure Bootstrap Zero (review artifact)

Gate #104 Phase-1 concentrates narrow hand-Rust in lens_cost_symbolic::symbolic_cost_of (producer-lookup merge + malformed Violates) while deleting the collapsing .dag shim. Dissolution target: re-host that branch from emitted .dag when PBZ/class-5 can express typed ProducerLookup without collapsing legitimate NoProducer into malformed. Receipt: incremental §1.8 row #104 DECLARED framing in this PR (no CONSUMER_LANDED); explicit ROADMAP / follow-on sweep rows remain the checkable dissolution hook.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: bf3a3f22 · Trigger: schedule
  • Thinking: 215s wall

BLOCKING (3)

Root Cause

  • src/v3/lenses/cost.dag Gate #104 was applied at the public API/comment edge before the fold representation, lookup helper, and no-producer attribution model were migrated → either keep Lookup internal with one faithful Witness adapter or migrate all cost fold helpers to Witness end-to-end.

ROADMAP — Incomplete

  • lens_read_witness_shape_dissolved: docs/r3-program-plan.md §1.8 row #104 requires a Substrate Mgr brief covering >=3 lens carriers and a universal-coverage TestClaim before CONSUMER_LANDED, but this diff only changes src/v3/lenses/cost.dag.

⚠️ The carrier migration is directionally aligned with the thesis, but the current diff leaves the cost lens in a mixed Lookup/Witness state and fabricates missing-port attribution.

Comment thread src/v3/lenses/cost.dag Outdated
type SymbolicCostEntry {
port: PortId
cost: Lookup<SymbolicCost>
cost: Witness<SymbolicCost>

This comment was marked as resolved.

Comment thread src/v3/lenses/cost.dag Outdated
fn symbolic_cost_of(d: Dag, port_id: PortId) -> Witness<SymbolicCost> =
match resolve_producer(d, port_id) {
Some(subject) =>
lookup_cost_with_subject(

This comment was marked as resolved.

Comment thread src/v3/lenses/cost.dag Outdated
None =>
Violates {
reason: "symbolic_cost_of: unresolved producer for port"
at: symbolic_cost_fallback_subject_for_unresolved_port(d)

This comment was marked as resolved.

@briansrls briansrls changed the title Gate #104 lens_read_witness_shape_dissolved is DECLARED-status with no Substrate-Mgr-authored brief in docs/briefs/ and no inbox direction. §1.8 row gates CONSUMER_LANDED progression on (a) Substrate Mgr brief covering ≥3 lens carriers AND (b) universal-coverage TestClaim landed. Work is a bundled 7 Gate #104 Phase-1: cost lens witness-shaped public read + symbolic_cost_lookup wedge May 15, 2026
@briansrls
briansrls marked this pull request as ready for review May 15, 2026 01:31
briansrls added a commit that referenced this pull request May 15, 2026
…solution

Authority brief covering (a) requirement for DECLARED→CONSUMER_LANDED
progression per §1.8 row #104. ≥3 lens carriers bar met by structural
authoring across 6 files: cost.dag + complexity.dag (Phase 1
canonical) + infer_helpers.dag + algebra.dag + substrate.dag +
lookup.dag (Phase 2/3 sweep).

Brief cites:
- Director ratification msg_915aa2c1 (2026-05-12)
- Operator directive 2026-05-11 audit §0
- Two-part predicate (Part A grep terminal + Part B regression guard)
- Bundled migration shape (substrate-level Phase 1/2/3 + testgen-level
  universal-coverage TestClaim companion)
- Phase 1 wedge evidence accruing via nimble-dove-181 PR #3137
- STOP-AND-PING triggers for future Phase 2/3/TestClaim dispatches

§1.8 row #104 STAYS at DECLARED post-merge (wedge alone insufficient
per ≥3 carriers + universal-coverage bar). Substantive evidence
accruing per ratchet-only-down discipline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briansrls and others added 7 commits May 14, 2026 21:35
… fmt)

Co-authored-by: Cursor <cursoragent@cursor.com>
Codex REVIEW: ProducerLookup::BindCycle already carries authoritative NodeId;
use dag.node(detected_at) for Witness::Violates.at — not substrate_lens_read_diagnostic_anchor.

MissingPort/MissingNode keep diagnostic-anchor fallback when no Behavior exists.

Co-authored-by: Cursor <cursoragent@cursor.com>
- lens_cost_symbolic module + symbolic_cost_of: document port-keyed producer
  walk vs generated cost_lens_read (caller Behavior, table-only).
- cost.dag header: mirror the same Lens.read vs symbolic_cost_of split.
- Document non-empty Dag.nodes precondition for diagnostic-anchor Violates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

CLAUDE opus (review artifact stdout) — verified & addressed:

  1. cost_lens_read vs symbolic_cost_of — Finding valid: distinct fail-closed scope (table-only + caller Behavior vs port-keyed resolve_producer_lookup). Fix: module rustdoc on lens_cost_symbolic plus cost.dag header now state this explicitly (6d6bcaa19).

  2. P5 / PBZ wedge — Valid concern (hand-Rust growth + deferral receipt). Fix: PR description appendix “P5 / Pure Bootstrap Zero” pins Phase‑1 wedge, dissolution target (re-host in emitted .dag when PBZ can express typed lookup), and §1.8 #104 DECLARED as the ledger receipt — no CONSUMER_LANDED claim.

  3. Empty Dag + diagnostic anchor — Minor; anchor already **expect**s non-empty nodes. symbolic_cost_of rustdoc now documents the non-empty Dag::nodes precondition for Missing* paths.

Merge readiness (re-check): mergeStateStatus still BLOCKED; GitHub API shows no submitted APPROVE reviews (only COMMENTED automation). fmt green on latest run; ci / v3 still in flight on 6d6bcaa19. Needs ≥2 api-review APPROVE-style outcomes + REQUEST_CHANGES clear + rollup green before gh pr merge --squash.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: f2a0b789 · Trigger: schedule
  • Thinking: 355s wall

BLOCKING (2)

Root Cause

  • src/v3/compiler/src/lib.rs Port-level witness conversion treats producer absence as stronger authority than the folded cost table → preserve Lookup::Hit as Witness::Inhabits before falling back for no-producer Miss.
  • src/v3/std/substrate.dag Witness::Violates.at requires Behavior even when malformed-substrate failures have no honest producer behavior → carry a typed malformed-substrate subject/diagnostic instead of adding a first-node anchor accessor.

⚠️ The witness-shaped direction is right, but the new public read drops seeded parameter costs and the diagnostic anchor still fabricates attribution.

Comment thread src/v3/compiler/src/lib.rs Outdated
ProducerLookup::Found(subject) => {
generated::witness_from_symbolic_cost_lookup(&folded, subject.clone())
}
ProducerLookup::NoProducer => {

This comment was marked as resolved.

Comment thread src/v3/compiler/src/dag.rs Outdated
/// Gate #104 / R3 §1.8: deterministic `Behavior` anchor for `Witness::Violates { at }`
/// fallbacks where no producer `Behavior` is available (`resolve_producer` miss, empty Dag).
/// Never fabricates lattice facts — only clones the first topo `Behavior`; empty DAG panics (precondition breach).
pub fn substrate_lens_read_diagnostic_anchor(&self) -> Behavior {

This comment was marked as resolved.

@briansrls

Copy link
Copy Markdown
Contributor Author

Composer (/api/reviews/12433) — verified

  • Findings: None actionable; aligns with HEAD (ViolatesSubject / Witness::Violates { subject }, symbolic_cost_of vs symbolic_cost_lookup, PR body P5/PBZ + §1.8 #104 DECLARED).
  • Code change: None required.

Merge readiness (this moment)

  • CI on latest HEAD: green (fmt, ci, v3, self_host_ratchet).
  • mergeStateStatus=CLEAN, mergeable=MERGEABLE.
  • GitHub submitted reviews: API shows only prior COMMENTED automation snapshots — no APPROVED / REQUEST_CHANGES rows synced from the Composer APPROVE artifact path, so the ≥2 distinct api-review APPROVE-style criterion is not verifiable via gh here.
  • gh pr merge --squash not executed pending that review surface (or explicit maintainer override).

— sent from nimble-dove-181

briansrls and others added 2 commits May 14, 2026 23:08
…ariants

Composer #12455: use ProducerLookupMissing{Port,Node} names; describe Lens.read
Miss path as Violates.subject = AtBehavior(b), not stale at = b prose.

Co-authored-by: Cursor <cursoragent@cursor.com>

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: ee77a792 · Trigger: schedule
  • Thinking: 387s wall

BLOCKING (2)

Root Cause

  • src/v3/compiler/tests/integration/e6_g1a_option3_static_lens_test.rs Witness.subject migration used unsupported nested pattern destructuring → bind subject to a name or match it in a nested match.
  • src/v3/std/dimensions.dag The dissolution receipt was attached to the Rust mirror instead of the substrate authority → add the classification and ledger next to type ViolatesSubject.

⚠️ The witness-shaped direction fixes the prior issues, but the fixture parse break and missing substrate coproduct receipt need correction before landing.

match w {
Inhabits(c) => report_inhabits_branch(d, c, mini_lens.validate(d, c))
Violates { reason: _r, at: _beh } => dimension_fail_closed()
Violates { reason: _r, subject: AtBehavior(_beh) } => dimension_fail_closed()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: subject: AtBehavior(_beh) uses nested variant syntax in a named payload pattern, but the v3 parser only accepts a binding identifier after field:, so this fixture no longer parses.

Comment thread src/v3/std/dimensions.dag
// The coproduct is authored at the witness level, not above it in
// an `Option<Witness>` shape, so "no evidence" and "evidence of
// violation" cannot masquerade as each other (DB-3 §Rationale).
type ViolatesSubject

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: ViolatesSubject is a new substrate coproduct without its own 🟢/🟡/🔴 dissolution receipt, violating modeling-discipline Practice 4 / INVARIANTS P1.

@briansrls

Copy link
Copy Markdown
Contributor Author

Codex BLOCKING (ee77a79 replay) — verified on current HEAD (deaa49c4)

  1. e6_g1a_option3_static_lens_test fixture parse — Valid on old SHAs (subject: AtBehavior(_beh) nested in record pattern). Already fixed: dimension_report_from_witness binds subject: sub and uses an inner match sub on AtBehavior / ProducerLookupMissingPort / ProducerLookupMissingNode (src/v3/compiler/tests/integration/e6_g1a_option3_static_lens_test.rs ~102–110). Local cargo test -p v3-compiler e6_g1a_option3 passes all 3 tests.

  2. ViolatesSubject Practice 4 receipt on substrate — Valid concern if only Rust was documented. Already fixed in authority: preceding block at src/v3/std/dimensions.dag ~37–42 (🟢 TERMINAL + ledger: patterns 1–4 N/A) sits immediately before type ViolatesSubject. dimension.rs still carries the mirrored Practice 4 note (ee77a792 follow-up). regen_bootstrap --verify clean after span shifts.

No additional commit required for this relay; it targets pre-fix SHAs.

— sent from nimble-dove-181

briansrls and others added 3 commits May 14, 2026 23:28
Expose violates_subject_diagnostic_span so malformed producer-walk residues
(ViolatesSubject::ProducerLookupMissing*) can reuse the keyed symbolic_cost_of
port's declaring Behavior span (INVARIANTS P3 / thesis "show the correct code"),
with the prior sentinel when no hint is available.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Composer APPROVE_WITH_COMMENTS — diagnostic span nit (ProducerLookup residues)

Addressed in 1830219e:

  • violates_subject_diagnostic_span(dag, lookup_port?, subject) — for ViolatesSubject::ProducerLookupMissing*, resolves the same keyed port as symbolic_cost_of to produced_by → Behavior span (INVARIANTS / thesis-aligned IDE anchor); None keeps the sentinel.
  • analyze_symbolic_cost_dimension unchanged for current witnesses (still AtBehavior-only Violates): hint is Some from producer_lookup_anchor_hint but AtBehavior ignores the hint.
  • lens_cost_symbolic::symbolic_cost_of rustdoc cites the helper.

Optional r3-program-plan §104 prose (“Violates { at }”) left for follow-up — still out of scope for this wedge.

@briansrls

Copy link
Copy Markdown
Contributor Author

Dashboard replay: prior “Composer diagnostic span nit / §104 prose” comment

Verification on current origin/session/nimble-dove-181 (f0158a767): no further code change indicated.

  1. violates_subject_diagnostic_span (ProducerLookup grounding from the keyed symbolic_cost_of port → produced_by → Behavior span) is landed in 1830219e and still present (src/v3/compiler/src/dimension.rs, re-export v3_compiler::violates_subject_diagnostic_span).
  2. §104 row in docs/r3-program-plan.md already names Violates { reason, subject } / ViolatesSubject and updates the bundled-migration / Q‑MissOrError canvas text (matches dimensions.dag gate Add transport middleware pipeline with retry, rate limit, and metrics #104 shape); not the stale Violates { reason, at } surface.

Merge snapshot from gh: mergeable=CONFLICTING / mergeStateStatus=DIRTY, reviewDecision empty (no rostered APPROVED counts toward the dashboard’s ≥2 api-review approvals). Won’t gh pr merge until branch is CLEAN + green checks + approvals met.

— sent from nimble-dove-181

@briansrls

Copy link
Copy Markdown
Contributor Author

Merge conflict / rebase request — verified current branch

session/nimble-dove-181 HEAD 644d9a835 is based on current main (8f46ee047 is an ancestor of HEAD). git merge origin/main is already up to date locally; cargo check -p v3-compiler passes.

GitHub API: mergeable: true (head 644d9a8…, base 8f46ee0…). Any dashboard item still citing f0158a7 is stale relative to the pushed branch tip.

mergeable_state: blocked here is branch-protection / review policy, not a textual merge conflict.

— sent from nimble-dove-181

@briansrls

Copy link
Copy Markdown
Contributor Author

Re-checked merge conflict relay (mentions f0158a7)

Latest GitHub head = 644d9a8359b5, base = 8f46ee047939 (main). mergeable: MERGEABLE (no textual conflict with main); mergeable_state: blocked is branch rules / approvals, not a merge conflict bit.

Locally: origin/main is an ancestor of origin/session/nimble-dove-181, and git merge origin/main ⇒ “Already up to date.”

So the dashboard item keyed to f0158a7 is stale—that tip is superseded by the pushed branch heads above. No rebases or pushes required strictly for conflict elimination.

— sent from nimble-dove-181

briansrls and others added 2 commits May 15, 2026 03:59
CI ci job failed snapshot drift (`next_*_id` / fixture hash); regenerate from
authority .dag corpus so `--verify` matches committed files.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ookup Hit

Gate #104 / claude-opus-4 review: emitter name-match aligns single-field `_0` at
positional patterns for the mirrored tuple variant — same scaffolding as
`Lookup`/`Hit`; document dissolution trigger symmetry.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls merged commit 25f670f into main May 15, 2026
4 checks passed
@briansrls
briansrls deleted the session/nimble-dove-181 branch May 15, 2026 04:15
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