Skip to content

feat(v4): dissolve TargetAtomRealizationLookup + TargetAtomRealizationCatalogLookup onto PassingCandidateFold - #4648

Merged
briansrls merged 6 commits into
mainfrom
session/wise-raven-635
Jun 11, 2026
Merged

briansrls merged 6 commits into
mainfrom
session/wise-raven-635

Conversation

@briansrls

@briansrls briansrls commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Delete TargetAtomRealizationLookup (3-state bespoke fold) and TargetAtomRealizationCatalogLookup (4-state bespoke fold) from std/target_model.dag
  • Replace both with PassingCandidateFold from std/find_witness.dag (MODELING M9 DFS, INVARIANTS P1 no-hand-rolled-derived-ops)
  • Typed-list path uses a two-pass approach: first pass counts via PassingCandidateFold, second pass extracts TargetAtomRealization via Optional fold (since PassingCandidateFold.OnePassingCandidate carries Node, not typed rows)
  • Node-path carries row_node: Node as the candidate and re-decodes on OnePassingCandidate acceptance; Rejected decode rows are skipped (semantically: well-formed catalogs always succeed)
  • Add test/claim/manual/target_model_atom_lookup_dissolution.dag with four E-10 execution receipts: ambiguity fold state, known-carrier acceptance, unknown-carrier miss, non-Conj decode-invalid
  • The third bespoke fold (TargetOperatorRealizationLookup) exists only on session/lively-badger-242 (T6 branch); a follow-up has been sent to the T6 manager to dissolve it there

Test plan

  • cargo test -p v3-compiler — 470 passed, 9 pre-existing failures (bootstrap helper missing, unrelated to this change)
  • Existing sg1b_signature_realization_failclosed tests pass (non-Conj outer guard preserved)
  • Existing grounding_typescript sg_claims tests pass (typed-list acceptance path preserved)
  • New target_model_atom_lookup_dissolution.dag claims added: ambiguity, acceptance, miss, non-Conj

🤖 Generated with Claude Code

Brian Searls and others added 3 commits June 11, 2026 00:33
…nCatalogLookup onto PassingCandidateFold

Replace the two bespoke unique-row fold types in std/target_model.dag with the
std PassingCandidateFold primitive from std/find_witness.dag (MODELING M9 / INVARIANTS P1).

