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
8 changes: 4 additions & 4 deletions dag/gunbc/emitted_closure_compile_seed_growth.dag
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import gunbc.seed_growth { SeedGrowthJustification }
// adds one stage after it. A green there and a green here cannot be two facts about two emissions,
// which is exactly the property a separately-authored probe would have given up.
//
// WHY THE MANIFEST IS DERIVED AND NOT AUTHORED. The corpus already carries a hand-concatenated
// probe manifest (tools.self_host_curated_seed_linked_harness
// cssl_v1_compiled_probe_lib_cargo_toml), marked scaffold debt in its own module for being
// concat-authored TOML. Consuming it from a merge-blocking gate would have pinned that debt open on
// WHY THE MANIFEST IS DERIVED AND NOT AUTHORED. When this was written the corpus carried a
// hand-concatenated probe manifest in tools.self_host_curated_seed_linked_harness, marked scaffold
// debt in its own module for being concat-authored TOML (since replaced: that route now derives
// its manifest from the emitted one, tools.emitted_crate_harness_manifest). Consuming it from a merge-blocking gate would have pinned that debt open on
// the required path, and authoring a second one would have been new scaffolding the operator
// declined on 2026-08-25. The manifest here is rendered from the modeled cargo authorities instead
// -- extdeps.rust.version render_cargo_package_header_prefix for the package header,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ module gunbc.guarantee_stall.self_host_hand_authorized_cargo_toml_stall
import gunbc.guarantee_rung { Mitigatable, StructurallyGuaranteed }
import gunbc.guarantee_stall { GuaranteeStall, AwaitsOneGrounding, BoundedPopulation, climbs_when }

// DECLARED 2026-09-06. The seed-unavailable transport's Cargo.toml is HAND-AUTHORED
// as literal TOML text (concat of dependency lines), duplicating dependency names and
// versions that the real emitter owns. This is medium-as-string per DESIGN §3 — the
// transport is authoring realization inline. The ceiling is structurally guaranteed:
// the emitter produces its own Cargo.toml from the modeled dependency declaration.
// DECLARED 2026-09-06 against the seed-unavailable transport's Cargo.toml, which was then
// HAND-AUTHORED as literal TOML text and duplicated dependency names and versions the emitter
// owns. REDUCED 2026-10-03: the dependency roster is gone from every .dag harness route --
// tools.emitted_crate_harness_manifest derives each harness manifest from the Cargo.toml the
// emission wrote. What remains medium-as-string per DESIGN §3 is the overlay that module appends:
// the [lib] and [[bin]] target tables and the seed path-dependency subtable are still TOML text.
data self_host_hand_authorized_cargo_toml_stall: GuaranteeStall = GuaranteeStall {
subject: "hand-authored Cargo.toml in the seed-unavailable transport — medium-as-string parallel authority for the manifest",
subject: "harness overlay tables appended to the emitted Cargo.toml are authored as TOML text — medium-as-string for the [lib], [[bin]] and [dependencies.v1-compiler] tables; the dependency roster itself is derived from the emitted manifest and is no longer part of this stall",
current: Mitigatable,
ceiling: StructurallyGuaranteed,
blocker: AwaitsOneGrounding { grounding: "the emitter produces its own Cargo.toml from the modeled dependency declaration" },
blocker: AwaitsOneGrounding { grounding: "extdeps.languages.toml models an array-of-tables header and a dotted sub-table header; TomlTable.name renders through toml_render_key, which quotes a dotted name into a different table and has no [[name]] form" },
population: BoundedPopulation { members: [
"dag/gunbc/instruments/self_host_logic_seed_unavailable_transport.dag — the transport hosting the hand-authored Cargo.toml (slbu_cargo_toml)",
"dag/gunbc/instruments/emitted_crate_harness_manifest.dag — harness_lib_target_table, harness_crate_target_tables and harness_seed_link_dependency_table spell their tables as string literals",
] },
next_rung_trigger: climbs_when(capability: "The emitter produces its own Cargo.toml from the modeled dependency declaration, SUFFICIENT FOR the hand-authored parallel authority to be replaced by a reference to the emitted manifest, at which point all version-duplication drift sites become structurally impossible."),
next_rung_trigger: climbs_when(capability: "extdeps.languages.toml can render an array-of-tables header and a dotted sub-table header, SUFFICIENT FOR the three harness overlay tables to be TomlTable values rendered by the serializer, leaving no TOML punctuation authored in tools.emitted_crate_harness_manifest."),
}
32 changes: 20 additions & 12 deletions dag/gunbc/instruments/emission_entry_instrument.dag
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ import tools.host_prelude {
WitnessBinRefused,
WitnessBinRefusalReason
}
import tools.self_host_curated_seed_linked_harness {
cssl_v1_compiled_probe_lib_cargo_toml
import tools.emitted_crate_harness_manifest {
derive_harness_manifest_in_place,
harness_manifest_derived,
ProbeLibTarget,
SeedLinked
}
import gunbc.emit_diagnostic_observation {
GunbcDiagnostic,
Expand Down Expand Up @@ -612,22 +615,25 @@ fn measure_cargo_half(
emitted_files: emitted_files
}
} else {
let manifest = Filesystem.Write(
path: concat(out_dir, "/Cargo.toml"),
content: cssl_v1_compiled_probe_lib_cargo_toml(root: root)
let manifest = harness_manifest_derived(
derivation: derive_harness_manifest_in_place(
crate_dir: out_dir,
target: ProbeLibTarget,
linkage: SeedLinked { root: root }
)
)
let channel = Filesystem.Read(path: concat(root, "/rust-toolchain.toml"))
let channel_pin = if channel.success {
Filesystem.Write(path: concat(out_dir, "/rust-toolchain.toml"), content: channel.content).success
} else {
false
}
let scaffold_incomplete = !manifest.success || !channel_pin
let scaffold_incomplete = !manifest || !channel_pin
if scaffold_incomplete {
EmissionCargoUnreached {
subject: subject,
stage: StageManifest,
cause: concat("could not write the probe crate manifest and toolchain channel pin under ", out_dir),
cause: concat("could not derive the probe crate manifest from the emitted Cargo.toml, or write the toolchain channel pin, under ", out_dir),
emit_diagnostics: emit_diagnostics,
emitted_files: emitted_files
}
Expand Down Expand Up @@ -793,10 +799,12 @@ fn measure_entry_emission(entry: String) -> EmissionMeasurement {
//
// That transport stages a SOURCE ROOT, and entry-admission refuses an entry outside the workspace
// root; this function stages an OUTPUT CRATE, and cargo refuses a package inside a workspace it is
// not a member of. The probe manifest cssl_v1_compiled_probe_lib_cargo_toml deliberately carries no
// [workspace] table, so under target/ cargo stops with "current package believes it's in a
// workspace when it's not" and exits before compiling anything. Measured on 2026-09-04 while taking
// the first cargo reading of the src/v2/compiler/00_compile.dag closure.
// not a member of. The hand-authored probe manifest this route used on 2026-09-04
// carried no [workspace] table, so under target/ cargo stopped with "current package believes it's
// in a workspace when it's not" and exited before compiling anything (measured while taking the
// first cargo reading of the src/v2/compiler/00_compile.dag closure). The manifest is now derived
// from the emitted one (tools.emitted_crate_harness_manifest), which does carry [workspace]; the
// output crate still stages outside the repository.
//
// The reason it costs more than the ten minutes it costs: cargo's refusal arrives with zero
// compiler messages, which is the same surface an emission that produced nothing would present, so
Expand Down Expand Up @@ -1040,7 +1048,7 @@ fn emission_report_text(m: EmissionMeasurement) -> String {
// --arg entry=dag/extdeps/cpu/ampere.dag --arg report=/tmp/board.tsv
//
// The report is WRITTEN rather than returned because `gunbc run` maps a returned value to an exit
// status and has no value-printing verb; the same wall tools.self_host_curated_probe_cargo records.
// status and has no value-printing verb; the #8286 wall.
// The typed measurement is what measure_entry_emission returns -- this wrapper only renders it.
//
// THE EXIT STATUS REPORTS THE INSTRUMENT, NOT THE SUBJECT. A completed measurement exits zero even
Expand Down
121 changes: 121 additions & 0 deletions dag/gunbc/instruments/emitted_crate_harness_manifest.dag
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
module tools.emitted_crate_harness_manifest

import std.logic { Bool }
import extdeps.filesystem.filesystem_io { Filesystem }
import v2.std.text { String }

// A HARNESS MANIFEST IS THE EMITTED MANIFEST PLUS WHAT THE HARNESS ITSELF ADDS, AND NOTHING ELSE.
//
// The emitter writes Cargo.toml into the crate directory from the dependency demand of what it
// emitted (v1.compiler.emit_rust emit_cargo_toml over EmittedCrateDependencyDemand). Every harness
// that then builds that crate used to OVERWRITE the file with its own literal [dependencies]
// roster, so one question -- what does this emitted crate link -- had one answer per harness, and
// a dependency the emitted runtime gained reached a harness only when someone remembered to copy
// it there. That is gunbc.recurring_failure_mode probe_manifest_overwrites_emitted_dependency_demand,
// and this module is its repair on the .dag harness routes: no function here names a registry
// crate, so there is no roster left to forget.
//
// WHY APPEND AND NOT PARSE. Each thing a harness adds is its own TOML table -- the [lib] name its
// driver addresses, the [[bin]] target it runs, the seed path dependency as the subtable
// [dependencies.v1-compiler] -- and a table header is position-independent, so the overlay is
// correct wherever the emitter put its own tables and needs no reader of the emitted text. If the
// emitter ever declares one of these tables itself, cargo refuses the duplicate by name; the
// harness cannot silently win.
type HarnessCrateTarget = WitnessBinTarget | ProbeLibTarget

type HarnessSeedLinkage
= SeedLinked { root: String }
| SeedAbsent

type HarnessManifestDerivation
= HarnessManifestDerived { content: String }
| EmittedManifestUnreadable { path: String }
| HarnessManifestWriteFailed { path: String }

// The emitted package is named by the emission (v1_compiled, or v1_compiler for a pipeline entry);
// witness drivers address the library as v1_compiled either way, so the library name is pinned
// here and the package table is left exactly as emitted.
fn harness_lib_target_table() -> String {
"\n[lib]\nname = \"v1_compiled\"\npath = \"src/lib.rs\"\n"
}

fn harness_crate_target_tables(target: HarnessCrateTarget) -> String {
match target {
WitnessBinTarget => concat(harness_lib_target_table(), "\n[[bin]]\nname = \"witness\"\npath = \"src/main.rs\"\n")
ProbeLibTarget => harness_lib_target_table()
}
}

// The one dependency a harness owns: the seed crate a seed-linked receipt compares against. It is a
// fact about the harness and not about the emitted program, which is why it is not in the emitted
// manifest and is the only dependency spelled on this route. SeedAbsent adds nothing, so a
// seed-unavailable build cannot link the seed because no table names it.
fn harness_seed_link_dependency_table(linkage: HarnessSeedLinkage) -> String {
match linkage {
SeedLinked { root: root } => concat("\n[dependencies.v1-compiler]\npath = \"", concat(root, "/src/v1/stage0\"\n"))
SeedAbsent => ""
}
}

fn harness_manifest_over_emitted(emitted: String, target: HarnessCrateTarget, linkage: HarnessSeedLinkage) -> String {
concat(
emitted,
concat(
harness_crate_target_tables(target: target),
harness_seed_link_dependency_table(linkage: linkage)
)
)
}

// THE DECISION, SEPARATE FROM THE READ THAT FEEDS IT. Whether a harness manifest exists is decided
// from what the read returned, so a claim can supply that reading instead of performing it. An
// unread or empty emitted manifest REFUSES: there is no fallback roster to write in its place, so
// a crate the emitter did not describe is not built under a description the harness made up.
type HarnessManifestPlan
= HarnessManifestPlanned { content: String }
| EmittedManifestNotUsable

fn plan_harness_manifest(
read_succeeded: Bool,
emitted: String,
target: HarnessCrateTarget,
linkage: HarnessSeedLinkage
) -> HarnessManifestPlan {
if !read_succeeded || emitted == "" {
EmittedManifestNotUsable
} else {
HarnessManifestPlanned {
content: harness_manifest_over_emitted(emitted: emitted, target: target, linkage: linkage)
}
}
}

// Reads the manifest the emission wrote into crate_dir and replaces it with the planned one. The
// write exists only on the planned arm, so a refusal leaves the directory as the emission left it.
fn derive_harness_manifest_in_place(
crate_dir: String,
target: HarnessCrateTarget,
linkage: HarnessSeedLinkage
) -> HarnessManifestDerivation {
let path = concat(crate_dir, "/Cargo.toml")
let emitted = Filesystem.Read(path: path)
match plan_harness_manifest(read_succeeded: emitted.success, emitted: emitted.content, target: target, linkage: linkage) {
EmittedManifestNotUsable => EmittedManifestUnreadable { path: path }
HarnessManifestPlanned { content: content } => {
let written = Filesystem.Write(path: path, content: content)
if written.success {
HarnessManifestDerived { content: content }
} else {
HarnessManifestWriteFailed { path: path }
}
}
}
}

fn harness_manifest_derived(derivation: HarnessManifestDerivation) -> Bool {
match derivation {
HarnessManifestDerived { content: _ } => true
EmittedManifestUnreadable { path: _ } => false
HarnessManifestWriteFailed { path: _ } => false
}
}
35 changes: 0 additions & 35 deletions dag/gunbc/instruments/self_host_curated_probe_cargo.dag

This file was deleted.

Loading