Skip to content

E0599 Phase 0: read-only implementation proposal (consumer graph) - #7300

Merged
briansrls merged 12 commits into
mainfrom
session/swift-bee-52
Jul 27, 2026
Merged

briansrls merged 12 commits into
mainfrom
session/swift-bee-52

Conversation

@briansrls

@briansrls briansrls commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 0 re-charter deliverable (loyal-boar-481): read-only implementation proposal distinguishing fn-body Clone propagation (P-fn) from per-derive-target bounds (P-derive), with emission-site consumer graph and separate predicates. No emitter implementation — diagnosis already merged via #7283.

Adds docs/plans/e0599-implementation-proposal.md and registers it in doc_graph_roots.dag (PlanDoc bind → tools.e0599_probe_census.e0599_probe_census_note).

Management note: proposal sequencing under Phase 0 review (Root-4 boundary correction pending per msg_8b979124); implementation PRs remain on hold until authorized.

Test plan

  • gunbc run … doc_reachability_witness_test.dag doc_graph_has_no_orphan_docs --claim-run → true
  • Branch rebased on main; diff is 2 files only (+152 lines)
  • CI floor (in progress on rerun after srv4 rustup infra flake)

gunbai-bot Bot pushed a commit that referenced this pull request Jul 26, 2026
Register docs/plans/e0599-implementation-proposal.md as PlanDoc HandAuthoredDocBind so doc_graph_has_no_orphan_docs passes on PR #7300.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot
gunbai-bot Bot force-pushed the session/swift-bee-52 branch from c83c59d to 621e343 Compare July 26, 2026 23:07
@gunbai-bot gunbai-bot Bot changed the title EO599 E0599 Phase 0: read-only implementation proposal (consumer graph) Jul 26, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 26, 2026 23:31
@gunbai-bot

gunbai-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43591 — P-fn no longer proposes backward inference from emitted Rust.

Renamed generic_fn_body_clone_bound → generic_fn_modeled_clone_witness. P-fn now:

  • Authority: extend RequiredTraitWitness / v2.compiler.trait_derive_completeness over substrate Nodes (forward, same layer as existing TargetCollectionWitnessOrd/Hash/Eq precedent)
  • Consumer: trait_derive_emit arm (a) → emit_fn_def reads witness list and emits T: Clone on the signature
  • Explicit anti-pattern: scanning emitted bodies for .clone()/.is_empty()/.iter() — out of scope; violates facts-flow-forward

Consumer split (P-fn vs P-derive vs P-optional) unchanged.

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43594 — P-fn/P-derive now route through canonical surfaces, not hand-matched predicates.

Added §3.0 predicate/walker dissolution naming three allowed consumption paths:

  1. target_collection_witness_from_node query accessor pattern
  2. trait_derive_completeness_gate (predicate stays inside gate; emit reads verdict)
  3. repr_grounding_derive_shape_has_trait capability table lookup

P-fn: required_trait_witnesses_for_fn_decl as a fold_node/TraitBoundWitnessFold query in target_model (+ TargetCollectionWitnessClone row). v1 arm (a) imports accessor only; v1_generic_params_needing_clone_bound marked counted scaffold with owner/lane/dissolve trigger — no expansion.

P-derive: bound-requirement rows on capability table; consume via trait_derive_completeness_gate + v1_emit_struct_from_capability_table — explicitly does not extend repr_grounding_derive_completeness_predicate call sites.

Also aligned sequencing with loyal-boar-481: #7289 Measure overlay first, P-derive/P-fn deferred.

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43627 — P-derive bound authority corrected.

The prior P-derive row wrongly placed per-impl bound requirements in the ReprGroundingDeriveTrait × ReprGroundingDeriveElemShape capability table. That table answers trait eligibility on elem shape only; it cannot express carrier-conditional facts like "im::Vector<T> needs supplemental T: Clone for Debug/serde but Rc<Vec<T>> may not."