- Delete TargetAtomRealizationLookup (3-state fold: Missing|Unique|Ambiguous)
- Delete TargetAtomRealizationCatalogLookup (4-state fold: Missing|Unique|Ambiguous|Invalid)
- Rewrite target_atom_realization_lookup_step to accumulate PassingCandidateFold
- Rewrite target_atom_realization_lookup_in_catalog: first pass counts via PassingCandidateFold,
  second pass extracts typed row via Optional fold (typed-list path can't carry TargetAtomRealization)
- Rewrite target_atom_realization_catalog_lookup_step: Rejected decode rows are now skipped (acc)
  instead of transitioning to Invalid; well-formed catalogs are unaffected
- Rewrite target_atom_realization_lookup_in_catalog_node: OnePassingCandidate candidate carries
  the row_node for re-decode on acceptance; the non-Conj outer guard is unchanged
- Add E-10 execution receipts in test/claim/manual/target_model_atom_lookup_dissolution.dag:
  ambiguity fold state, known-carrier acceptance, unknown-carrier miss, non-Conj decode-invalid

The third bespoke fold (TargetOperatorRealizationLookup) lives only on session/lively-badger-242
(T6 branch); a follow-up message to the T6 manager requests the same dissolution there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls briansrls changed the title Dissolve (b) [M-C precondition]: replace the 3 bespoke unique-row folds in 06_value_expression with ONE std find_witness. Find the 3 hand-written unique-row fold queries (DFS std/ first per MODELING M9 — attach to existing find_witness/witness concept, do NOT define a new type), prove the std find_w feat(v4): dissolve TargetAtomRealizationLookup + TargetAtomRealizationCatalogLookup onto PassingCandidateFold Jun 11, 2026
@briansrls
briansrls marked this pull request as ready for review June 11, 2026 00:45
Brian Searls and others added 3 commits June 11, 2026 00:56
…open witness

Two changes, both on PR #4648 (Dissolve(b) PassingCandidateFold):

1. Type-inference fix (ci_floor_emit): the v2 engine cannot resolve field
   access on a closure element whose type is constrained only through a
   polymorphic accumulator (optional_absent()). Extract the Optional fold
   into two named helpers:
   - target_atom_realization_lookup_extract_row_step (explicit row type)
   - target_atom_realization_lookup_extract_row (calls the step)
   This eliminates the nested fn(acc, row) binding that confused inference.

2. Fail-open witness (owning-manager review finding): the dissolution
   changed target_atom_realization_catalog_lookup_step from poisoning the
   whole lookup on any Rejected decode (fail-closed) to skipping the row
   (fail-open). Option A: fail-open is intentional — a malformed entry for
   one carrier should not block a valid lookup for another. Witnessed by
   atom_catalog_with_malformed_row_skips_accepts_valid (Conj catalog with
   [probe-atom malformed row, valid bool row] → Accepted(bool row)) with
   claim_atom_catalog_malformed_row_skips as a 5th E-10 receipt.

5 receipts total: ambiguity / accepts / miss / non-Conj decode-invalid /
fail-open skip (new).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls
briansrls merged commit 75c0a87 into main Jun 11, 2026
11 checks passed
@briansrls
briansrls deleted the session/wise-raven-635 branch June 11, 2026 01:35
briansrls pushed a commit that referenced this pull request Jun 11, 2026
briansrls pushed a commit that referenced this pull request Jun 11, 2026
…ateFold

Route target_operator_realization_catalog_lookup through the same
PassingCandidateFold step pattern as #4648 atom catalog dissolution;
drop hand-rolled match_count/first_matching_row. Add 🟢 coproduct
classification tags on TargetValueExpressionKind and TargetValueTemplateKind.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls pushed a commit that referenced this pull request Jun 11, 2026
Align operator catalog lookup with #4648 atom pattern: catalog
wire_schema_valid checks structure only; lookup_step skips
Rejected row decodes. Add target_model_operator_lookup_dissolution
claim with malformed-row fail-open witness.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jun 11, 2026
…etting consumer #4623) (#4627)

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: bump glob_discovered_smoke_marker_count for comprep bodied emit claim

The new unified_claim_comprep_ts_bodied_emit_add_fn distributed marker
raises the glob-discovery projection from 80 to 81 rows; v4_lens_gate
substrate-equivalence check was failing on the mismatch.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: merge main and bump glob marker count to 82 for CI substrate gate

Main gained unified_claim_comprep_eval_by_execution (#4624); combined with
this branch's bodied-emit marker the glob-discovery projection is 82 rows.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: bodied-arrow translate E-9 fallback and minus-catalog comprep lex

Route body-scope atoms structurally when coercion/grounding cannot apply,
and give the §4.5 minus-catalog perturb fixture its own wave1+minus lex so
discriminating emit claims stay faithful without polluting extdeps.

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

* fix: narrow comprep emit claim to E-10 emit-source consumer

Honest scope: witnesses assert emit source text and discriminating mutates,
not Node execution of emitted TS. Runtime add(2,3)=5 stays in
comprep_eval_by_execution; Node emit exercise awaits emit-host wiring.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: E-9 body-scope atom carrier in translate_mvp1 coercion fallback

Branch on algebra_ref_is_grounded so operator/param refs use explicit
translate_type_fold_init instead of target type realization; operand
bindings reader uses fold+list_snoc_item (order-preserving, type-correct).

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: wire CanonicalOperation algebra_field witness end-to-end

Encode OpAdd.algebra_field on operator-realization and primitive-apply
operation wires; decode and compare full operation in catalog lookup and
expr projection. Drop dead bodied-arrow grammar match; tag E-9 mvp1 carry.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: fail-closed value-expr wire decode and comprep emit diagnostics

Use bind_outcome in comprep_ts_emit_from_producer_tree so producer and
emit diagnostics merge on success and reject with pending on failure.
Add primitive-apply wire schema validation that rejects positional edges,
unknown named fields, and duplicate operation slots before operand decode.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: land operator catalog lookup in value_expression (unblocks compile)

Adding TargetOperatorRealizationCatalogLookup to target_model.dag breaks
TargetModel field resolution across the v4 closure; implement fail-closed
catalog wire validation + lookup in value_expression instead, consuming
target_model row decoders and target_operator_realization_row_edge.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: Atom-rooted wire decoders for operator shape and binding refs

find_named_child requires Conj roots; operator-shape and binding-ref wires
are Atom-discriminant nodes. Decode via direct child fold so catalog lookup
and value-expr token emission succeed on the producer path.

Also fail-closed when multiple bodied-scaffold translation rows match
(grammar_relation_row_with_bodied_scaffold).

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

* fix: tag E-9 structural-carry fallback when grounding witness is ungrounded

Align the algebra_ref_is_grounded=false branch in translate_mvp1_coerce_from_grounding_or_evidence with the sibling rejection-path 🟡 disposition so both fail-open translate_type_fold_init arms share explicit dissolution metadata.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix(ci): use release profile for parity lib-test compile guard

The ci_floor_parity guard spawned a debug-profile `cargo test -p
v2-compiler --lib --no-run`, cold-compiling serde under sccache on shared
runners and flaking with EAGAIN. Match the release shared closure instead.

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

* fix: resolve glob_discovery merge conflict markers (pin → 90)

Prior merge commit left conflict markers in glob_discovery.dag. Pin
updated via v4-glob-discovery-project.sh projection (main #4639 + four
comprep bodied-emit claims).

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix: land T6 value-expression substrate fold for emit tokens

Move operator-catalog lookup and shape-driven token emission into target_model.dag
so 06_value_expression delegates through the substrate fold; avoids DSL keyword
pitfalls (operation/realization/Node coproduct arms) that broke type-checking.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix(#4627): route wave1 slot validation through declared inhabitants; carve translate

Dissolve P2 extdep TS symbol leaks in 06_value_expression by validating wave-1
add signature slots via target_model declared-inhabitants catalog helpers.
Revert 06_translate bodied-arrow routing to main (moves to B3 #4641).
Replace emit-source COMPREP with fold-level witnesses on the (a)-fold delegate.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix(#4627): dedupe wave-1 signature authority; drop bodied-scaffold decode dead code

Address api-review REQUEST_CHANGES: route value_expression wave-1 gate through
target_wave1_add_signature_matches (single substrate authority; IR kernel
^dag_binding_type_int pre-coercion lives in target_model only). Remove
translate-carved bodied-scaffold decode/compose APIs with zero call sites until
B3 #4641. Land arrow_domain_named_param_bindings accessor in node_query for the
unified param-binding convergence (consumer wiring follows with vivid).

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix(#4627): dissolve :215 via arrow_domain_named_param_bindings membership

Merge-gate (a): replace fixture binding-name equality in
value_expr_arrow_body_scope_binding_valid with general-arity membership
against node_query arrow_domain_named_param_bindings. Reshape
body_producer MVP arrow positional-0 domain to Conj Named binding_id
edges (constructor = accessor source of truth). Expand
surface_op_atom_to_canonical 🟡 to Practice-4 shape.

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

* WIP: RUNTIME commits on #4627 (session/lively-badger-242 @ d976bb4): body_pr

* fix(#4627): Practice-10 disposition on predicate consumers; Outcome bind path

Move 🟡 to live-path consumers (value_expr_arrow_has_transform_body,
value_expr_wave1_add_signature_matches_for_target). Tag target_model wave-1
signature Bool family. Refactor body-scope binding through bind_outcome on
arrow_domain_named_param_bindings. Delete unused positional_child_atom helpers.

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

* fix(#4627): dissolve eval_wave1_argument_binding_key via arrow_domain_named_param_bindings

Dissolve the 🟡-gated eval_wave1_argument_binding_key hardcoded index→param_name
table (^dag_binding_param_x/y): eval_bind_wave1_argument now takes param_names:
List<Symbol> and resolves binding keys via list_nth, sourced from
arrow_domain_named_param_bindings on the callee Arrow's domain Conj.

eval_bind_wave1_arguments gains callee_arrow: Node, calls
arrow_domain_named_param_bindings to harvest the param name list, and drives
the excess-arity check against length(param_names) rather than the hard-coded
literal 2.

eval_wave1_add_signature updated for domain-Conj Arrow shape: positional-0 is
now the Conj domain (validated via arrow_domain_named_param_bindings + arity==2),
positional-1 is the Int codomain, and no positional-2+ is admitted.

Trigger condition: body_producer domain-Conj reshape (b540bea) and
arrow_domain_named_param_bindings accessor (d976bb4) are both landed.
Bind: node://adhoc-9a72d4fb-8c2 COMPREP-WAVE1-EVAL dissolution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* fix(#4627): dissolve indexed-list walker via list_at_optional

Replace hand-rolled FreeMonoid recursion in transform_positional_operand_binding
with node_positional_child_targets + list_at_optional substrate lookup (Practice 10).

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

* fix(target_model): dissolve operator catalog lookup via PassingCandidateFold

Route target_operator_realization_catalog_lookup through the same
PassingCandidateFold step pattern as #4648 atom catalog dissolution;
drop hand-rolled match_count/first_matching_row. Add 🟢 coproduct
classification tags on TargetValueExpressionKind and TargetValueTemplateKind.

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

* fix(target_model): witness operator-catalog fail-open skip semantics

Align operator catalog lookup with #4648 atom pattern: catalog
wire_schema_valid checks structure only; lookup_step skips
Rejected row decodes. Add target_model_operator_lookup_dissolution
claim with malformed-row fail-open witness.

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

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

* WIP: T6 SKELETON-IMPLEMENTER: real Arrow.body -> translated TS -> Node -> add

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Sonnet 4.6 <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