Skip to content

fix(compile-clean): dissolve the §3 loader-closure fork — gate loader runs both closures - #6950

Merged
briansrls merged 4 commits into
mainfrom
fix/compile-clean-loader-closure-fork
Jul 21, 2026
Merged

briansrls merged 4 commits into
mainfrom
fix/compile-clean-loader-closure-fork

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Dissolves a §3 closure-authority fork between the two source loaders. The compile-clean gate loader load_compile_clean_entry_sources ran only extend_with_reference_closure (module-path references), while the witness loader load_sources_for_entry_with_pool runs both that and extend_with_bare_reference_closure in a fixpoint. Both functions' doc-comments each claimed to be "the ONE closure authority" — the code was forked.

The service-name and bare-name provider edges (e.g. gcp.STS → dag/extdeps/cloud/gcp/sts.dag) live only in the bare closure. So an affected entry that reaches a provider purely through a service call or bare name — dag/gunbc/auth/patterns.dag → gcp.STS.Exchange, zero imports — dropped that provider from the scoped compile set, and its names went unresolved (or silently mis-bound to a same-named declaration).

This surfaced non-locally when #6937's import strip made patterns.dag affected: a strip under src/v2 produced a diagnostic in an untouched dag/gunbc/auth/ file in a different tree.

Fix

The gate loader runs the same both-closure fixpoint as the witness loader, via a primary-precedence MultiEntryIndex (build_multi_entry_index_primary_precedence). One file.

Proven by execution

