From fa159d0ea97748b468be2cd3b9438e1499b81af7 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Wed, 7 Oct 2026 04:33:02 +0000 Subject: [PATCH] Home LayerPrefix classification on v2.std.layer, not cross_tree.resolution. The prefix walk answers a browsing-home question that LayerPrefix already owns; parking it in resolution made every resolution dependent a layer dependent once #13526 counts import-bearing qualified refs. Co-authored-by: Cursor --- dag/gunbc/doc_graph_roots.dag | 2 +- ...yering-imports-reference-repoint-design.md | 4 +- src/v1/stage0/src/cli_run.rs | 4 +- src/v2/std/cross_tree/resolution.dag | 55 +----------------- src/v2/std/layer.dag | 57 +++++++++++++++++++ src/v2/std/layer_import_scan.dag | 2 +- 6 files changed, 64 insertions(+), 60 deletions(-) diff --git a/dag/gunbc/doc_graph_roots.dag b/dag/gunbc/doc_graph_roots.dag index b618eda42ec..3fea9fd2d7b 100644 --- a/dag/gunbc/doc_graph_roots.dag +++ b/dag/gunbc/doc_graph_roots.dag @@ -789,7 +789,7 @@ data hand_authored_doc_bind_incomings: List = [ primary_work: DeclarationRef { module_path: "v2.std.layer", decl_name: "LayerImportFact", field: WholeDeclaration }, additional_works: [ DeclarationRef { module_path: "v2.std.layer_import_scan", decl_name: "layer_import_facts_live", field: WholeDeclaration }, - DeclarationRef { module_path: "v2.std.cross_tree.resolution", decl_name: "layer_prefix_from_dotted_qualified_name", field: WholeDeclaration }, + DeclarationRef { module_path: "v2.std.layer", decl_name: "layer_prefix_from_dotted_qualified_name", field: WholeDeclaration }, ], dissolution: PlanRetiresWhen { condition: unbound_dissolution(description: "the work this document plans lands and its subject LayerImportFact describes shipped behavior rather than a planned change; the row deletes with the document. Registered at subject grain: the systems bound here are the ones whose movement would make this document's purpose false, not every system its prose mentions.") }, }, diff --git a/docs/plans/layering-imports-reference-repoint-design.md b/docs/plans/layering-imports-reference-repoint-design.md index 7cf1bfed765..015ccb089dc 100644 --- a/docs/plans/layering-imports-reference-repoint-design.md +++ b/docs/plans/layering-imports-reference-repoint-design.md @@ -97,7 +97,7 @@ Loader-tier consumers (`extend_with_bare_reference_closure`, compile-clean impor | --- | --- | --- | | `layer_import_facts()` edge source | `extract_import_paths` per file | transitional union per §3.1; terminal reference-only per §3.2 | | `reference_resolution_facts` pool | (n/a) | **`witness_layer_roots` pool** + `std_roots ∪ extdeps_roots` importer scope — qualified targets like `v2.compiler.*` resolve against the full witness-layer census, same split as module-graph selection adjacency | -| `layer` field assignment | scan-root constant (`LAYER_STD` / `LAYER_EXTDEPS`) | **`layer_prefix_from_dotted_qualified_name(importer_module)`** — authority: `v2.std.cross_tree.resolution`; **host mirror** (`CLI_RUN_LAYER_PREFIX_FROM_DOTTED_MODULE_SCAFFOLD_MARKER`) until builtin routes through `.dag` | +| `layer` field assignment | scan-root constant (`LAYER_STD` / `LAYER_EXTDEPS`) | **`layer_prefix_from_dotted_qualified_name(importer_module)`** — authority: `v2.std.layer`; **host mirror** (`CLI_RUN_LAYER_PREFIX_FROM_DOTTED_MODULE_SCAFFOLD_MARKER`) until builtin routes through `.dag` | | `import_module` field semantics | import-line target | **resolved target module** (reference or import — same string shape) | | Importer module resolution | implicit from path prefix | `extract_module_path(content)` per file (already required by reference producer) | @@ -192,7 +192,7 @@ These call `layer_import_facts_live` / `layer_import_facts` and inherit the repo | --- | --- | | `reference_resolution_facts` scaffold | **ready** — landed, interpreter-registered | | `reference_edges_as_import_facts(strict)` | **ready** — tier contract documented | -| `layer_prefix_from_dotted_qualified_name` | **ready** — `v2.std.cross_tree.resolution` | +| `layer_prefix_from_dotted_qualified_name` | **ready** — `v2.std.layer` | | PR-5b import-line strip | **parallel** — Phase 1 must land before strip reaches gate scan roots, or gate goes blind on those files | | Namespace terminal step 5 | **gates** Phase 3 — import grammar deletion | | `realization_vocabulary_containment` / `meta_exec_confinement` | **coupled** — inherit producer; no separate migration | diff --git a/src/v1/stage0/src/cli_run.rs b/src/v1/stage0/src/cli_run.rs index 728d0d0d83a..43e5939a90b 100644 --- a/src/v1/stage0/src/cli_run.rs +++ b/src/v1/stage0/src/cli_run.rs @@ -29708,7 +29708,7 @@ const LAYER_EXTDEPS: &str = "LayerPrefixExtdeps"; const LAYER_COMPILER: &str = "LayerPrefixCompiler"; const LAYER_WORKFLOW: &str = "LayerPrefixWorkflow"; -// SCAFFOLD (§7 HAND-RUST — authority: `v2.std.cross_tree.resolution.layer_prefix_from_dotted_qualified_name`). +// SCAFFOLD (§7 HAND-RUST — authority: `v2.std.layer.layer_prefix_from_dotted_qualified_name`). // Host `layer_import_facts` must stamp `LayerImportFact.layer` on every emitted row; the builtin // seam cannot call the `.dag` classifier without an interpreter round-trip per file. This mirror // is byte-synced to that authority and carries an explicit dissolution trigger — not a second @@ -29719,7 +29719,7 @@ const LAYER_WORKFLOW: &str = "LayerPrefixWorkflow"; pub(crate) const CLI_RUN_LAYER_PREFIX_FROM_DOTTED_MODULE_SCAFFOLD_MARKER: &str = "cli_run_layer_prefix_from_dotted_module_scaffold"; -/// Rust mirror of `v2.std.cross_tree.resolution.layer_prefix_from_dotted_qualified_name`. +/// Rust mirror of `v2.std.layer.layer_prefix_from_dotted_qualified_name`. /// See `CLI_RUN_LAYER_PREFIX_FROM_DOTTED_MODULE_SCAFFOLD_MARKER`. fn layer_prefix_from_dotted_module(module: &str) -> &'static str { let parts: Vec<&str> = module.split('.').filter(|p| !p.is_empty()).collect(); diff --git a/src/v2/std/cross_tree/resolution.dag b/src/v2/std/cross_tree/resolution.dag index 36030f97fdd..84f4246cd71 100644 --- a/src/v2/std/cross_tree/resolution.dag +++ b/src/v2/std/cross_tree/resolution.dag @@ -1,8 +1,7 @@ module v2.std.cross_tree.resolution -import v2.std.qualified_name { QualifiedName, qualified_name_from_dotted_string } +import v2.std.qualified_name { QualifiedName } import v2.std.cross_tree.import_model { CoFundamental, CrossTreeAdmitted, CrossTreeDenied, CrossTreeImport, DagTree, LessFundamental, MoreFundamental, SourceRootRef, SourceRootSet, TreeFundamentalityOrder, V2Tree, cross_tree_import_admitted, source_root_ref_eq, source_root_set_contains } import std.algebra { Cons, Empty, FreeMonoid } -import v2.std.algebra { HeadAbsent, HeadFound, list_head } type SourceRootBinding { module: QualifiedName root: SourceRootRef @@ -71,58 +70,6 @@ fn tree_fundamentality_order( } } -fn layer_prefix_from_dotted_qualified_name(qn: String) -> v2.std.layer.LayerPrefix { - layer_prefix_from_qualified_name( - qn: qualified_name_from_dotted_string(dotted: qn) - ) -} - -fn layer_prefix_from_qualified_name(qn: QualifiedName) -> v2.std.layer.LayerPrefix { - match qn { - Empty => v2.std.layer.LayerPrefixStd - Cons { head: h, tail: t } => - if h == ^v2 { - match list_head(xs: t) { - HeadAbsent => v2.std.layer.LayerPrefixStd - HeadFound { value: h2 } => - if h2 == ^std { - v2.std.layer.LayerPrefixStd - } else if h2 == ^extdeps { - v2.std.layer.LayerPrefixExtdeps - } else if h2 == ^compiler { - v2.std.layer.LayerPrefixCompiler - } else if h2 == ^workflow { - v2.std.layer.LayerPrefixWorkflow - } else if h2 == ^lens { - v2.std.layer.LayerPrefixCompiler - } else if h2 == ^test { - v2.std.layer.LayerPrefixCompiler - } else { - v2.std.layer.LayerPrefixCompiler - } - } - } else if h == ^extdeps { - v2.std.layer.LayerPrefixExtdeps - } else if h == ^std { - v2.std.layer.LayerPrefixStd - } else if h == ^compiler { - v2.std.layer.LayerPrefixCompiler - } else if h == ^lens { - v2.std.layer.LayerPrefixCompiler - } else if h == ^test { - v2.std.layer.LayerPrefixCompiler - } else if h == ^workflow { - v2.std.layer.LayerPrefixWorkflow - } else if h == ^gunbc { - v2.std.layer.LayerPrefixWorkflow - } else if h == ^tools { - v2.std.layer.LayerPrefixWorkflow - } else { - v2.std.layer.LayerPrefixStd - } - } -} - fn source_root_set_insert( roots: FreeMonoid, r: SourceRootRef diff --git a/src/v2/std/layer.dag b/src/v2/std/layer.dag index f173b0fc811..98c808c7916 100644 --- a/src/v2/std/layer.dag +++ b/src/v2/std/layer.dag @@ -1,5 +1,10 @@ module v2.std.layer +import v2.std.qualified_name { QualifiedName, qualified_name_from_dotted_string } +import std.algebra { Cons, Empty } +import v2.std.algebra { HeadAbsent, HeadFound, list_head } +import v2.std.text { String } + type LayerPrefix = LayerPrefixStd | LayerPrefixExtdeps @@ -21,3 +26,55 @@ type LayerImportFact { path: String import_module: String } + +fn layer_prefix_from_dotted_qualified_name(qn: String) -> LayerPrefix { + layer_prefix_from_qualified_name( + qn: qualified_name_from_dotted_string(dotted: qn) + ) +} + +fn layer_prefix_from_qualified_name(qn: QualifiedName) -> LayerPrefix { + match qn { + Empty => LayerPrefixStd + Cons { head: h, tail: t } => + if h == ^v2 { + match list_head(xs: t) { + HeadAbsent => LayerPrefixStd + HeadFound { value: h2 } => + if h2 == ^std { + LayerPrefixStd + } else if h2 == ^extdeps { + LayerPrefixExtdeps + } else if h2 == ^compiler { + LayerPrefixCompiler + } else if h2 == ^workflow { + LayerPrefixWorkflow + } else if h2 == ^lens { + LayerPrefixCompiler + } else if h2 == ^test { + LayerPrefixCompiler + } else { + LayerPrefixCompiler + } + } + } else if h == ^extdeps { + LayerPrefixExtdeps + } else if h == ^std { + LayerPrefixStd + } else if h == ^compiler { + LayerPrefixCompiler + } else if h == ^lens { + LayerPrefixCompiler + } else if h == ^test { + LayerPrefixCompiler + } else if h == ^workflow { + LayerPrefixWorkflow + } else if h == ^gunbc { + LayerPrefixWorkflow + } else if h == ^tools { + LayerPrefixWorkflow + } else { + LayerPrefixStd + } + } +} diff --git a/src/v2/std/layer_import_scan.dag b/src/v2/std/layer_import_scan.dag index 0de2096dc8b..7c8cdec06f5 100644 --- a/src/v2/std/layer_import_scan.dag +++ b/src/v2/std/layer_import_scan.dag @@ -14,7 +14,7 @@ import v2.std.text { String } // 🟡 dissolve-on: host layer_import_facts stamps LayerImportFact.layer via // CLI_RUN_LAYER_PREFIX_FROM_DOTTED_MODULE_SCAFFOLD_MARKER — a Rust mirror of -// v2.std.cross_tree.resolution.layer_prefix_from_dotted_qualified_name. Deletes when the builtin +// v2.std.layer.layer_prefix_from_dotted_qualified_name. Deletes when the builtin // routes layer through that .dag authority (or a shared host projection beside // reference_resolution_facts). // THE LIVE IMPORT-FACT SCAN, SEGREGATED FROM THE LAYER VOCABULARY IT PRODUCES.