The design language that makes your AI harness better at design.
JavaScript
Let an accepted first viewport settle the code regions it lacks (#938)
Paul Bakaus8b91c4f7de13
diff --git a/crates/comp-verbs/src/build_phase.rs b/crates/comp-verbs/src/build_phase.rsindex 7ad4669ee..2ec18d2d1 100644--- a/crates/comp-verbs/src/build_phase.rs+++ b/crates/comp-verbs/src/build_phase.rs@@ -1665,10 +1665,15 @@ fn region_still_accepted(v: &Value) -> bool {/// Code regions (text, control, chrome) an accepted first-viewport review/// covers: the current capture still renders them as the approved one did.fn human_accepted_regions(human: Option<&Value>, regions: &[Value]) -> std::collections::HashSet<String> {- let reviewed = human.and_then(|h| h["comparison"]["regions"].as_array()).cloned().unwrap_or_default();+ let rendered = human_rendered_as_accepted(human);regions.iter().filter(|r| matches!(r["kind"].as_str(), Some("text" | "control" | "chrome")))- .filter(|r| reviewed.iter().any(|v| v["id"] == r["id"] && region_still_accepted(v)))- .filter_map(|r| r["id"].as_str().map(String::from)).collect()+ .filter_map(|r| r["id"].as_str().filter(|id| rendered.contains(*id)).map(String::from)).collect()+}++/// Regions of any kind the current capture still renders as the approved screenshot did.+fn human_rendered_as_accepted(human: Option<&Value>) -> std::collections::HashSet<String> {+ human.and_then(|h| h["comparison"]["regions"].as_array()).into_iter().flatten()+ .filter(|v| region_still_accepted(v)).filter_map(|v| v["id"].as_str().map(String::from)).collect()}#[allow(clippy::too_many_arguments)]@@ -1863,13 +1868,26 @@ fn gate_hero_inner(io: &Io, state: &mut Value, build_path: &str, min: f64, out_d}}}+ // A region the user's accepted first viewport lacks too (the approved screenshot+ // renders it as the current capture does) was seen and accepted without it.+ let viewport_accepted = human_accepted_viewport(human);+ let as_accepted = human_rendered_as_accepted(human);+ // Missing plates the accepted screenshot lacks too: worded as a question once the reasons are final.+ let mut plate_questions: Vec<(String, String)> = Vec::new();for id in &missing_ids {if let Some(r) = regions.iter().find(|r| r.get("id").and_then(Value::as_str) == Some(id.as_str())) {if r.get("verdict").and_then(Value::as_str) == Some("missing") {- push_region_blocker(&mut reasons, &mut region_reasons, id, format!(+ let message = format!("region {id} is missing (detail {}%, structure {}%): the comp shows material the build does not",pct0(rscore(r, "detail")), pct0(rscore(r, "structure"))- ));+ );+ // Code regions (text, control, chrome) carry: the user judged that drawing by eye.+ if waive(id, &format!("{message}; the first viewport the user accepted lacks it too, so the acceptance covers it"), &mut advisories) { continue; }+ // A produced plate must ship, so its absence stays material; when the accepted+ // screenshot already lacks it, restoring cannot clear it, so the user decides.+ let raster = matches!(r.get("kind").and_then(Value::as_str), Some("plate" | "image" | "texture"));+ if raster && viewport_accepted && as_accepted.contains(id) { plate_questions.push((id.clone(), message.clone())); }+ push_region_blocker(&mut reasons, &mut region_reasons, id, message);material.push(reasons.last().unwrap().clone());}}@@ -2111,7 +2129,6 @@ fn gate_hero_inner(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dlet region_dir = format!("{out_dir}/regions");// The user accepted this first viewport (the approved screenshot is the current// capture): the numeric fight is over. Every non-material reason becomes an advisory.- let viewport_accepted = human_accepted_viewport(human);if viewport_accepted {let (kept, numeric): (Vec<String>, Vec<String>) = reasons.into_iter().partition(|r| material.contains(r));reasons = kept;@@ -2131,9 +2148,26 @@ fn gate_hero_inner(io: &Io, state: &mut Value, build_path: &str, min: f64, out_dNone => advisories.insert(0, format!("(advisory) {lapse}")),}}+ // Restoring cannot clear a plate the accepted screenshot lacks too, so the user decides.+ // Force closes the whole gate, so it is offered only when nothing else blocks.+ if !plate_questions.is_empty() {+ let others = reasons.iter().filter(|r| !plate_questions.iter().any(|(_, m)| m == *r)).count();+ for (id, plain) in &plate_questions {+ let asked = if others == 0 {+ format!("{plain}. The first viewport the user accepted already lacks it, so restoring what they accepted cannot clear this. Stop iterating and ask the user: place the plate at its box (the page then no longer matches the accepted screenshot, and the readings apply again until it passes), or keep the first viewport without it. Keeping it downgrades the comp, so it takes their words saying so, quoted in {s} build-phase advance --force --reason (for example: the user said: \"the plate does not need to match\"); force refuses any other reason.")+ } else {+ format!("{plain}. The first viewport the user accepted already lacks it, so restoring what they accepted cannot clear this. Clear the other blocking reasons first: once this plate is all that blocks, ask the user whether to place it at its box or keep the first viewport without it; force closes the whole gate, so it is never the answer while anything else blocks.")+ };+ for r in reasons.iter_mut().filter(|r| *r == plain) { *r = asked.clone(); }+ for m in material.iter_mut().filter(|m| *m == plain) { *m = asked.clone(); }+ if let Some(rows) = region_reasons.get_mut(id).and_then(Value::as_array_mut) {+ for m in rows.iter_mut().filter(|m| m.as_str() == Some(plain.as_str())) { *m = json!(asked.clone()); }+ }+ }+ }if let Some(h) = human {report["humanHeroReview"] = json!({"proof": h["proof"], "comparison": h["comparison"], "acceptedRegions": waived, "viewportAccepted": viewport_accepted,- "scope": if viewport_accepted { "first viewport accepted: overall bar, palette and every numeric reading are advisories; material vetoes retained" } else { "contradicted readings on text, control and chrome regions; material vetoes retained" }});+ "scope": if viewport_accepted { "first viewport accepted: overall bar, palette and every numeric reading are advisories; text, control and chrome regions it renders as accepted carry, missing ones included; material vetoes retained" } else { "contradicted, missing and numeric readings on text, control and chrome regions that render as accepted; material vetoes retained" }});}let mut g = Gate::blank();g.ok = reasons.is_empty();@@ -2265,7 +2299,7 @@ fn hero_loop_verdict(state: &mut Value, gate: &Gate, artifact_path: &str, io: &I} else { "The hero gate has failed three attempts in a row." };if viewport_accepted {// The review is closed once accepted: asking for another would loop.- return Some(format!("{lead} The user already accepted a first viewport, and that review is closed. Restore what they accepted: while the capture matches the approved screenshot, the overall bar, the palette check and every numeric reading are advisories. Until then the readings below apply; a missing or unreferenced plate, an SVG illustration, an organic clip, a clipped plate, invented ink and failed rendered presence block either way."));+ return Some(format!("{lead} The user already accepted a first viewport, and that review is closed. Restore what they accepted: while the capture matches the approved screenshot, the overall bar, the palette check, every numeric reading and any text, control or chrome region the accepted screenshot also lacks are advisories. Until then the readings below apply; a missing or unreferenced plate, an SVG illustration, an organic clip, a clipped plate, invented ink and failed rendered presence block either way, and a plate the accepted screenshot itself lacks is a question for the user, which its reason spells out."));}return Some(format!("{lead} Stop iterating and present the first-viewport review (the assembled hero, stage hero, in component-review.md) so the user judges the page in context. An accepted review of this capture turns the overall bar, the palette check and every numeric reading into advisories; a missing or unreferenced plate, an SVG illustration, a clipped plate and invented ink still block. The blocking reasons below still apply."));}@@ -2471,11 +2505,18 @@ fn gate_responsive_inner(io: &Io, state: &mut Value, min: f64, out_dir: &str, napct0(overall), pct0(min)));}+ let mut accepted_ids: Vec<Value> = Vec::new();for (id, message) in missing_reasons {+ // A text, control or chrome region the accepted first viewport lacks too, and+ // that the desktop frame renders as that screenshot does, was accepted without it.+ if carried.contains(&id) {+ advisories.push(format!("(advisory, accepted in the first-viewport review) {message}; the first viewport the user accepted lacks it too, so the acceptance covers it"));+ accepted_ids.push(json!(id));+ continue;+ }push_region_blocker(&mut reasons, &mut region_reasons, &id, message);}let contradicted_direction: Vec<Value> = regions.iter().filter(|r| r.get("verdict").and_then(Value::as_str) == Some("contradicted") && matches!(r.get("kind").and_then(Value::as_str), Some("text" | "control"))).cloned().collect();- let mut accepted_ids: Vec<Value> = Vec::new();for r in &contradicted_direction {let id = r["id"].as_str().unwrap_or("");let message = format!("at desktop width, region {id} ({}) is contradicted (structure {}%)", r["kind"].as_str().unwrap_or(""), pct0(rscore(r, "structure")));diff --git a/crates/comp-verbs/src/build_phase/integrity_tests.rs b/crates/comp-verbs/src/build_phase/integrity_tests.rsindex 7b36af6a2..5ad518472 100644--- a/crates/comp-verbs/src/build_phase/integrity_tests.rs+++ b/crates/comp-verbs/src/build_phase/integrity_tests.rs@@ -1158,9 +1158,13 @@ fn text_only_hero(restyled: bool) -> Image {}fn run_text_only_hero(capture: &Image, approved: Option<&Image>) -> (Gate, Value) {+ run_text_only_hero_on(&text_only_hero(false), capture, approved)+}++fn run_text_only_hero_on(comp: &Image, capture: &Image, approved: Option<&Image>) -> (Gate, Value) {let ws = Workspace::new();let png = |i: &Image| png_io::encode_png(i, &[]).unwrap();- ws.write("comp.png", &png(&text_only_hero(false)));+ ws.write("comp.png", &png(comp));ws.write("index.html", b"<main><h1>Revenue</h1><button>Export</button></main>");let spec = json!({"comp":"comp.png","compSize":{"width":240,"height":160},"regions":[{"id":"headline","kind":"text","medium":"semantic","note":"striped headline lettering","type":{},@@ -1609,3 +1613,85 @@ fn review_next_says_ship_rechecks_and_a_later_edit_needs_ship_again() {let screenshots = next_instruction(&io, &json!({"phase":"review"}));assert!(screenshots.contains("ship refuses while the frontend files differ from the responsive screenshots"), "{screenshots}");}++/// The code-led first viewport with a lettered export control (`export`), or+/// with that control left out of the page.+fn lettered_text_only_hero(restyled: bool, export: bool) -> Image {+ let mut img = text_only_hero(restyled);+ if export {+ for x in (166..218).step_by(4) { r::fill_rect(&mut img, x as f64, 121., 2., 14., [240., 240., 240., 255.]); }+ } else {+ r::fill_rect(&mut img, 160., 116., 64., 24., [244., 244., 240., 255.]);+ }+ img+}++fn text_only_hero_without_export() -> Image { lettered_text_only_hero(true, false) }++#[test]+fn a_code_region_the_accepted_first_viewport_lacks_does_not_block_the_hero() {+ let comp = lettered_text_only_hero(false, true);+ let current = text_only_hero_without_export();+ let missing = |g: &Gate| g.reasons.iter().any(|r| r.contains("region export is missing"));+ // Unreviewed, the comp's control is missing and blocks.+ let (unreviewed, _) = run_text_only_hero_on(&comp, ¤t, None);+ assert!(missing(&unreviewed), "{:?}", unreviewed.reasons);+ // The user saw this first viewport without the control and accepted it: the phase closes.+ let (accepted, report) = run_text_only_hero_on(&comp, ¤t, Some(¤t));+ assert!(accepted.ok, "{:?}", accepted.reasons);+ assert!(accepted.advisories.iter().any(|a| a.starts_with("(advisory, accepted in the first-viewport review) region export is missing") && a.contains("the first viewport the user accepted lacks it too")), "{:?}", accepted.advisories);+ assert!(report["humanHeroReview"]["acceptedRegions"].as_array().unwrap().contains(&json!("export")), "{report}");+}++#[test]+fn a_code_region_removed_after_the_acceptance_still_blocks_the_hero() {+ // The user accepted the viewport with the control; the build dropped it afterwards.+ let (gate, report) = run_text_only_hero_on(&lettered_text_only_hero(false, true), &text_only_hero_without_export(), Some(&lettered_text_only_hero(true, true)));+ assert!(!gate.ok);+ assert!(gate.reasons.iter().any(|r| r.starts_with("region export is missing") && !r.contains("accepted")), "{:?}", gate.reasons);+ assert!(gate.reasons[0].starts_with("the hero capture no longer matches the first viewport the user accepted") && gate.reasons[0].contains("export"), "{:?}", gate.reasons);+ assert!(!gate.advisories.iter().any(|a| a.contains("region export is missing")), "{:?}", gate.advisories);+ assert_eq!(report["humanHeroReview"]["viewportAccepted"], false);+}++#[test]+fn a_plate_the_accepted_first_viewport_lacks_asks_the_user_instead_of_looping() {+ let blank = reviewed_hero(true, false);+ let (gate, _) = run_reviewed_hero(&blank, Some(&blank), REVIEWED_PAGE);+ assert!(!gate.ok);+ let reason = gate.reasons.iter().find(|r| r.starts_with("region art is missing")).expect("the plate still blocks");+ assert!(reason.contains("already lacks it, so restoring what they accepted cannot clear this") && reason.contains("ask the user") && reason.contains("build-phase advance --force --reason"), "{reason}");+ let example = reason.split("for example: ").nth(1).unwrap().split(')').next().unwrap();+ assert!(force_allowed(Some(example)), "{example}");+ // With another material veto outstanding, force would close that too: the question waits.+ let svg = format!("{REVIEWED_PAGE}<svg width=\"400\" height=\"300\" viewBox=\"0 0 400 300\">{}</svg>",+ (0..12).map(|i| format!("<path d=\"M{i} 0 C {} 40 80 {} 120 {i} S 200 90 240 {}\"/>", i * 7, i * 9, i * 11)).collect::<String>());+ let (gate, _) = run_reviewed_hero(&blank, Some(&blank), &svg);+ assert!(gate.reasons.iter().any(|r| r.contains("inline SVG")), "{:?}", gate.reasons);+ let reason = gate.reasons.iter().find(|r| r.starts_with("region art is missing")).expect("the plate still blocks");+ assert!(reason.contains("Clear the other blocking reasons first") && !reason.contains("--force --reason"), "{reason}");+ // Unreviewed, or removed after the acceptance, the plate blocks without the question.+ for approved in [None, Some(reviewed_hero(true, true))] {+ let (gate, _) = run_reviewed_hero(&blank, approved.as_ref(), REVIEWED_PAGE);+ let reason = gate.reasons.iter().find(|r| r.starts_with("region art is missing")).expect("the plate still blocks");+ assert!(!reason.contains("ask the user"), "{reason}");+ }+}++#[test]+fn a_code_region_the_accepted_first_viewport_lacks_carries_to_desktop_width() {+ let ws = reviewed_desktop_workspace();+ // The comp has the control; the accepted first viewport and the desktop frame do not.+ let current = reviewed_hero(false, false);+ let mut without = current.clone();+ r::fill_rect(&mut without, 120., 84., 60., 24., [230., 220., 200., 255.]);+ let (unreviewed, _) = run_reviewed_desktop(&ws, &without, None, 0.1);+ assert!(unreviewed.reasons.iter().any(|r| r.contains("region headline is missing")), "{:?}", unreviewed.reasons);+ let (accepted, report) = run_reviewed_desktop(&ws, &without, Some(&without), 0.1);+ assert!(accepted.ok, "{:?}", accepted.reasons);+ assert!(accepted.advisories.iter().any(|a| a.starts_with("(advisory, accepted in the first-viewport review) at desktop width, region headline is missing")), "{:?}", accepted.advisories);+ assert_eq!(report["humanTextReview"]["acceptedRegions"], json!(["headline"]));+ // Removed after the acceptance: it blocks again.+ let (removed, _) = run_reviewed_desktop(&ws, &without, Some(¤t), 0.1);+ assert!(removed.reasons.iter().any(|r| r == "at desktop width, region headline is missing"), "{:?}", removed.reasons);+}diff --git a/docs/CLI-CONTRACT.md b/docs/CLI-CONTRACT.mdindex 1ea8ad458..4103b3b0d 100644--- a/docs/CLI-CONTRACT.md+++ b/docs/CLI-CONTRACT.md@@ -1969,7 +1969,7 @@ Assembly acceptance closes component and assembly reviews for this journey. The### Human-reviewed text at the final comp gate-The hero gate uses the same evidence. When the native hero capture carries an approved first-viewport review, `build-phase` compares the approved screenshot with the current hero frame; a `text`, `control` or `chrome` region that still matches it (verdict match or drift, structure at least 75%) has its contradicted verdict, control drift and ink-box readings, and its type readings turned into advisories marked `accepted in the first-viewport review`. When the approved screenshot and the current hero frame agree as a whole (overall at least 95%, no region missing or contradicted), the user has accepted this first viewport: every non-material reason (the overall bar, the palette check, every numeric reading) becomes an advisory marked `first viewport accepted`, led by an advisory that says the user accepted it. Only material vetoes still block: missing or unreferenced plates, inline SVG illustrations, organic clips, clipped plates, invented ink, a wrong capture size, and the native rendered-presence checks. The hero report records `humanHeroReview` with the proof, that comparison, `acceptedRegions` and `viewportAccepted`. The responsive gate (and so the finish recheck) applies the same rule to its desktop comparison: with the accepted viewport still rendered at desktop width, the desktop score and contradicted regions are advisories and missing or displaced regions block. There the approved screenshot (captured at the comp's size) is resampled once, by the engine's area resize, to the desktop frame's own size and compared with the desktop capture at that size, so the capture under test is never resampled; the comparison is recorded as `humanTextReview.comparison` with `compSize` (the frame size) and `referenceSize` (the screenshot's own). The 95% bar holds at that scale, measured on a real accepted page (a proportional layout with one 16px type floor, its clock pinned): rendered at 1440 it scores 98.5% against its approved 1536 screenshot, at 1600 97.1%; at 1280, where the floor reflows the menu, 89.9%; the capture that stalled a run after a menu change and a clock change, 83.3%. Comparing the other way (the capture upscaled to the comp's width) scored the same faithful 1440 render 97.0% and a pure resample of the approved screenshot 96.4%, about one point of margin, which is why the frame-size comparison is used. A contradicted `text` or `control` region that still renders as accepted in that comparison (match or drift, structure at least 75%; the carry set covers `text`, `control` and `chrome` regions as at the hero, but a contradicted `chrome` region never blocks at desktop width, so only text and control acceptances show here) is an advisory marked `accepted in the first-viewport review`, and its id is listed in `humanTextReview.acceptedRegions`. When the current capture no longer matches the approved screenshot, the acceptance lapses: the gate says the hero (or desktop) capture no longer matches the first viewport the user accepted, names the regions that changed since the acceptance (those that no longer render as accepted, at most six and a count of the rest; when none does, the three furthest from it), and asks to restore what the user accepted, saying the readings apply until then. Under the overall bar this reason replaces the raw overall-bar reason; above it (and at the hero, whatever the other reasons are), it leads the other blocking reasons, or, when nothing else blocks, opens the advisories as `(advisory) the ... capture no longer matches ...`, so a lapsed acceptance is always said. It does not offer a new first-viewport review: once one is accepted the review store returns that session, so a new round cannot open. The raw score is kept as a `(measured)` advisory. After three consecutive failed hero attempts the refusal leads with an instruction to present the first-viewport review instead of iterating further; when a first viewport is already accepted (locally, or in a session the host names) it instead says the review is closed and asks to restore what the user accepted.+The hero gate uses the same evidence. When the native hero capture carries an approved first-viewport review, `build-phase` compares the approved screenshot with the current hero frame; a `text`, `control` or `chrome` region that still matches it (verdict match or drift, structure at least 75%) has its contradicted verdict, control drift and ink-box readings, its type readings and a `missing` verdict against the comp turned into advisories marked `accepted in the first-viewport review` (a missing one reads `region <id> is missing (...): the comp shows material the build does not; the first viewport the user accepted lacks it too, so the acceptance covers it`). The user judged that first viewport by eye without the region, so its absence is settled; a region the approved screenshot shows and the current capture lacks does not render as accepted and still blocks as missing, so a region removed after the acceptance blocks. When the approved screenshot and the current hero frame agree as a whole (overall at least 95%, no region missing or contradicted), the user has accepted this first viewport: every non-material reason (the overall bar, the palette check, every numeric reading) becomes an advisory marked `first viewport accepted`, led by an advisory that says the user accepted it. Only material vetoes still block: missing or unreferenced plates, inline SVG illustrations, organic clips, clipped plates, invented ink, a wrong capture size, and the native rendered-presence checks. A missing plate (or image or texture) region that the approved screenshot lacks too cannot be cleared by restoring what the user accepted, so its reason adds the question for the user: place the plate at its box (the page then no longer matches the accepted screenshot and the readings apply again), or keep the first viewport without it, which downgrades the comp and is recorded only by quoting their words in `advance --force --reason` (the reason gives an example `force` accepts). Force closes the whole gate, so the force route is offered only when nothing but such plates blocks; while any other reason blocks, the reason says to clear the others first and ask once the plate is all that blocks. Only `plate`, `image` and `texture` regions get this question; a missing `band` keeps the plain missing reason. The hero report records `humanHeroReview` with the proof, that comparison, `acceptedRegions` and `viewportAccepted`. The responsive gate (and so the finish recheck) applies the same rule to its desktop comparison: with the accepted viewport still rendered at desktop width, the desktop score and contradicted regions are advisories and missing or displaced regions block, except a `text`, `control` or `chrome` region that renders as accepted in the comparison below: the accepted first viewport lacks it too, so its missing or displaced reason becomes an advisory marked `accepted in the first-viewport review` ending `the first viewport the user accepted lacks it too, so the acceptance covers it`, and its id is listed in `humanTextReview.acceptedRegions`. There the approved screenshot (captured at the comp's size) is resampled once, by the engine's area resize, to the desktop frame's own size and compared with the desktop capture at that size, so the capture under test is never resampled; the comparison is recorded as `humanTextReview.comparison` with `compSize` (the frame size) and `referenceSize` (the screenshot's own). The 95% bar holds at that scale, measured on a real accepted page (a proportional layout with one 16px type floor, its clock pinned): rendered at 1440 it scores 98.5% against its approved 1536 screenshot, at 1600 97.1%; at 1280, where the floor reflows the menu, 89.9%; the capture that stalled a run after a menu change and a clock change, 83.3%. Comparing the other way (the capture upscaled to the comp's width) scored the same faithful 1440 render 97.0% and a pure resample of the approved screenshot 96.4%, about one point of margin, which is why the frame-size comparison is used. A contradicted `text` or `control` region that still renders as accepted in that comparison (match or drift, structure at least 75%; the carry set covers `text`, `control` and `chrome` regions as at the hero, but a contradicted `chrome` region never blocks at desktop width, so only text and control acceptances show here) is an advisory marked `accepted in the first-viewport review`, and its id is listed in `humanTextReview.acceptedRegions`. When the current capture no longer matches the approved screenshot, the acceptance lapses: the gate says the hero (or desktop) capture no longer matches the first viewport the user accepted, names the regions that changed since the acceptance (those that no longer render as accepted, at most six and a count of the rest; when none does, the three furthest from it), and asks to restore what the user accepted, saying the readings apply until then. Under the overall bar this reason replaces the raw overall-bar reason; above it (and at the hero, whatever the other reasons are), it leads the other blocking reasons, or, when nothing else blocks, opens the advisories as `(advisory) the ... capture no longer matches ...`, so a lapsed acceptance is always said. It does not offer a new first-viewport review: once one is accepted the review store returns that session, so a new round cannot open. The raw score is kept as a `(measured)` advisory. After three consecutive failed hero attempts the refusal leads with an instruction to present the first-viewport review instead of iterating further; when a first viewport is already accepted (locally, or in a session the host names) it instead says the review is closed and asks to restore what the user accepted, naming what stays advisory while the capture matches (including a text, control or chrome region the accepted screenshot also lacks) and that a plate the accepted screenshot itself lacks is a question for the user, spelled out in its reason.Native entry capture covers first viewports with no raster region. When the bound spec names no `raster` region (a code-led Operate screen, for example), the renderer has no artwork to intervene on, so it captures each frame (`hero`, or `desktop` and `mobile`) the way the assembled-page review captures the page it shows the user: pinned local scripts, verified network dependencies, the primary-font check, and two identical viewport screenshots. The page's inputs come from the same frozen snapshot that bound the spec and comp; nothing is read twice. What the page is served follows the review: when `.impeccable/review/hero.json` is a `hero` manifest with one page component whose preview is this entry, the page gets exactly that entry plus the component's declared `dependencies` (a declared path outside the static inventory is refused), so a file the review would not serve fails here as an undeclared dependency too. Before any review manifest names the entry, the page gets the static inventory (every static browser file outside hidden directories and `node_modules`). In both cases the bound spec and comp are never served. The capture is refused when the page requests the comp, or when a file the page loads is a byte copy of the comp or of the approved review screenshot, or is an HTML, CSS, JS or SVG file that inlines either as a base64 data URI (whitespace inside the URI is ignored). These checks run on the files the page actually loads under both policies, so a served file the page never loads (an unused backup of the comp, or one listed in the manifest's `dependencies`) does not block the capture. Byte checks cannot see a re-encoded copy, so the spec itself is the backstop: it declares every raster in the first viewport as a raster region, and this spec declares none. Each frame therefore measures the area images paint, as a union on a 4px grid (`img`, `video`, `input type=image`, SVG `image`, and any element or `::before`/`::after` painting a `url()` background, border, mask, list marker or generated content). Gradients and same-document fragment references (`url(#id)`, an SVG mask, pattern, gradient, clip path, filter, marker or symbol) are code and do not count, unless the definition they name holds raster content: an `image`, `feImage`, `img`, `video` or `input type=image` anywhere inside it, an `href` or `url()` that leaves the document, or a fragment reference to another definition that holds raster content. An `image` inside a definition has no rendered box, so the element that references such a definition counts instead: through `mask`/`mask-image`, `clip-path`, `fill` or `use` at its box (a `use` also through the `fill` and `stroke` it passes to its clones), through `stroke` at its box widened by half the stroke width on screen (the transform's largest scale, or the stroke's own width for `vector-effect: non-scaling-stroke`), through `filter` at the filter region (the whole viewport when a region length uses a unit other than plain numbers, `px` in user space or percentages in bounding-box units, and the outermost `svg` box for an element inside an `svg`), and through a marker at the outermost `svg` box. A `::before` or `::after` with such a filter also counts its filter region. A no-repeat background with an explicit pixel size counts at that size, any other at its box; `object-fit: contain` or `scale-down` counts the letterboxed picture, not the element box. Each box is clipped by the ancestors on its containing-block chain that clip (non-visible overflow, or `contain: paint`), so an absolutely positioned or fixed image is not clipped by a wrapper it escapes; an element that is hidden, or under an ancestor with opacity 0, paints nothing. The result is clipped to the viewport, and the capture is refused when images paint 15% or more of it. The refusal names the largest images and says the spec declares no raster region, so a large image contradicts it: declare it as a raster region or remove it and draw that area in code. 15% sits well above logos, avatars and icons (a 200x60 logo is about 1% of a 1440x900 viewport, twelve 40px avatars under 2%) and well below any image that could carry the comparison; the measurement is recorded per frame as `rasterCoverage` in `frameProofs`. The manifest's bytes are bound to the capture like its other inputs. The frames carry no region receipts, so no rendered-presence or placement check runs; the hero and responsive gates read the frames with the same comparison and region readings as any other capture. `inputs.json` (and `nativeCapture.inputs` in the report) records `"captureMethod": "assembled-page-viewport"`, `dependencyPolicy` (`hero-review-manifest` or `static-inventory`), `servedToPage`, the browser version, a `frameProofs` entry per frame and, with a manifest, `reviewManifestSha256`; the report's `nativeCapture.integrityScope` reads `assembled-page viewport from frozen inputs; the comp and approved screenshots are never served to the page; no raster presence or placement check (no raster region); existing visual scores unchanged` (the capture's own `inputs.integrityScope` adds that images cover under 15% of each frame), with no `framePolicy`. The review's other limits apply: a page with a `canvas`, `iframe`, `object` or `embed`, a running animation, an external dependency, or a missing primary font is refused with that reason. Because the gate's frame and the reviewed screenshot come from one capture method, an accepted first-viewport review of a code-only page binds to the current capture like any other and ends the numeric fight as described above. Specs with at least one raster region keep the raster capture unchanged.diff --git a/skill/reference/component-review.md b/skill/reference/component-review.mdindex 0ee3fcfb4..449629132 100644--- a/skill/reference/component-review.md+++ b/skill/reference/component-review.md@@ -58,6 +58,6 @@ Present a second manifest at `.impeccable/review/hero.json`. You write this one,The reference stays the approved comp. Call the same host review tool, or run `capture`, `serve` and `verify` with this manifest. Needs-work feedback starts another assembly round.-Acceptance closes human review for this build: never request plan, asset or assembly approval again. While the page renders what the user accepted, the hero score, the palette check and every numeric reading are advisories; material vetoes still hold (a missing or unreferenced plate, an SVG illustration, an organic clip, a clipped plate, invented ink, failed rendered presence). When the capture no longer matches the accepted screenshot, restore what the user accepted; until then the readings apply. Complete the rest of the page, responsive behavior, finish checks and documentation with the accepted first viewport as the visual direction. This is first-viewport calibration, not a claim that the user reviewed the rest of the page. Shared stylesheet edits do not reopen approval. Preserve the accepted direction; a later explicit user change is a new task.+Acceptance closes human review for this build: never request plan, asset or assembly approval again. While the page renders what the user accepted, the hero score, the palette check and every numeric reading are advisories; material vetoes still hold (a missing or unreferenced plate, an SVG illustration, an organic clip, a clipped plate, invented ink, failed rendered presence). A text, control or chrome region the accepted screenshot also lacks is settled by the acceptance; a plate it lacks is a question for the user that the gate's reason spells out: do not move off what they accepted on your own, but carry out their answer, including placing the plate. When the capture no longer matches the accepted screenshot, restore what the user accepted; until then the readings apply. Complete the rest of the page, responsive behavior, finish checks and documentation with the accepted first viewport as the visual direction. This is first-viewport calibration, not a claim that the user reviewed the rest of the page. Shared stylesheet edits do not reopen approval. Preserve the accepted direction; a later explicit user change is a new task.Assembled-page capture executes inline and declared local scripts from the pinned inputs. Network APIs, frames and workers are unavailable; the initial viewport must settle before capture. Keep the real page and declare its scripts rather than removing behavior to pass review.