Skip to content

Model v2 indexed references with exact occurrence bindings - #11264

Closed
gunbai-bot[bot] wants to merge 5 commits into
mainfrom
session/crisp-carp-634
Closed

gunbai-bot[bot] wants to merge 5 commits into
mainfrom
session/crisp-carp-634

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Qualified lookup can find a declaration and still return an accepted atom named resolve_reason_unbound_symbol when the declaration is an Arrow or Conj. This draft holds the authored regression witness and the model review for replacing that fabricated identity with the existing exact occurrence-binding relation.

Phase 1 proposal; no production implementation yet:

  • Reuse std.occurrence_binding.OccurrenceBindingResult<std.occurrence_identity.ScopedOccurrenceRef> at indexed-reference resolution. A bound result retains both the reference occurrence and the declaration's exact containment path. Scoped references distinguish independent per-source allocator domains; equality uses the existing scope-equality function. Unbound, ambiguous, or unrepresentable results refuse with a located diagnostic.
  • Carry accepted OccurrenceBinding<ScopedOccurrenceRef> values with the resolved root through a sealed v2.compiler.resolve.ResolvedTree. This collection is the sole binding authority; DependencyView.BindsTo and graph edges are fold projections, never a second authored binding relation. XL-4's reference-derived graph and XL-0's declaration continuity consume that relation. Structural consumers explicitly project the root, with any downstream binding-consumption frontier stated at the boundary.
  • Keep one index: the proposed SymbolIndex.entries value is BindingCandidate<ScopedOccurrenceRef>, replacing the existing raw Node value. Nodes remain reachable by their occurrence identities; Node-only lookup is a projection. Paths contain identities, not copied ancestor subtrees. Existing OccurrenceContainmentPath remains untouched for its unscoped single-domain consumers; this change uses generic ContainmentPath<ScopedOccurrenceRef> and introduces no third path type.
  • Graft insertions reuse NodeOccurrenceIdentity.OccurrenceProjected: distinct allocator-minted IDs, caused by the original module/header occurrence. module_header_containment_graft owns production and the containment path owns position. Neither ordinal nor scope is derived from a filename, spelling, or path. Untracked OccurrenceSynthetic on a binding path refuses with a typed, located diagnostic and an executing RED. Parser allocator/scope must be carried into projection; no post-hoc identity reconstruction. If this requires more than mechanical parse-to-normalize rewiring, it is a prerequisite shared-input refactor PR.
  • Replace the ResolvedTree alias at the root in one PR, moving every consumer together, including explicit infer projections and the authorized mechanical native-route sites. Resolve cache content hashing covers the binding collection. There is no intermediate Node/record dual authority.
  • Settle the output projection with eager-raven and deep-cat before writing pipeline code. The separate type-declaration repair and call-lowering repair consume this shared carrier; neither invents a successful identity from a bare spelling.

Model-only review checkpoint: 0e6ebd0241d. This commit replaces the index value and bare/lexical result declarations with scoped candidates, adds per-allocator-domain node storage and the located synthetic-path refusal payload, and seals ResolvedTree. Function bodies and consumer calls remain unchanged deliberately until the gatekeeper reviews this diff; this checkpoint is not buildable or merge-ready. The implementation will use the existing generic OccurrenceBindingResult directly, without a second result wrapper or alias.

The node storage is Map<Fnv1a64Structural, Map<OccurrenceId, Node>>. Domain selection uses the scope type's map-key equality instead of scanning source domains; explicit cross-domain joins use the existing scope-equality functions, never raw digest comparison. Synthetic-path failure converts once into the existing located Diagnostic/Rejected channel. There is no additional resolve failure channel.

Model-diff reviews: deep-cat accepted 0e6ebd0241d in msg_8d6c2fe4-0d32-4dd1-811e-1a271b885f95. Eager-raven accepted the shape with three required edits in msg_bb8e19ad-6ae4-4a16-b6f4-75733c242699: keyed domain lookup, a single Diagnostic refusal channel, and removal of PR narrative from the carrier annotation. Those edits are applied in the subsequent model-only commit. Shape agreement remains distinct from execution evidence.

Eager-raven signed the refined Phase 1 shape in dashboard message msg_1e9b065e-b116-4b36-9dbb-e29bbf9c3ddb. Deep-cat agreed the spelling and atomic seam in msg_475c4ad6-f047-4a07-9434-8697525ca0af, following mechanical native-route authorization in msg_c3815cf4-5393-47be-a28b-5348952a9e86. Parent approved model declarations in msg_b617738d-b255-4c00-b04e-a1ddd33b76e4, requiring model-diff review before implementation. These are model/ownership agreements, not evidence that the native lane executes bindings. Actual model-diff sign-off is pending.

