Skip to content
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
58 changes: 45 additions & 13 deletions src/v3/compiler/src/bootstrap.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
// Dag::new() bootstrap.
//
// PB-1 closure: `Dag::new()` no longer tokenizes/parses/lowers any
// bootstrap authority at runtime. All four bootstrap authority sets
// bootstrap authority at runtime. Five bootstrap authority sets
// are loaded from committed generated snapshots:
//
// - `std_fixtures` (`dsl/std/*.dag`)
// - `STAGED_FILES` (`src/v3/std/*.dag`)
// - `V3_SPECS` (`src/v3/spec/*.dag`)
// - `COMPILER_FILES` (`src/v3/compiler/*.dag`, minus `tokenize.dag`)
// - `std_fixtures` (`dsl/std/*.dag`)
// - `STAGED_FILES` (`src/v3/std/*.dag`)
// - `V3_SPECS` (`src/v3/spec/*.dag`)
// - `COMPILER_FILES` (`src/v3/compiler/*.dag`, minus `tokenize.dag`)
// - `EXTDEPS_BOOTSTRAP_FIXTURES` (scoped subset of `dsl/extdeps/languages/*/*.dag`)
//
// `compile_parse_surface_std_authority_dag` uses the companion snapshot
// that omits `src/v3/std/parse_surface.dag`, so a fresh parse+lower of
// that authority still stays first-of-name.
//
// **Production bootstrap does not inject target-language
// realizations.** Realization facts for emitted languages live in
// `dsl/extdeps/languages/*` per the thesis; compiler code does not
// manufacture those. L1.5 adds one narrow exception: the staged
// `src/v3/compiler/pipeline.dag` declarations are upgraded in-place to
// `ArrowBody::ExternalRealization` so the compiler's own pipeline
// authority lives in the bootstrap Dag with the intended stage-body
// shape.
// **Target-language realization facts stay out of bootstrap.** Realization
// facts for emitted languages live in `dsl/extdeps/languages/*` per the
// thesis and are consumed by the per-target emitters at emission time via
// `SubstrateAccessorBinding` records — compiler code does not manufacture
// those. The L1.5 exception remains: `src/v3/compiler/pipeline.dag` stage
// declarations are upgraded in-place to `ArrowBody::ExternalRealization`
// so the compiler's own pipeline authority lives in the bootstrap Dag with
// the intended stage-body shape.
//
// `EXTDEPS_BOOTSTRAP_FIXTURES` is a narrow, bounded extension of that
// boundary: only extdeps authorities whose content is pure structural
// **data** (target-primitive declarations consumed symbolically by the
// target-grounding engine as `Declaration`-shaped values; see
// `dsl/extdeps/languages/rust/primitives.dag`) are loaded. Arrow/realization
// files (`rust/emit.dag`, `rust/types.dag`, etc.) are deliberately excluded
// — their bodies stay per-target emitter-side, not in the bootstrap Dag.
// Coverage is currently `rust/primitives.dag` only (T-Ground-Engine pilot
// unblock, Director-dispatched); expansion to python/go primitives is a
// file-system extension once those targets reach the same pilot stage.
// Transitional shape: PB-1's eventual extension to cover extdeps as a fifth
// snapshot set absorbs this list cleanly with no `bootstrap.rs` edit.
//
// Bootstrap failures (tokenize/parse/lower errors on std/ files,
// unresolved cross-file references) attach to the Dag's diagnostic
Expand All @@ -46,6 +60,23 @@
const STRING_TYPE_DAG: &str = include_str!("../../../../dsl/std/string_type.dag");
const TYPES_DAG: &str = include_str!("../../../../dsl/std/types.dag");

// Scoped extdeps bootstrap authorities. See the `EXTDEPS_BOOTSTRAP_FIXTURES`
// commentary in the file header: only pure structural-data extdeps authorities
// are in scope, and expansion is a file-system edit to this array.
const EXTDEPS_RUST_PRIMITIVES_DAG: &str =
include_str!("../../../../dsl/extdeps/languages/rust/primitives.dag");

const EXTDEPS_BOOTSTRAP_FIXTURES: &[(&str, &str)] = &[(
"dsl/extdeps/languages/rust/primitives.dag",
EXTDEPS_RUST_PRIMITIVES_DAG,
)];

/// Name of the `rust_pilot_primitives` top-level `data` declaration in
/// `dsl/extdeps/languages/rust/primitives.dag`. Single string literal —
/// `Dag::rust_pilot_primitives()` and tests read this constant rather than
/// duplicating the identifier.
pub(crate) const RUST_PILOT_PRIMITIVES_NAME: &str = "rust_pilot_primitives";

Check failure on line 78 in src/v3/compiler/src/bootstrap.rs

View workflow job for this annotation

GitHub Actions / v3

constant `RUST_PILOT_PRIMITIVES_NAME` is never used

// M1(3) PR-B-unwind R1 — the v3-only staged files are enumerated
// by `build.rs` at compile time and exposed via generated statics:
//
Expand Down Expand Up @@ -144,6 +175,7 @@
let fixtures: Vec<(&str, &str)> = staged_iter
.chain(V3_SPECS.iter().copied())
.chain(compiler_iter)
.chain(EXTDEPS_BOOTSTRAP_FIXTURES.iter().copied())

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 Regenerate full bootstrap snapshots with extdeps fixtures

Adding EXTDEPS_BOOTSTRAP_FIXTURES here changes only the runtime assembly path, but Dag::new() still clones the committed generated snapshots (bootstrap_generated*.rs). Because those generated files were not updated in this commit, generated and runtime bootstraps now diverge (the PB-1 snapshot equivalence tests report declaration-count mismatches), so production bootstrap still omits the new extdeps declarations until regen output is committed.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Stale on current tip. Verified: snapshots were regenerated after my initial WIP.

$ git log --oneline --all -- src/v3/compiler/src/bootstrap_generated.rs | head -1
342146cb6 WIP: extdeps loader close

$ grep -c "rust_pilot_primitives" src/v3/compiler/src/bootstrap_generated.rs src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs
src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs:1
src/v3/compiler/src/bootstrap_generated.rs:1

The WIP commit that landed EXTDEPS_BOOTSTRAP_FIXTURES also regenerated bootstrap_generated.rs / bootstrap_generated_without_parse_surface.rs / bootstrap_std_generated.rs (via cargo run -p v3-compiler --bin regen_bootstrap); the same commit also regenerated eight lens modules that walk Disj declarations (cost, cost_symbolic, provenance, structural_resolution, unused_parameters, variant_payload, infer_helpers, lower_helpers) so the TargetCarrier / RustPrimitive enums land in every generated consumer.

PB-1 drift tests — pb1_bootstrap_full_snapshot_test::generated_full_bootstrap_snapshot_matches_runtime_full_bootstrap, ..._without_parse_surface_matches_runtime_variant, and dag_new_bootstrap_is_clean_and_byte_stable — are green in the latest cargo test --workspace --exclude v2-compiler-tests run cited in the PR body. You were likely looking at the pre-regen WIP (f58fa555f); head is now 6acadd450.

.collect();
load_fixtures(dag, &fixtures);
materialize_pipeline_realizations(dag);
Expand Down
Loading