Skip to content

Namespace Blocker-1 (part 1): reference-derived module-edge producer + inert-lens reach repoint - #6615

Merged
briansrls merged 5 commits into
mainfrom
session/fierce-ram-489-blocker1
Jul 14, 2026
Merged

briansrls merged 5 commits into
mainfrom
session/fierce-ram-489-blocker1

Conversation

@gunbai-bot

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

Copy link
Copy Markdown
Contributor

Summary

Namespace Blocker-1 (part 1): the native reference-derived module-edge producer the namespace terminal step ("deps via container.member") needs, plus repointing the inert-lens hygiene reach to it.

The module dependency graph is import-parse-derived (extract_import_paths). After the corpus-wide import strip it goes empty, so the inert-lens hygiene reach BFS flags ~20 v2.lens.* modules as inert — the strip PRs' documented ~44s CI blocker.

reference_resolution_facts parses each import-less file once through the real front-end (tokenize + parse — no substring scan), collects qualified-name chains + bare identifier use sites, and resolves them to the declaring module via a global exported-name index:

  • same-module names resolve locally (no edge) — keeps a ubiquitous fixture data like live_tree_disposition (declared in ~670 files) from fanning every referrer out to every declarer;
  • cross-module names disambiguate by containment proximity (nearest module-path prefix — Bool → the nearest v2.std.logic);
  • edges carry a confidence tag (Qualified | UniqueBare | AmbiguousBare); the inert-lens reach reads the strict set (dropping AmbiguousBare) so an over-connected graph can never silently clear a truly-inert lens (DESIGN §5 — no fail-open hygiene).

The reach path_imports is now import ∪ reference per file: an import-bearing file uses its exact import edges (unchanged); a stripped file is carried by its reference edges. Monotone reach ⇒ zero regression by construction (the reached set only grows, so the inert set can only shrink).

What is NOT here (staged part 2)

The module-graph loader closure stays import-derived. A reference-derived loader changes every witness's load set tree-wide and surfaces latent issues — import-less-but-referencing std files, witnesses that need src/v1 in their pool, the pre-existing fleet_converge Srv3 red, and homonyms the bright-cat lane must qualify — so it is staged after those land (see the note in build_module_graph_facts_live_uncached).

Test plan

  • Build: cargo build --release — clean, no warnings.
  • Inert-lens hygiene on a locally-stripped src/v2/test tree (claim_batch --roster-from-discovery --source-root dag --source-root src/v2 --scan-dir dag/test/claim --scan-dir src/v2/test/claim/manual): no inert-lens error (was 20 inert without the repoint).
  • Producer's only live consumer is the inert-lens reach; monotone union ⇒ unstripped inert count unchanged (0).

@briansrls
briansrls force-pushed the session/fierce-ram-489-blocker1 branch from 0e238da to 211dd15 Compare July 14, 2026 16:21
@gunbai-bot gunbai-bot Bot changed the title Namespace PR-5d: corpus import strip src/v2/test/** (~4319 import lines; delete import lines; disjoint from 5a/5b/5c; regen; dag_compile_clean_gate) Namespace Blocker-1 (part 1): reference-derived module-edge producer + inert-lens reach repoint Jul 14, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 14, 2026 16:29
@gunbai-bot

gunbai-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

CI red is inherited Blocker-2 (main-head compile-clean), not this diff.

The failing check is dag_compile_clean_gate_passes (returned Bool(false)) in floor batch 1. I reproduced the whole-tree compile-clean locally and it fails on exactly one pre-existing defect:

non-exhaustive match: missing variant(s) Srv3InstallReconcileObserve, DurableApprovalGrantRecord,
DurableApprovalGrantRead, Srv3InstallMediaFetch, Srv3SeededInstallMediaRemaster,
Srv3SeededInstallMediaToolchainEnsure, Srv3SolConsoleCapture, Srv3BmcwebSessionLogin,
Srv3BmcwebTokenExtract, Srv3NbdProxyServe, Srv3BootOnceReadBackSleep, Srv3ReceiptEmit
(dag/gunbc/fleet_converge_cli.dag:2974-2979)

This is a semantic merge-skew: shell→dag #6586 (P5a) added 12 Srv3*/DurableApproval* HostEffect variants, and the converge_cli match arm in dag/gunbc/fleet_converge_cli.dag was not updated to cover them. It reproduces on origin/main with imports fully restored, so it is entirely disjoint from this PR — tracked as Blocker-2 (dag/gunbc / shell→dag lane), a separate dispatch.

This PR's diff is a single file (src/v1/stage0/src/cli_run.rs, +510) that adds a seed-side reference-derived module-edge producer consumed only by the inert-lens hygiene reach (import ∪ reference-strict). The module-graph loader (build_module_graph_facts_live) is deliberately left import-derived — the loader repoint (part-2) is parked until the homonym-qualification lanes land. Nothing here touches fleet_converge_cli.dag or the HostEffect match, so it cannot cause or fix the compile-clean red. CI here will go green once Blocker-2 lands on main.

— sent from fierce-ram-489

@gunbai-bot

gunbai-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — on the fixture-cleanup nit: the test does clean up on success. reference_edges_derived_from_bare_refs_local_and_import_aware calls std::fs::remove_dir_all(&root) as its last statement (cli_run.rs:12776), after all three asserts, and also pre-cleans at the start (12733). The only path that leaves the fixture behind is an assert panic (a test failure), where unwinding skips the trailing teardown — and even then it's a pid-namespaced dir under gitignored target/ (gunbc-refedge-core-<pid>), so it never touches version control and is self-limiting.

I'm not pushing a commit for it: (a) it's cosmetic and only on the failure path, as you noted non-blocking; (b) a new commit resets the SHA, which would invalidate the freshly-refreshed 2/2 approvals and re-run CI on this merge-critical PR. If we want panic-safe teardown, the natural place is a Drop guard, and it can fold in when this scaffold is revised — the whole reference_edge_producer_tests module dissolves at the named trigger (symbol_index_fill) anyway.

— sent from fierce-ram-489

@briansrls
briansrls merged commit a1e2104 into main Jul 14, 2026
3 checks passed
@briansrls
briansrls deleted the session/fierce-ram-489-blocker1 branch July 14, 2026 19:01
briansrls added a commit that referenced this pull request Jul 14, 2026
Main's reference_edges_as_import_facts supersedes the strip-PR interim
substring scan; remove dead helpers now that branch is on origin/main.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 14, 2026
Strip branch keeps dag/test import deletion only; seed hygiene graph
change lands separately on main (part-1b after #6615).

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 14, 2026
Floor lens hygiene must emit reference edges without discovery-scope
exclusions: long/ witnesses are excluded from per-PR enrollment but still
wire v2.lens.* reachability once import lines are stripped (part-1 #6615).

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