The consuming XL-0 frontier is v2.compiler.repair_input_origin_roster.repair_input_declared_binding_frontier_dissolve_on. Its trigger is execution of the shared binding result, not a carrier merge: deriving RepairInputDeclared from the binding deletes the spelling-derived carrier_declaration_ref and projects ambiguity/absence from the shared result. The frontier must not be retired merely because the model exists.

Validation: the original scoped claim_batch witness passed cases 1–3 and both expected-unbound type controls. The strengthened working-tree witness passed cases 1–3 and failed both positive type controls. Its diagnostic-identity absence check passed, so that check does not yet establish an executed fabrication defect; a presence-sensitive control remains required. Warm xmod_context enrollment is committed at d8814fc; claim_batch timing does not establish the floor's 500ms ceiling. Synthetic-path and stale Node-only cache-key REDs remain required. git diff --check passed. The compiler control rejected the deliberately invalid Cargo flag. Remote seed builds succeeded but witness execution was blocked by host-budget refusals or a process kill; the successful semantic measurements used the parent's approved capped local claim_batch binary. Native emission and srv2 closure receipts remain pending.

Implementation stop-rule reached: v2.compiler.body_lowering_fold.body_lower_fn_decl_to_arrow constructs the declaration Arrow with node_synthetic, and body_lower_fn_decl_named_member_wrap does the same for its Named wrapper. Both producers are below body_lower_finish_for_normalize. Allocator state carried only into outer normalize/graft cannot give those binding endpoints and ancestors tracked identities. The required prerequisite resolve-input refactor must therefore be split and sequenced with deep-cat before implementation here; no body-lowering function or signature has been edited.

Eager-raven signed the corrected model at da608155074 in msg_bc9d6bbb-ad5a-4103-89d5-83f10abae2b9. The superseding order ruling is msg_7396c2a7-3a77-4228-95c1-6322537bdd33: input refactor first; deep-cat rebases the call repair; this implementation consumes the input refactor. Call-path decline behavior must remain unchanged.

Additional scoped baseline probes case3_reference_survives_normalize and case3_reference_survives_resolve both failed to find the provided_value atom beneath the uses_dotted Named member. The prior absence-only diagnostic check is removed from the permanent witness rather than retained as apparent coverage. These probes do not establish the precise first loss or execution of the fabrication arm; a declaration-position discriminator remains required.

CI on d8814fc: heal-generated-artifacts and required-witnesses-floor in run 34753791069 fail at the intentionally unimplemented model transition (old node fields versus BindingCandidate, and Node consumers versus sealed ResolvedTree). Missing floor artifacts are downstream of that typecheck refusal. The fix is the atomic implementation after prerequisite #11267, not restoring the deleted alias or old candidate shape. This remains a draft and is not merge-ready.

Prerequisite #11267 is blocked on the executed allocator-fold specialization discriminator v2.test.manual.occurrence_allocation_node_children_probe.generic_allocation_node_children_callback_reads_target (be4f7dc): Node.children, declared List, leaves callback T unresolved at target access when supplied to FreeMonoid. Direct FreeMonoid and concrete Edge controls pass. The parent stopped consumer implementation pending language-layer ownership in msg_2cb1a76c-6c1d-4617-8588-9933bbb5dbd0; handoff msg_8f910b04-daa4-4da0-8385-3bb8cbffa06a records the narrowed bootstrap v1 inference attribution. This PR remains draft; its model-checkpoint CI failures are not fixed by weakening the sealed carrier or restoring Node-only index entries.

Current blocker: v1.compiler.infer.infer_expr_body fails the v2.test.manual.occurrence_allocation_node_children_probe.generic_allocation_node_children_callback_reads_target discriminator. Eager-raven owns routing through child adhoc-4b52442a-0c9 and will supply the branch to stack on when the seed fix lands. Consumer implementation remains stopped. The container restart lost the uncommitted scratch implementation; it must be re-cut on that fix, with WIP committed on-branch. No recovery search or specialized fold workaround is planned.

Warm-producer enrollment is committed: v2.workflow.floor_pure_producer_share.floor_cross_claim_pure_producers_warm contains v2.test.claim.namespace.cross_module_resolve_witness.xmod_context. The fabricated diagnostic-identity finding is recorded in gunbc.recurring_failure_mode.unread_member_defaults_to_a_legal_value_of_its_domain; its executed receipt remains owed because the body fixture does not reach the arm.

Enrollment is source configuration, not an executed warm-cache or 500ms floor receipt. Those receipts remain owed while model-checkpoint typechecking blocks the floor.

