MCPcopy Create free account
hub / github.com/base/base / load_expected

Method load_expected

acceptance/src/aggregate.rs:60–90  ·  view source on GitHub ↗

Loads and strictly validates an expected-run manifest.

(path: &Path)

Source from the content-addressed store, hash-verified

58
59 /// Loads and strictly validates an expected-run manifest.
60 pub fn load_expected(path: &Path) -> Result<ExpectedManifest> {
61 let expected: ExpectedManifest = serde_json::from_slice(&Self::bounded_read(path)?)
62 .wrap_err("parse expected manifest")?;
63 if expected.schema_version != 1
64 || expected.run_id.is_empty()
65 || expected.tested_sha.is_empty()
66 {
67 bail!("invalid expected manifest identity or schema");
68 }
69 if expected.scenarios.is_empty() || expected.scenarios.len() > 100 {
70 bail!("expected manifest must contain 1..=100 scenarios");
71 }
72 let mut scenario_ids = BTreeSet::new();
73 for scenario in &expected.scenarios {
74 Self::validate_id("scenario", &scenario.id)?;
75 if !scenario_ids.insert(&scenario.id) {
76 bail!("duplicate expected scenario id {}", scenario.id);
77 }
78 if scenario.checks.is_empty() || scenario.checks.len() > 1_000 {
79 bail!("scenario {} has an invalid check count", scenario.id);
80 }
81 let mut checks = BTreeSet::new();
82 for check in &scenario.checks {
83 Self::validate_id("check", check)?;
84 if !checks.insert(check) {
85 bail!("scenario {} has duplicate check {check}", scenario.id);
86 }
87 }
88 }
89 Ok(expected)
90 }
91
92 /// Aggregates result bundles and writes result.json, report.html, summary.md and evidence directly.
93 /// Invalid or missing manifests still produce an aggregate-error report.

Callers

nothing calls this directly

Calls 4

newFunction · 0.50
is_emptyMethod · 0.45
lenMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected