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
36 changes: 36 additions & 0 deletions VERIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,42 @@ Outside `vv`:

Each gate below was made to fail by planting a defect, running the gate's command, recording the failure, and removing the defect. The observed lines are verbatim gate output (paths abbreviated to the repository root). `cargo xtask release-check` requires a `### <gate> can fail` record for every gate and audit named in `repo_model::release::GATES`.

### BS-15 render corpus materialization

Issue #457 changes only the construction of the two render vectors in
`crates/conformance/src/cases/bootstrap/rust_package.rs`. The previous code
encoded every full-library render, filtered the evaluator vector, then
replaced the large native inputs with their existing 4,096-byte prefixes.
The discarded full runs were inputs to neither differential. The direct
assembler retains the same order: accepted manifests, shaped inputs, then
seeded render mutants. At or below 16,384 bytes it uses the unchanged run and
expected files in both vectors; above that boundary it constructs only the
same native prefix and recipe outcome. The complete-library recipe assertion
against `package::package` in `accepted` is unchanged.

The construction change alters no corpus generation, seed, count, negative
fixture, planted defect, native comparison, certificate limit, export check,
host condition, timeout, or compiler-semantics input. On the original
`cf76090d` base, the native render vector contains 735 runs and the evaluator
vector 241; 494 full-library argument encodings that neither vector consumed
are no longer materialized. After accepted `BS-21` (#395, `c66f83d`) adds its
package, the same construction retains 737 native renders and 241 evaluator
renders, avoiding 496 unused full-library encodings. These are work-count
deductions, not measured CI speedups; the accepted member's corpus and count
changes are retained.

The library unit regression `render_corpora_preserve_inputs_and_outcomes`
compares both vectors with the previous assembler on both profiles, distinct
supplied package outcomes, recipe outcomes, and libraries of 0, 4,096,
16,383, 16,384, 16,385 and 32,768 bytes. Local validation in the authoring
environment passed whitespace checks and an independent assembly model:
24 evaluator and 36 native results were identical in order and bytes across
27 empty/mixed collection cases, and changes to the boundary, prefix and
supplied-outcome routing were detected. That model does not execute Rust or
the package renderer. Rust formatting, Clippy, the library regression and the
complete release gate were not run locally because the environment has no
Rust toolchain; they remain required acceptance evidence on the final tree.

### Intel host partition custody and complete evidence

The three non-Intel auxiliary host legs keep their existing locked,
Expand Down
183 changes: 144 additions & 39 deletions crates/conformance/src/cases/bootstrap/rust_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,37 @@ fn render_run(render: &Render, expected: Files) -> Run {
)
}

/// The ordered render corpora consumed by the evaluator and rustc.
fn render_corpora(
renders: &[(Render, Files)],
shaped: &[Render],
mutants: &[Render],
) -> (Vec<Run>, Vec<Run>) {
let mut within = Vec::new();
let mut compiled = Vec::new();
let inputs = renders
.iter()
.map(|(render, files)| (render, Some(files)))
.chain(shaped.iter().chain(mutants).map(|render| (render, None)));
for (render, files) in inputs {
if render.library.len() <= EVALUATOR_LIBRARY {
let expected = files.cloned().unwrap_or_else(|| files_of(render));
let run = render_run(render, expected);
within.push(run.clone());
compiled.push(run);
} else {
// rustc expands each argument byte into an array element, so
// the native corpus uses the existing 4,096-byte prefix. The
// full-library run feeds neither consumer; accepted() still
// holds its complete library to the package::package recipe.
let mut render = render.clone();
render.library.truncate(4_096);
compiled.push(render_run(&render, files_of(&render)));
}
}
(within, compiled)
}

