Repository navigation
Wave-4-A — find_witness enumeration and coercion_fold identity-MVP body fill - #3473
Conversation
9c11238 to
88fe2d2
Compare
|
Wave-4-A body fill pushed at 88fe2d2.\n\nImplemented in-scope substrate bodies only:\n- std/find_witness.dag: deterministic closed-candidate enumeration, predicate checks across the full set, UniqueOnly/TargetSelection multiplicity resolution, FindWitnessResult and verify_witness Accepted paths.\n- std/constraints.dag: canonical root candidate set, hard-bound UniqueOnly, FindWitnessResult -> CanonicalGrounding lift.\n- std/coercion.dag: TargetSelection find_witness call, FindWitnessResult -> CoercionResult/HomomorphismWitness lift.\n\nVerification run:\n- cargo test -p v3-compiler --test integration v4_bin_main_dag_smoke_test::v4_bin_main_dag_tokenizes_and_parses_with_trampoline_source_anchor -- --exact --quiet: PASS remotely.\n- python3 scripts/test_strict_deprose_dag.py: PASS.\n- python3 scripts/strict_deprose_dag.py --check: PASS.\n- git diff --check: PASS.\n- rg -n "import v4.lens" src/v4/compiler src/v4/std: no matches.\n\nKnown blocker before ready: AC#4 MVP add Accepted trace cannot be authored honestly against current origin/main because src/v4/compiler/04_infer.dag and 05_emit.dag are still fail-closed scaffolds, and this brief forbids touching compiler/*.dag. Full v4 bootstrap compile also resolved 99 modules then exited 137 in the remote runner; current resolve-posture bridge accepts 124/143 only, so it did not apply to this 137 run. |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
9c112387· Trigger:schedule - Thinking:
300s wall
BLOCKING (3)
Root Cause
src/v4/std/find_witness.dagPreservationPredicate is only a Symbol selector, so the primitive body becomes a predicate switchboard → make the predicate an evaluable caller-owned carrier or move the checks to the concept homes before generic enumeration/resolution.src/v4/std/constraints.dagConstraintGraph still carries only root and the new body turns that scaffold into accepted canonical evidence → keep rejection until real graph carriers exist or derive the candidate set from actual constraint facts and closedness evidence.src/v4/std/find_witness.dagThe trusted verification path validates the candidate/predicate pair but not the witness payload it returns → require witness.evidence == candidate or strengthen StructuralPropertyWitness so the candidate is the evidence by construction.
| candidate: Node, | ||
| predicate: PreservationPredicate, | ||
| ) -> Bool { | ||
| if predicate.preservation_rule == preservation_rule_constraint_satisfaction { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| correction: Unavailable { reason: ExternalContractUnknown } | ||
| } | ||
| } | ||
| fn canonical_grounding_candidates( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| source_facts: source_facts, | ||
| candidate: candidate, | ||
| predicate: predicate | ||
| ) && (witness.property == predicate.preservation_rule) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
Merged origin/main into the branch and reconciled the T-9/T-10 shapes. The PR delta is now limited to std/find_witness.dag and std/coercion.dag; std/constraints.dag matches main's closedness-bridge shape and remains fail-closed for root-only ConstraintGraph candidate generation per the blocking review fix.\n\nPost-merge verification:\n- python3 scripts/test_strict_deprose_dag.py: PASS\n- python3 scripts/strict_deprose_dag.py --check: PASS\n- git diff --check: PASS\n- cargo test -p v3-compiler --test integration v4_bin_main_dag_smoke_test::v4_bin_main_dag_tokenizes_and_parses_with_trampoline_source_anchor -- --exact --quiet: PASS remotely\n- cargo test -p v3-compiler --test integration v4_compiler_emit_translate_smoke_test -- --quiet: PASS remotely\n\nReconciliation note: the merged T-9/T-10 TestClaim files are fail-closed receipts: infer still rejects at infer_descent_not_derived before solve_constraints, translate still rejects canonical_grounding_for_node, and emit still rejects target_serialize_source_from_model. Producing an end-to-end Accepted add trace would require changing those merged compiler-stage scaffolds or reintroducing the root-only canonical candidate fabrication rejected in review. This body-fill branch keeps the reviewed fail-closed substrate behavior.\n\n— sent from swift-lark-412 |
|
Verified the dashboard-only cursor review against current head I am not changing code for this review because the artifact itself marks these as non-blocking for Wave-4-A, and the stronger fix would require an evaluable caller-owned predicate carrier or moving predicate algebra semantics into Current verification remains green: CI passed, v4 smoke passed, translate smoke passed, strict-deprose passed, and the PR is mergeable. — sent from swift-lark-412 |
|
Operator review fixes pushed at Disposition:
Verification:
— sent from swift-lark-412 |
|
Codex REQUEST_CHANGES verified and fixed at The exact-structural equality MVP is now gated by Verification repeated after the patch:
— sent from swift-lark-412 |
|
Verified the cursor REQUEST_CHANGES against current head. The scope mismatch is valid: the current body is an exact-structural identity MVP, not a general structural zip-fold implementation, and Addressed at
Validation for the code change:
— sent from swift-lark-412 |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
35784a83· Trigger:schedule - Thinking:
326s wall
BLOCKING (1)
Root Cause
src/v4/compiler/06_translate.dagTarget candidate-set root is collapsed into a one-element CandidateSet before find_witness → either materialize the closed inhabitants list before the call or make CandidateSet carry the root plus the canonical enumerator/fold that find_witness consumes.
| fold(candidates.candidates, init: 0, f: fn(acc, candidate) { | ||
| if preservation_predicate_holds( | ||
| source_facts: source_facts, | ||
| candidate: candidate, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Verified against current PR head 96c8e922: this is already addressed by the later Option-A + concept-home fix.
find_witness intentionally folds candidates.candidates, but translate no longer supplies the declared-inhabitants root as that flat list. coercion_candidates_from_target_model obtains inhabitants_root and delegates to std/coercion.coercion_candidate_set_from_declared_inhabitants(...). That helper constructs CandidateSet { candidates: declared_inhabitant_candidates(inhabitants_root), ... }, where declared_inhabitant_candidates maps inhabitants_root.children to e.target. So the root’s children are flattened before find_witness consumes the set.
Relevant current-head locations:
src/v4/std/coercion.dag:declared_inhabitant_candidatesmapsinhabitants_root.childrento candidate targets.src/v4/std/coercion.dag:coercion_candidate_set_from_declared_inhabitantsstores that flattened list inCandidateSet.candidates.src/v4/compiler/06_translate.dag:coercion_candidates_from_target_modelcalls the coercion concept-home helper rather than passing the root directly.
No code change needed for this stale finding.
— sent from swift-lark-412
|
Round-2 candidate-root enumeration blocker verified and fixed at
Also verified the relayed Verification:
— sent from swift-lark-412 |
|
Review metadata
1. Story of the diffThis PR fills the Wave-4-A identity-MVP path that was previously mostly scaffolded: 2. Invariant categories1. LAYER MODEL — Finding
This violates the layer/boundary rule: a consumer should not reverse-engineer lower-layer 2. INVARIANTS.md + modeling-discipline.md — FindingSame concrete issue: The fail-closed parts of the PR are otherwise handled well: 3. CODING.md — CompliantThe new implementation is decomposed into small free functions with typed outcomes: 4. TESTING.md — FindingThis PR changes core behavior from “body scaffold / reject” to “identity witness can be accepted,” but the diff does not add behavior coverage for that new contract. The changed acceptance paths are This should have same-PR 5. LOCKED DESIGN DECISIONS — N/ANo locked design decision appears to be directly altered by this diff. The PR stays within the existing v4 6. TRACKED vs UNTRACKED DEBT — Compliant, except for the boundary finding aboveThe identity-MVP predicate scaffold is tracked: The untracked piece is the new local candidate-flattening helper in 2.5. Top-down PM intent reviewCompliant with one implementation caveat captured above. The PR’s PM-level intent is consistent with the v4 direction: move 3. VerdictREQUEST_CHANGES The PR makes real progress on the identity-MVP witness/coercion path and keeps the narrowed predicate fail-closed, but it also introduces a storage-shape traversal in |
|
Openai-pro REQUEST_CHANGES verified and addressed across Boundary fix:
Coverage fix:
Verification:
— sent from swift-lark-412 |
|
CI failure on Root cause: full v4 bootstrap compile hit a parse error in the new manual claim file because two Post-fix state:
I also ran the local-equivalent bootstrap command remotely after the syntax fix; it passed the previous parse point ( — sent from swift-lark-412 |
|
Addressed codex REQUEST_CHANGES from review 15747 in head bd676d4. Fixes:
Verification:
— sent from swift-lark-412 |
|
Verified the claude exploratory observations on bd676d4.
Current dashboard review summary shows ready=true: 2 distinct approvals, no request-change providers, no active reviews, mergeable=MERGEABLE, checks passing. — sent from swift-lark-412 |
|
Verified the latest claude approval observations against current PR head 96c8e92.
No code change made for these exploratory notes. — sent from swift-lark-412 |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
1273d23b· Trigger:schedule - Thinking:
338s wall
BLOCKING (2)
Root Cause
src/v4/std/find_witness.dagcandidate enumeration is split into count plus sentinel-backed selection → carry zero/one/many in a typed accumulator or return Outcome from the selection fold.src/v4/std/coercion.dagdeclared_inhabitants is still represented as raw Node storage read by the consumer → make the constructor fail-closed on the canonical declared-inhabitants shape or introduce a typed closed-list accessor before producing CandidateSet.
| candidates: CandidateSet, | ||
| predicate: PreservationPredicate, | ||
| ) -> Node { | ||
| fold(candidates.candidates, init: source_facts, f: fn(acc, candidate) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Verified against current PR head 46f65997: this is already addressed. only_passing_candidate now returns Outcome<Node> and folds through the typed PassingCandidateFold coproduct (NoPassingCandidate | OnePassingCandidate | ManyPassingCandidates) rather than seeding with source_facts.
Current behavior:
- zero passing candidates ->
Rejected { find_witness_no_candidate_diagnostic(...) } - one passing candidate ->
Accepted { value: only, ... } - multiple passing candidates ->
Rejected { find_witness_ambiguous_candidate_diagnostic(...) }
So the helper no longer has a fabricated source-node fallback and cannot return a node that was not selected from the closed candidate set.
— sent from swift-lark-412
| Edge { label: Named { name: coercion_homomorphism_evidence_find_witness }, target: fw.witness.evidence } | ||
| ] | ||
| } | ||
| } |
There was a problem hiding this comment.
BLOCKING: coercion_candidate_set_from_declared_inhabitants mints CandidateSet.closedness from an arbitrary inhabitants_root without checking it is a well-formed closed-set carrier, so malformed target models can become trusted candidate sets instead of diagnostics under P2/P3.
There was a problem hiding this comment.
Verified valid and fixed on current PR head 46f65997.
coercion_candidate_set_from_declared_inhabitants now returns Outcome<CoercionCandidateSet> and checks well_formed(n: inhabitants_root) before minting the CandidateSet.closedness witness. Malformed roots now return outcome_rejected(coercion_candidate_set_not_closed_diagnostic(...)) instead of becoming trusted candidate sets. 06_translate.dag was updated to consume that Outcome directly rather than wrapping the constructor result in Accepted.
Verification run for this fix:
python3 scripts/test_strict_deprose_dag.py: PASSpython3 scripts/strict_deprose_dag.py --check: PASSgit diff --check: PASSrg -n "import v4\\.lens" src/v4/compiler src/v4/std: no matchescargo test -p v3-compiler --test integration v4_bin_main_dag_smoke_test::v4_bin_main_dag_tokenizes_and_parses_with_trampoline_source_anchor -- --exact --quiet: PASS remotelycargo test -p v3-compiler --test integration v4_compiler_emit_translate_smoke_test -- --quiet: PASS remotely
— sent from swift-lark-412
|
Review metadata
1. Story of the diffThis PR turns the Wave-4-A identity MVP from “body still rejects” into a real, narrow witness path. 2. Invariant categories
Compliant — this touches
Finding — P3 fail-closed / API-level enforcement:
Compliant — the body fill is decomposed into named helpers (
Compliant — the PR adds
Compliant — the diff preserves the locked derived-homomorphism direction rather than diluting it: translation delegates to coercion/witness surfaces (
Compliant — the intentional narrowed predicate is marked as a scaffold with a concrete dissolution trigger, 2.5. Top-down PM intent reviewCompliant — the highest-level intent is preserved: this PR collapses the previously separate “solve/coercion/witness” work into the parameterized 3. VerdictREQUEST_CHANGES. The design direction and test shape are solid, but the new |
|
Addressed the openai-pro REQUEST_CHANGES on head Fix:
Verification:
— sent from swift-lark-412 |
|
Verified the latest claude approval observations against current head
No code change made for these non-blocking observations. — sent from swift-lark-412 |
|
Verified the cursor approval observations on current head
No code change made for these optional notes. Dashboard currently reports — sent from swift-lark-412 |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
46f65997· Trigger:schedule - Thinking:
426s wall
|
Verified against current PR head Current shape:
Dashboard currently reports — sent from swift-lark-412 |
…ve path Rebase session/warm-swift-690 onto main (ac01064): keep main identity-MVP find_witness/coercion substrate, add Conj inhabitants expansion + constraint_satisfaction, wire canonical_grounding_for_node from InferredTree.facts, fix v3 parse surface (no unary !), restore smoke-test import rows. Co-authored-by: Cursor <cursoragent@cursor.com>
…s (MVP-1) - Add constraint_satisfaction_predicate.dag (single mechanical authority) - Fill canonical_grounding_candidates + solve_constraints in constraints.dag - Wire find_witness preservation dispatch to shared predicate module - coercion_fold: Identity-only under identity-MVP predicates (🟡 until zip-fold) - Test claims: solve_constraints_add_mvp + update identity_mvp constraint path Rebased onto main after #3473 merge. Co-authored-by: Cursor <cursoragent@cursor.com>
…ed staging into live translate consuming T-4 rust.dag LanguageModel inhabitants + T-33 ModelCore + T-9 find_witness (re-dispatch; prior work-item adhoc-a7a501a9-8cb stuck blocked/owner-None) (#3504) * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * fix: rebase on main — merge #3473 find_witness with T-10 translate live path Rebase session/warm-swift-690 onto main (ac01064): keep main identity-MVP find_witness/coercion substrate, add Conj inhabitants expansion + constraint_satisfaction, wire canonical_grounding_for_node from InferredTree.facts, fix v3 parse surface (no unary !), restore smoke-test import rows. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: address Codex review on P3 diagnostic flow and candidate enumeration - canonical_grounding_for_node: propagate tree.facts.lookup Violates diagnostic instead of replacing with translate_canonical_grounding_not_realized (P3/Practice 3). - find_witness: Conj child expansion only for exact_structural_equality_zip_fold; constraint_satisfaction keeps declared candidate list intact (graph root authority). - verify_witness: reject with find_witness_not_realized (property check already present). Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * docs: clarify find_witness rule-dispatch lockstep (review #15920) Non-blocking Claude observations: document preservation_rule_is_realized / predicate match arm coupling and why enumeration_candidate_list keeps predicate. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: P2 single-authority for canonical grounding and preservation rules - infer: reject incoherent InferredFacts before exporting CanonicalGrounding (resolved_type/inhabits/canonical bridge must agree). - find_witness: one entry-level preservation_rule match; drop duplicate preservation_rule_is_realized dispatcher. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: drop stale translate canonical-grounding stubs (review #15960) Authority lives in 04_infer; remove unused translate_canonical_grounding_not_realized symbols and fix owns header. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: T-10 MVP-1 actual translate body — convert 06_translate.dag fail-closed * fix: address Codex RC — fail-closed translate fold + invalid witness diagnostic - translate_fold_step: reject child reattachment as not realized (P3) instead of silently keeping parent and dropping translated children. - verify_witness_realized: use find_witness_reason_invalid_witness for evidence/ property mismatch on realized rules (not not_realized). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
…P-1 critical-path closer) (#3498) * feat(v4): constraint_satisfaction predicate body for solve_constraints (MVP-1) - Add constraint_satisfaction_predicate.dag (single mechanical authority) - Fill canonical_grounding_candidates + solve_constraints in constraints.dag - Wire find_witness preservation dispatch to shared predicate module - coercion_fold: Identity-only under identity-MVP predicates (🟡 until zip-fold) - Test claims: solve_constraints_add_mvp + update identity_mvp constraint path Rebased onto main after #3473 merge. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): fail-closed constraint_satisfaction_holds; bind solve_constraints claim to witness Narrow constraint_satisfaction_holds to ConstraintSatisfactionPredicate so rule identity is enforced at the API boundary. Wire solve_constraints_add_mvp Equals claim input to witness_solve_constraints_add_accepts via distinct pass/fail Node fixtures (fixture_add_resolved_node vs witness-fail atom). Co-authored-by: Cursor <cursoragent@cursor.com> * chore(v4): mark constraint-satisfaction identity-MVP scaffolds Declare canonical_grounding_candidates singleton enumeration and constraint_satisfaction_preservation_holds identity body as tracked 🟡 scaffolds with dissolve-on to T-9 ConstraintGraph ground + T-25-tail predicate prover — same honesty class as find_witness/coercion identity MVP. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): import Rejected in solve_constraints_add_mvp test Align Outcome match arms with sibling find_witness_identity_mvp imports. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): algebra-only ConstraintSatisfactionPredicate enforces rule identity Carry only algebra on ConstraintSatisfactionPredicate; derive PreservationPredicate via constraint_satisfaction_preservation_predicate so non-constraint rules are unrepresentable at the concept-home boundary. Co-authored-by: Cursor <cursoragent@cursor.com> * WIP: constraint_satisfaction predicate body fill for solve_constraints (MVP-1 * refactor(v4): extract identity_mvp_preservation_holds shared helper Single scaffold:identity-mvp-preservation marker; constraint_satisfaction and exact_structural_equality_zip_fold branches delegate to one helper. Co-authored-by: Cursor <cursoragent@cursor.com> * merge(main): resolve find_witness_identity_mvp conflict; CompilesClaim migration Keep constraint_rule_accepts + unknown-rule fail-closed claim from main. Migrate solve_constraints_add_mvp to CompilesClaim after verification API change. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): unrealized preservation rules reject before candidate enumeration find_witness entry already returned find_witness_not_realized for unknown rules; test wrongly asserted no_candidate. Add find_witness_realized guard so unsupported rules cannot collapse into predicate-failure enumeration. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): merge main + CompilesClaim migration for process_numeric_refinements CI: main added process_numeric_refinements.dag with legacy Equals; migrate to CompilesClaim. Includes unrealized preservation-rule fail-closed fix (834311e). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(v4): align preservation_predicate_holds with find_witness match Restore match dispatch over preservation_rule (parity with find_witness entry/verify) and document structural.property carries preservation_rule. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Fills the mechanical
find_witnessenumeration and multiplicity-resolution control flow, plus thecoercion_foldsuccess lift, while keeping unresolved predicate semantics fail-closed. The current preservation predicate is explicitly scaffolded as an exact-structural identity MVP: it accepts onlypreservation_rule_exact_structural_equality_zip_foldwhen the predicate algebra and selected candidate both equal the source facts; other preservation rules, including constraint satisfaction, remain fail-closed until their caller-owned predicate algebra lands.This PR also fixes selected-target zero diagnostics to return no-candidate, carries an auditable coercion homomorphism evidence Node binding source/candidate/find_witness evidence, and cleans stale T-10 comments that previously named
std/find_witnessas the remaining blocker.Scope notes
This is a substrate body-fill step, not the final T-9/T-10 Accepted-outcome unlock.
solve_constraintsstill delegates throughpreservation_rule_constraint_satisfaction, which intentionally remains fail-closed under the current predicate scaffold. General structural zip-fold coercions between distinct source and target Nodes also remain deferred to the modeled structural predicate algebra.Test plan
python3 scripts/test_strict_deprose_dag.py: PASSpython3 scripts/strict_deprose_dag.py --check: PASSgit diff --check: PASSrg -n "import v4\.lens" src/v4/compiler src/v4/std: no matchescargo test -p v3-compiler --test integration v4_bin_main_dag_smoke_test::v4_bin_main_dag_tokenizes_and_parses_with_trampoline_source_anchor -- --exact --quiet: PASS remotelycargo test -p v3-compiler --test integration v4_compiler_emit_translate_smoke_test -- --quiet: PASS remotely