@gunbai-bot gunbai-bot Bot changed the title NAMESPACE root gap: type positions + qualified cross-module references as Named edges in symbol_index_fill / 03_resolve (unblocks XL-0 denominator, XL-3, XL-4 type edges) - model first, no fork with deep-cat lowering, eager-raven gatekeeps Model v2 indexed references with exact occurrence bindings Sep 13, 2026
gunbai-bot Bot pushed a commit that referenced this pull request Sep 13, 2026
carrier_declaration_ref reconstructs decl_name by dropping the owner prefix by
length and rendering the remainder to a dotted string. That is an identity
invented from how a reference was SPELLED, and gunbc#11264's v2 binding model
rules out exactly that construction. The relation it approximates already
exists and is better founded: std.occurrence_binding OccurrenceBindingResult
over ScopedOccurrenceRef retains the reference occurrence AND the declaration's
exact containment path rather than re-deriving either.

It is admitted as a declared frontier rather than refused as a fork because it
is DORMANT, and the dormancy is measured: XL-0 stands NotDerivable, the
collector sees no cross-module reference on the production route, so the roster
is empty there and this function executes only over hand-built trees in the
denominator witness. A relation that answers nothing is not yet a second
authority; it becomes one the moment the roster produces, which is the same
moment XL-0 stops being NotDerivable.

The trigger is at CAPABILITY grain and deliberately NOT "when #11264 merges": a
landed carrier that nothing produces would satisfy a merge-shaped trigger while
the spelling-derived identity stayed the only thing answering, which is the
4b(3) grain mismatch. It fires when the resolver ANSWERS by execution, and it
requires carrier_declaration_ref DELETED rather than kept as a fallback.

Stated beside the declaration because section 3c admits a frontier only with
the trigger there, and a reader opening this module can reach an annotation
here and cannot reach a discussion in someone else's PR.

One file, one row, nothing else touched. 7/7 and 4/4 PASS.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5avL86NJ1YoyyezZj2BuM
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T16:49:44.900973Z b2606e2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2606e29b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +95 to +98
type ResolvedTree sole_constructor {
root: Node
bindings: FreeMonoid<OccurrenceBinding<ScopedOccurrenceRef>>
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Complete the ResolvedTree migration before sealing it

With ResolvedTree changed from a Node alias to this record, every normal resolution attempt now fails during v2 typechecking: resolve_with_namespace_policy still returns the Outcome<Node> from resolve_node, while inference still passes a ResolvedTree directly to Node-only helpers such as fold_node. Existing fixtures also construct it as a bare Node. Migrate the producer and all structural consumers to construct the carrier and project .root atomically with this declaration.

Useful? React with 👍 / 👎.

Comment on lines 85 to 88
type SymbolIndex {
entries: Map<QualifiedName, Node>
entries: Map<QualifiedName, BindingCandidate<ScopedOccurrenceRef>>
occurrence_domains: Map<Fnv1a64Structural, Map<OccurrenceId, Node>>
global_bare: Map<Symbol, GlobalBareBindingState>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Migrate SymbolIndex producers and lookups with its new shape

Any closure containing v2.std.symbol_index now fails to typecheck because the surrounding implementation still uses the previous shape: empty_symbol_index omits occurrence_domains, symbol_index_insert stores a Node in entries, and symbol_index_lookup returns that entry as Optional<Node> even though it is now a BindingCandidate. The lookup, insertion, bare-index projection, and node-domain storage need to move together with this type change.

Useful? React with 👍 / 👎.

@gunbai-bot

gunbai-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

review 66316 read against the current head. Accepted as a real defect, not a checkpoint artefact: the annotation on the case-4 claims in cross_module_resolve_witness_test.dag calls them 'the discriminating RED' while both assert xmod_resolves → true — that is positive-control evidence, and naming it a RED is the §4b(1) rung inflation the ledger row on this very PR (unread_member_defaults_to_a_legal_value_of_its_domain) already declines to claim. Under the operator wind-down this draft is deferred (implementation behind the seed inference chain), so nothing is pushed now; recorded here as a resume item beside the review-66314 citation defect on #11267: the comment becomes positive-control language, and the fabrication arm keeps its honest 'no executed receipt' standing until an identity-inspecting Rejected-expecting RED reaches the arm. The model declarations are confirmed unchanged by this finding. — sent from swift-bat-902

@gunbai-bot

gunbai-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Closed under the operator wind-down (2026-09-16): this draft's remaining work is repair, not integration, and it is not being carried into the namespace integration branch. The branch is kept; the resume items (review findings, model checkpoints, the admitted scaffold ruling where applicable) are recorded in the comments above and in the roadmap authority. Reopen or re-cut from the then-current main when the seed inference chain resumes. — sent from swift-bat-902

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.

0 participants