/// A manifest the oracle accepts, what `renderPackage` is given for it, and
/// the two files `package::package` wrote.
fn accepted(manifest: &Manifest) -> Option<(Render, Files)> {
Expand Down Expand Up @@ -866,45 +897,7 @@ pub(super) fn case() {
}
render_mutants.push(render);
}
let render_runs: Vec<Run> = renders
.iter()
.map(|(render, files)| render_run(render, files.clone()))
.chain(
shaped
.iter()
.chain(&render_mutants)
.map(|render| render_run(render, files_of(render))),
)
.collect();
let within: Vec<Run> = renders
.iter()
.map(|(render, _)| render)
.chain(&shaped)
.chain(&render_mutants)
.zip(&render_runs)
.filter(|(render, _)| render.library.len() <= EVALUATOR_LIBRARY)
.map(|(_, run)| run.clone())
.collect();
// rustc compiles each byte of an argument as one array element, and the
// libraries of the committed packages are megabytes together, so a render
// whose library is beyond the evaluator's bound runs under rustc on the
// first 4,096 bytes of it, held to the recipe, which reads it only as
// bytes to digest.
let compiled: Vec<Run> = renders
.iter()
.map(|(render, _)| render)
.chain(&shaped)
.chain(&render_mutants)
.zip(&render_runs)
.map(|(render, run)| {
if render.library.len() <= EVALUATOR_LIBRARY {
return run.clone();
}
let mut render = render.clone();
render.library.truncate(4_096);
render_run(&render, files_of(&render))
})
.collect();
let (within, compiled) = render_corpora(&renders, &shaped, &render_mutants);
eprintln!(
"BS-15: {} manifests ({} accepted), {} and {} rule inputs, {} and {} mutants, {} renders under the evaluator ({:?})",
manifests.len(),
Expand Down Expand Up @@ -1029,3 +1022,115 @@ pub(super) fn case() {
}
eprintln!("BS-15: passed in {:?}", started.elapsed());
}

#[cfg(test)]
mod tests {
use super::*;

fn previous_corpora(
renders: &[(Render, Files)],
shaped: &[Render],
render_mutants: &[Render],
) -> (Vec<Run>, Vec<Run>) {
let render_runs: Vec<Run> = renders
.iter()
.map(|(render, files)| render_run(render, files.clone()))
.chain(
shaped
.iter()
.chain(render_mutants)
.map(|render| render_run(render, files_of(render))),
)
.collect();
let within: Vec<Run> = renders
.iter()
.map(|(render, _)| render)
.chain(shaped)
.chain(render_mutants)
.zip(&render_runs)
.filter(|(render, _)| render.library.len() <= EVALUATOR_LIBRARY)
.map(|(_, run)| run.clone())
.collect();
// rustc compiles each byte of an argument as one array element, and the
// libraries of the committed packages are megabytes together, so a render
// whose library is beyond the evaluator's bound runs under rustc on the
// first 4,096 bytes of it, held to the recipe, which reads it only as
// bytes to digest.
let compiled: Vec<Run> = renders
.iter()
.map(|(render, _)| render)
.chain(shaped)
.chain(render_mutants)
.zip(&render_runs)
.map(|(render, run)| {
if render.library.len() <= EVALUATOR_LIBRARY {
return run.clone();
}
let mut render = render.clone();
render.library.truncate(4_096);
render_run(&render, files_of(&render))
})
.collect();
(within, compiled)
}

#[test]
fn render_corpora_preserve_inputs_and_outcomes() {
let mut renders = Vec::new();
for std in [false, true] {
for length in [
0,
4_096,
EVALUATOR_LIBRARY - 1,
EVALUATOR_LIBRARY,
EVALUATOR_LIBRARY + 1,
EVALUATOR_LIBRARY * 2,
] {
let render = Render {
scaffold: scaffold::get().expect("the scaffold").clone(),
name: format!("render_{length}"),
version: "1.2.3".to_owned(),
std,
program: "f".repeat(64),
sources: vec!["a".repeat(64)],
effects: vec!["overflow".to_owned()],
exports: vec![("run".to_owned(), 0)],
library: (0u8..=255).cycle().take(length).collect(),
};
// Distinct supplied files catch replacing the package's
// expected outcome with the recipe for a small library.
let files = (
format!("package cargo: {std} {length}").into_bytes(),
format!("package provenance: {std} {length}").into_bytes(),
);
renders.push((render, files));
}
}
let shaped: Vec<Render> = renders
.iter()
.map(|(render, _)| {
let mut render = render.clone();
render.name = "a\"b\\c".to_owned();
render.scaffold.library = "A.rs".to_owned();
render
})
.collect();
let mutants: Vec<Render> = shaped
.iter()
.map(|render| {
let mut render = render.clone();
render.exports.reverse();
render.sources.clear();
render
})
.collect();
let expected = previous_corpora(&renders, &shaped, &mutants);
let observed = render_corpora(&renders, &shaped, &mutants);
assert_eq!(
observed, expected,
"both ordered vectors are byte-identical"
);
assert_eq!(observed.0.len(), 24, "both profiles include the boundary");
assert_eq!(observed.1.len(), 36, "rustc keeps every render");
}
}
Loading