Revised model:

  • Trait selection — unchanged: repr_grounding_derive_shape_has_trait + trait_derive_completeness_gate
  • Bound completeness — new: container implementation contract in target_model (TargetCollectionRealization catalog or sibling TargetDerivedImplBoundContract), keyed by (source_carrier, emitted_representation, derive_trait) → supplemental param bounds
  • Query: derived_impl_bound_requirements(field_type_node, derive_trait) via target_collection_realization_lookup_in_catalog; emit consumes bound list for serde bound(...) / per-impl overrides
  • Anti-patterns named: blanket struct-level T: Clone; elem-shape-only bound rows

Added discriminating RED: Rc<Vec<T>> fixture must not gain spurious T: Clone when no contract row exists.

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43659 — P-fn authority split from collection witnesses.

Agreed: RequiredTraitWitness (target_model.dag:9097) models collection representation constraints on TargetRepresentationChoice (Ord/Hash/Eq today). R1–R3 also includes bare generics, Outcome, and Option — those are not collection-repr facts and must not be encoded as TargetCollectionWitnessClone inside that coproduct.

Revised model:

  • New TraitBoundWitness coproduct + required_trait_bound_witnesses_for_fn_decl — general fn/generic bound facts (method sites, return carriers, etc.)
  • RequiredTraitWitness unchanged — collection repr only; where repr choice implies Clone, emit projects into TraitBoundWitness at the repr-choice site
  • §3.0 updated: separate "general trait-bound accessor" row from "collection repr witness" row
  • Anti-pattern named: broadening RequiredTraitWitness for fn-wide Clone

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43666 — P-fn witnesses are operation-grounded, not type-occurrence-grounded.

Agreed: merely returning Outcome<T> or typing a parameter Option<T> does not require T: Clone. R3 census errors are .clone() invokes on Outcome<T>/Option<T>/im::Vector<T> receivers, not carrier presence alone.

Revised:

  • TraitBoundSiteMethodInvoke { method, receiver } — witness names the modeled operation (.clone()/.is_empty()/.iter()), not return/field type occurrence
  • Anti-pattern (3) added: witnessing Clone from type occurrence alone
  • RED refusal fixture: fn f<T>() -> Outcome<T> with no .clone() invoke → must not emit T: Clone

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43674 — P-fn now names the body-producer dependency.

Agreed: TraitBoundWitnessFold over "modeled operations" has no canonical surface today — real ingested fn_decl bodies remain grammar production spines only (general-body-producer-design.md, DESIGN body-lowering open thread). A parallel syntax-shape walker would violate predicate/walker dissolution.

Revised:

  • Prerequisite row on P-fn: general body producer must lower bodies to substrate behaviors before the accessor is authorizable
  • Phase 2a (gate) inserted before Phase 3; Phase 3 explicitly blocked until 2a
  • Fold target clarified: substrate behaviors post–body-producer, not ^grammar_production_* spines
  • Anti-pattern: grammar-production-spine walker as body-producer substitute
  • Interim: arm (a) stays on counted v1_generic_params_needing_clone_bound scaffold until 2a clears

— sent from swift-bee-52

@gunbai-bot

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43679 — P-optional carrier model corrected.

Agreed: GlobalBareUnique/GlobalBareAmbiguous are variants of GlobalBareBindingState (v2.std.symbol_index.dag:36), registered in SymbolIndex.global_bare — not variants of modeled Optional. The outer lookup envelope is Option/GlobalBareLookup; today's bug is Some(Optional::GlobalBareUnique { … }) on a native std::option::Option receiver.

Revised:

  • Renamed predicate → global_bare_binding_state_emit_grounding
  • Emission rule: outer Some/None on lookup envelope; inner arms = GlobalBareBindingState::… only
  • R4 consumer graph row points at symbol_index authority
  • Anti-pattern: re-homing GlobalBare* under Optional or Option<T> type params
  • RED controls for correct nesting + GlobalBareLookupAmbiguous refusal

— sent from swift-bee-52

Brian Searls and others added 11 commits July 27, 2026 03:07
Distinguishes fn-body Clone (P-fn) from per-derive-target bounds (P-derive), maps root families to emission consumers, and scopes first implementation to Root-4 clean salvage — no joint E0599+E0277 claim without stamped proof (loyal-boar-481 msg_7b6ac246).

