Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dag/gunbc/doc_graph_roots.dag
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ data hand_authored_doc_bind_incomings: List<HandAuthoredDocBind> = [
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.") },
},
Expand Down
4 changes: 2 additions & 2 deletions docs/plans/layering-imports-reference-repoint-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |

Expand Down Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down
55 changes: 1 addition & 54 deletions src/v2/std/cross_tree/resolution.dag
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<SourceRootRef>,
r: SourceRootRef
Expand Down
57 changes: 57 additions & 0 deletions src/v2/std/layer.dag
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
}
}
}
2 changes: 1 addition & 1 deletion src/v2/std/layer_import_scan.dag
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down