scoped_gate_loader_pulls_bare_referenced_providers (#[ignore]d, heavyweight — builds the whole-tree index):

  • RED control (old ref-only behavior, inline): patterns.dag's closure has 3 unresolved type hard diags and no sts.dag.
  • Fixed: sts.dag pulled in, 0 hard diags.

Whole-tree compile-clean (None filter, the poisoning-risk path) after the change = 0 hard diagnostics — no cross-tree Empty/Cons poisoning.

Scope / notes

  • This is the first increment of the namespace-only resolution lane's move toward reference-derived dependencies (DESIGN.md open thread). It is grounded in the code — the fork is real independent of any decision.
  • Likely fixes Import strip: src/v2/test + src/v2/lens (464 files) #6937's blocker. calm-deer-217's patterns.dag:47 expected Secret got String red is the same closure-drop seen at a different name (when sts.dag drops, gcp.STS misses the registry and access.access_token mis-binds to a String homonym). Being confirmed by rebase.
  • Memory (cc @sunny-wolf-225 governor lane): brings the gate path to parity with the witness loader's both-closure cost — not a new cost class, but more resolution work on the gate path. Relevant to the namespace wave 1: containment-tree resolution — layered census + name-derived loader (salvage) #6848 floor-memory regression under measurement. Bisect any gate-path memory movement as this change, expected, not a fresh regression.
  • Follow-up (separate PR): a §5 fail-closed backstop so an absent service provider refuses with a typed located error instead of letting inference mis-bind to any type. The silent Secret→String degradation is the argument for it.

Verification confirmed on latest main (be9631e + this change):

  • regression test scoped_gate_loader_pulls_bare_referenced_providers: pass (RED control reds, fix greens)
  • whole-tree compile-clean: HISTOGRAM_TOTAL_HARD 0, RSS 4345 MiB — unchanged vs pre-fix 4346 MiB, i.e. no whole-tree memory cost (the bare-closure growth is scoped-path only)

… runs both closures

load_compile_clean_entry_sources (the affected-set compile-clean gate loader)
ran only extend_with_reference_closure, while the witness loader
load_sources_for_entry_with_pool runs BOTH that and extend_with_bare_reference_closure
in a fixpoint. Both functions' doc-comments claimed to be the ONE closure
authority; the code was forked. The service-name and bare-name provider edges
(gcp.STS -> dag/extdeps/cloud/gcp/sts.dag) live ONLY in the bare closure, so an
affected entry reaching a provider purely through a service call or bare name
(dag/gunbc/auth/patterns.dag -> gcp.STS.Exchange, zero imports) dropped that
provider from the scoped compile set and its names went unresolved. This
surfaced non-locally when #6937's import strip made patterns.dag affected.

Fix: the gate loader runs the same both-closure fixpoint as the witness loader,
via a primary-precedence MultiEntryIndex (build_multi_entry_index_primary_precedence).

Proven by execution (scoped_gate_loader_pulls_bare_referenced_providers, #[ignore]d
heavyweight): RED control = ref-only closure of patterns.dag has 3 unresolved-type
hard diags and no sts.dag; fixed = sts.dag pulled, 0 hard diags. Whole-tree
compile-clean after the change = 0 hard diagnostics (no cross-tree poisoning).

Memory note (cc governor lane): this brings the gate path to parity with the
witness loader's both-closure cost — NOT a new cost class, but more resolution
work on the gate path; relevant to the #6848 floor-memory regression being
measured in parallel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@briansrls
briansrls force-pushed the fix/compile-clean-loader-closure-fork branch from 70cea1d to b637c11 Compare July 20, 2026 21:09
@gunbai-bot gunbai-bot Bot changed the title 6848 cleanup fix(compile-clean): dissolve the §3 loader-closure fork — gate loader runs both closures Jul 20, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 20, 2026 21:15
briansrls pushed a commit that referenced this pull request Jul 20, 2026
briansrls added a commit that referenced this pull request Jul 20, 2026
Strip import lines only; restore import-bearing modules outside this
diff (cache/*, docker, ebay, materialization, etc.). Rebased onto main
with #6950 compile-clean loader closure fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 20, 2026
The rebased patch accidentally reverted belt-A dispatch UI/routing in
roadmap_page.dag and node_http_server_emit.dag (and unrelated host_standup
/docs edits) while witness tests remained on main. Restore those files to
match main; PR scope is dag/extdeps import strip + #6950 loader fix only.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 20, 2026
Keeps PR scope to extdeps import strip, host_standup interim alignment,
and #6950 cli_run.rs loader fix only.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls force-pushed the fix/compile-clean-loader-closure-fork branch from 7f7d0ff to 9bbab0a Compare July 21, 2026 00:55
@briansrls
briansrls merged commit 9b1a0ee into main Jul 21, 2026
3 checks passed
@briansrls
briansrls deleted the fix/compile-clean-loader-closure-fork branch July 21, 2026 02:06
briansrls added a commit that referenced this pull request Jul 21, 2026
…oader closure.

Resolve merge conflicts: keep main's extend_sources_to_both_closure_fixpoint
(#6950) while preserving Arc<SourceFile> carriers on the assembled stack.
index_insert_typed already takes Arc (d8abf54).

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 21, 2026
Rebased onto main (8c2b222): #6950 cli_run loader fix already on main;
PR carries extdeps import-line removals, host_standup interim alignment,
and GcpProject inert-carrier roster only.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 21, 2026
Rebased onto main (8c2b222): #6950 cli_run loader fix already on main;
PR carries extdeps import-line removals, host_standup interim alignment,
and GcpProject inert-carrier roster only.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 21, 2026
…oader closure fix (#6938)

* Import strip batch-1: dag/extdeps (~71 files) on current main.

Rebased onto main (8c2b222): #6950 cli_run loader fix already on main;
PR carries extdeps import-line removals, host_standup interim alignment,
and GcpProject inert-carrier roster only.

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

* Restore nbd_proxy_serve transport-shape prose in host_standup.

Reverts accidental clause drop in interim_realization during strip
hygiene; behavior unchanged (review 40541 non-blocking note).

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

* WIP: Import strip: dag/extdeps + dag/tools (368 files)

* WIP: Import strip: dag/extdeps + dag/tools (368 files)

* Align calibration closure count with resolved-module grain.

Pre-resolve roster_import_closure_nodes and skip-before-resolve
augmentation now use resolve_entry + collect_typed_module_names (same
as post-resolve closure_modules), fixing floor_skip_discovery drift
(261 vs 260) after import-strip + main merge.

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

* cargo fmt: cli_run calibration closure helper.

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

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Cursor <cursoragent@cursor.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