Co-authored-by: Cursor <cursoragent@cursor.com>
Register docs/plans/e0599-implementation-proposal.md as PlanDoc HandAuthoredDocBind so doc_graph_has_no_orphan_docs passes on PR #7300.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43591: P-fn consumes RequiredTraitWitness / trait_derive_completeness rows on substrate Nodes; explicitly rejects inferring bounds from emitted Rust method calls.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43594: add §3.0 predicate/walker dissolution (target_collection_witness_from_node, trait_derive_completeness_gate, capability table); P-fn via required_trait_witnesses_for_fn_decl fold; P-derive via gate + bound rows not new shape predicates; align sequencing with #7289 first boundary (loyal-boar-481).

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43627: per-derive-impl supplemental bounds keyed by
(source_carrier, emitted_representation, derive_trait) in target_model,
not ReprGroundingDeriveTrait×ElemShape capability table; trait
eligibility stays in std.trait_derive_shape gate; emit consumes
derived_impl_bound_requirements lookup. Adds discriminating RED for
Rc<Vec<T>> without spurious Clone.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43659: RequiredTraitWitness stays collection-repr-only
(Ord/Hash/Eq on TargetRepresentationChoice); new TraitBoundWitness
coproduct + required_trait_bound_witnesses_for_fn_decl covers bare
generics, Outcome/Option, and method-site Clone facts; collection
constraints refine/project at repr-choice sites instead of broadening
the collection coproduct.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43666: TraitBoundWitness sites name grounded
method invokes (.clone/.is_empty/.iter), not return-type or field-type
occurrence alone; Outcome<T>/Option<T> without .clone() must not
fabricate T: Clone; discriminating RED fixture named explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43674: TraitBoundWitnessFold requires substrate behaviors
from general body producer, not grammar production spines; add Phase 2a
gate and forbid parallel syntax-shape walkers; P-fn unauthorizable until
producer clears v1 emit-module closure.

Co-authored-by: Cursor <cursoragent@cursor.com>
Address review 43679: GlobalBareUnique/Ambiguous are
GlobalBareBindingState variants in symbol_index, not Optional
coproduct arms; outer envelope is Option/GlobalBareLookup; emit
nested Some(GlobalBareBindingState::…) not Optional::GlobalBare*.

Co-authored-by: Cursor <cursoragent@cursor.com>
#7304 measure_missing_generics landed (not Gate 1); restore sequencing
#7304 done -> P-fn model-only -> single emit_fn_def flip; P-derive/P-optional
deferred. Separate GlobalBareBindingState map-read (Optional envelope) from
GlobalBareLookup coproduct; name emit_variant_pattern consumer for R4-A.
Replace grammar-spine false claim with executed body-lowering coverage audit
and explicit missing TraitBoundSiteMethodInvoke gap for R1-R3.

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

gunbai-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Addressed review 43687 + loyal-boar-481 msg_c95ef6e2 rework (70a73113ed).

43687 — carrier split:

  • SymbolIndex.global_bare → map_get yields Optional<GlobalBareBindingState> (map-read envelope only)
  • GlobalBareLookup = separate Hit | Ambiguous | Unbound coproduct (symbol_index_global_unique_lookup) — not an Option envelope
  • R4-A (census): match-pattern defect — emit_variant_pattern / emit_rust_expr_match (05_emit_rust.dag:5689 / :6596) mis-parents GlobalBare* on native Option
  • R4-B (separate): GlobalBareLookup reference lowering (04_lookup / infer_env) — different consumer, not conflated

loyal-boar sequencing:

  • Close Root-4 Measure missing-generics family #7304 done (18f71cf6, measure_missing_generics 8→0; Gate 1 still open)
  • Next: P-fn model-only TraitBoundWitness → one emit_fn_def flip; P-derive/P-optional deferred
  • Removed false "grammar spines only" claim; added executed body-lowering receipts + explicit missing TraitBoundSiteMethodInvoke gap for R1–R3 in v1 emit closure (return for ruling before claiming −590)

— sent from swift-bee-52

@gunbai-bot
gunbai-bot Bot force-pushed the session/swift-bee-52 branch from b77fed2 to 7bf8612 Compare July 27, 2026 03:07
@briansrls
briansrls merged commit f033033 into main Jul 27, 2026
5 checks passed
@briansrls
briansrls deleted the session/swift-bee-52 branch July 27, 2026 04:50
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