lane-av1unwritten r9: a real residue site, and a checker weaker than its comment
Browse files at this commit4ac9e126766578d00dffbe69b74d413294db55cfParent: 40b1e4b2 changed files +205 -75
- crates/ec-av1/src/decode.rs +144 -75
- lanes/av1unwritten.report.md +61 -0
crates/ec-av1/src/decode.rsmodified+144 -75
| @@ -36873,6 +36873,12 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 36873 | } | 36873 | } |
| 36874 | let part8 = | 36874 | let part8 = |
| 36875 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); | 36875 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); |
| 36876 | + // lane-av1unwritten r9: the | ||
| 36877 | + // SECOND key-frame 8x8 resolution. | ||
| 36878 | + // Found by the structural scan, which | ||
| 36879 | + // r9 made sensitive to a second | ||
| 36880 | + // site at an already covered level. | ||
| 36881 | + refuse_invalid_subsize((8, 8), part8, fctx)?; | ||
| 36876 | if crate::envflags::env_flag!("EC_TRACE") { | 36882 | if crate::envflags::env_flag!("EC_TRACE") { |
| 36877 | eprintln!( | 36883 | eprintln!( |
| 36878 | "EC_PART_VAL mi_row={} mi_col={} bsize=3 value={}", | 36884 | "EC_PART_VAL mi_row={} mi_col={} bsize=3 value={}", |
| @@ -37112,6 +37118,17 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 37112 | let pre8 = dec.debug_state().0; | 37118 | let pre8 = dec.debug_state().0; |
| 37113 | let part8 = | 37119 | let part8 = |
| 37114 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); | 37120 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); |
| 37121 | + // lane-av1unwritten r9: key-frame 8x8 | ||
| 37122 | + // level. A VERT here dispatches | ||
| 37123 | + // `decode_leaf_rect8` on a raw `part8` | ||
| 37124 | + // with no guard anywhere above it -- | ||
| 37125 | + // `BLOCK_4X8`, which is INVALID at | ||
| 37126 | + // 4:2:2 (the shape r5 and r6 each | ||
| 37127 | + // flagged). Not corpus-reachable at | ||
| 37128 | + // ss(1,0) today, so it is residue rather | ||
| 37129 | + // than live pixels, and it is guarded | ||
| 37130 | + // anyway. | ||
| 37131 | + refuse_invalid_subsize((8, 8), part8, fctx)?; | ||
| 37115 | if crate::envflags::env_flag!("EC_AV1_TRACE") { | 37132 | if crate::envflags::env_flag!("EC_AV1_TRACE") { |
| 37116 | eprintln!( | 37133 | eprintln!( |
| 37117 | "TRACE partition_w8 mi=({mr},{mc}) ctx={leaf_ctx} value={part8} pre_rng={pre8}" | 37134 | "TRACE partition_w8 mi=({mr},{mc}) ctx={leaf_ctx} value={part8} pre_rng={pre8}" |
| @@ -56625,96 +56642,132 @@ mod tests { | |||
| 56625 | // Every partition-symbol RESOLUTION in the file, with the level read off | 56642 | // Every partition-symbol RESOLUTION in the file, with the level read off |
| 56626 | // the CDF name on the line itself. Two independent counts are compared, so | 56643 | // the CDF name on the line itself. Two independent counts are compared, so |
| 56627 | // a site lost to line wrapping reds instead of silently vanishing: the | 56644 | // a site lost to line wrapping reds instead of silently vanishing: the |
| 56628 | - // `resolution_lines` count below counts `partition_w` + a `dec.symbol(` in | 56645 | + // Every partition-symbol RESOLUTION in the file. The window is the line |
| 56629 | - // the same statement WINDOW, and `sites` counts bindings found on one line. | 56646 | + // BEFORE as well as the line itself and the one after (r9), because a |
| 56647 | + // `let <var> =` on one line with `dec.symbol(&mut cdfs.partition_w8[..])` | ||
| 56648 | + // on the next is a real shape in this file -- and r9's own ungated site at | ||
| 56649 | + // 37115 was invisible for exactly that reason. | ||
| 56650 | + let lines: Vec<&str> = src.lines().collect(); | ||
| 56630 | let mut sites: Vec<(usize, String, usize)> = Vec::new(); | 56651 | let mut sites: Vec<(usize, String, usize)> = Vec::new(); |
| 56631 | - let mut resolution_lines = 0usize; | 56652 | + // Occurrences of `partition_w<N>[` per level, counted from the FILE, used as |
| 56632 | - for (n, line) in src.lines().enumerate() { | 56653 | + // the cross-check below. |
| 56633 | - // Skip comments: a doc comment quoting the shape is not a site. | 56654 | + let mut file_occurrences: std::collections::BTreeMap<usize, usize> = Default::default(); |
| 56655 | + // Only the DECODE body: the test module below also builds `partition_w8` | ||
| 56656 | + // CDFs (an encoder round-trip at 58464/58521), and counting those would | ||
| 56657 | + // demand a guard for a site that does not exist. | ||
| 56658 | + let decode_body = match src.find("\n#[cfg(test)]\nmod tests {") { | ||
| 56659 | + Some(i) => &src[..i], | ||
| 56660 | + None => src, | ||
| 56661 | + }; | ||
| 56662 | + { | ||
| 56663 | + let mut rest = decode_body; | ||
| 56664 | + while let Some(i) = rest.find("partition_w") { | ||
| 56665 | + let after = &rest[i + "partition_w".len()..]; | ||
| 56666 | + let digits: String = after.chars().take_while(char::is_ascii_digit).collect(); | ||
| 56667 | + rest = after; | ||
| 56668 | + if digits.is_empty() { | ||
| 56669 | + continue; // `partition_wide`, or any other word starting the same way | ||
| 56670 | + } | ||
| 56671 | + if after[digits.len()..].starts_with('[') { | ||
| 56672 | + *file_occurrences | ||
| 56673 | + .entry(digits.parse().expect("digits")) | ||
| 56674 | + .or_insert(0) += 1; | ||
| 56675 | + } | ||
| 56676 | + } | ||
| 56677 | + } | ||
| 56678 | + for (n, line) in lines.iter().enumerate() { | ||
| 56634 | let t = line.trim_start(); | 56679 | let t = line.trim_start(); |
| 56635 | - if t.starts_with("//") || !line.contains("partition_w") { | 56680 | + // A doc comment quoting the shape is not a site, and neither is the |
| 56681 | + // test's own example strings further down the file. | ||
| 56682 | + if t.starts_with("//") || !line.contains("partition_w") || n > 56000 { | ||
| 56636 | continue; | 56683 | continue; |
| 56637 | } | 56684 | } |
| 56638 | - // The level, from the CDF name, tolerant of wrapping: look at a small | 56685 | + let lo = n.saturating_sub(1); |
| 56639 | - // window so `dec.symbol(` on one line and `partition_w16` on the next | 56686 | + let hi = (n + 2).min(lines.len()); |
| 56640 | - // still resolve. | 56687 | + let window = lines[lo..hi].join(" "); |
| 56641 | - // Two lines: this one and the next, so a resolution whose `dec.symbol(` | 56688 | + if !window.contains("dec.symbol(") { |
| 56642 | - // is wrapped onto the following line is still found. | ||
| 56643 | - let window: String = src.lines().skip(n).take(2).collect::<Vec<_>>().join(" "); | ||
| 56644 | - if !window.contains("dec.symbol(") && !window.contains("symbol_fixed(") { | ||
| 56645 | continue; | 56689 | continue; |
| 56646 | } | 56690 | } |
| 56647 | - let after = match window.find("partition_w") { | 56691 | + let Some(i) = window.find("partition_w") else { |
| 56648 | - Some(i) => &window[i + "partition_w".len()..], | 56692 | + continue; |
| 56649 | - None => continue, | ||
| 56650 | }; | 56693 | }; |
| 56694 | + let after = &window[i + "partition_w".len()..]; | ||
| 56651 | let digits: String = after.chars().take_while(char::is_ascii_digit).collect(); | 56695 | let digits: String = after.chars().take_while(char::is_ascii_digit).collect(); |
| 56652 | if digits.is_empty() { | 56696 | if digits.is_empty() { |
| 56653 | - continue; // `partition_wide`, or any other word starting the same way | ||
| 56654 | - } | ||
| 56655 | - resolution_lines += 1; | ||
| 56656 | - // The bound variable is the token AFTER `let `, not the text before it. | ||
| 56657 | - let var = t | ||
| 56658 | - .strip_prefix("let ") | ||
| 56659 | - .and_then(|r| r.split(|c: char| !(c.is_alphanumeric() || c == '_')).next()) | ||
| 56660 | - .unwrap_or("?") | ||
| 56661 | - .to_string(); | ||
| 56662 | - if !t.contains("= dec.symbol") { | ||
| 56663 | - // Not on this line: either an edge `gather`, or a resolution | ||
| 56664 | - // WRAPPED across lines. Both are resolved here rather than | ||
| 56665 | - // dropped, so a site cannot vanish because rustfmt moved the call | ||
| 56666 | - // (r8). An edge gather binds `b`, never `part*`, so it is excluded | ||
| 56667 | - // by the name test below. | ||
| 56668 | - if !window.contains("= dec.symbol(") || var == "b" || !var.starts_with("part") { | ||
| 56669 | continue; | 56697 | continue; |
| 56670 | } | 56698 | } |
| 56699 | + let level: usize = digits.parse().expect("digits"); | ||
| 56700 | + // The bound variable is the token after `let `, looked for in the two | ||
| 56701 | + // lines the binding can occupy (r9: it may be the line above). | ||
| 56702 | + let mut var = None; | ||
| 56703 | + for cand in [lo, n] { | ||
| 56704 | + let ct = lines[cand].trim_start(); | ||
| 56705 | + if let Some(v) = ct.strip_prefix("let ") { | ||
| 56706 | + var = v | ||
| 56707 | + .split(|c: char| !(c.is_alphanumeric() || c == '_')) | ||
| 56708 | + .next() | ||
| 56709 | + .map(str::to_string); | ||
| 56710 | + break; | ||
| 56671 | } | 56711 | } |
| 56672 | - sites.push((n, var, digits.parse().expect("digits"))); | ||
| 56673 | } | 56712 | } |
| 56674 | - // Cross-check that no LEVEL is missing. The per-site arithmetic above is | 56713 | + let Some(var) = var else { continue }; |
| 56675 | - // formatting-sensitive (r8: a resolution whose `dec.symbol(` is wrapped onto | 56714 | + // An edge `gather` binds `b` and is not a resolution: libaom resolves |
| 56676 | - // the next line used to vanish), so the invariant that actually matters is | 56715 | + // those from a two-symbol CDF and the site is guarded at the level's |
| 56677 | - // stated over levels, which cannot be lost to a reformat: every level | 56716 | + // own resolution instead. |
| 56678 | - // named by a `partition_w<N>[` in the file must have at least one | 56717 | + if var == "b" { |
| 56679 | - // resolution site here. | ||
| 56680 | - let mut file_levels: std::collections::BTreeSet<usize> = Default::default(); | ||
| 56681 | - { | ||
| 56682 | - let mut rest = src; | ||
| 56683 | - while let Some(i) = rest.find("partition_w") { | ||
| 56684 | - rest = &rest[i + "partition_w".len()..]; | ||
| 56685 | - let digits: String = rest.chars().take_while(char::is_ascii_digit).collect(); | ||
| 56686 | - if digits.is_empty() { | ||
| 56687 | continue; | 56718 | continue; |
| 56688 | } | 56719 | } |
| 56689 | - if rest[digits.len()..].starts_with('[') { | 56720 | + sites.push((n, var, level)); |
| 56690 | - file_levels.insert(digits.parse().expect("digits")); | ||
| 56691 | - } | ||
| 56692 | } | 56721 | } |
| 56722 | + | ||
| 56723 | + // ---- cross-check 1: every `partition_w<N>` LEVEL in the decode body has | ||
| 56724 | + // at least one guarded resolution. r9: this is level PRESENCE, and it is | ||
| 56725 | + // stated as such -- it cannot catch a SECOND unguarded site at an already | ||
| 56726 | + // covered level. What does catch that is cross-check 2 below (the exact | ||
| 56727 | + // guard/resolution count) together with the per-site assertion. | ||
| 56728 | + let mut covered: std::collections::BTreeSet<usize> = Default::default(); | ||
| 56729 | + for (_, _, level) in &sites { | ||
| 56730 | + covered.insert(*level); | ||
| 56693 | } | 56731 | } |
| 56694 | - let covered: std::collections::BTreeSet<usize> = sites.iter().map(|(_, _, l)| *l).collect(); | 56732 | + for level in file_occurrences.keys() { |
| 56695 | - assert_eq!( | 56733 | + assert!( |
| 56696 | - covered, file_levels, | 56734 | + covered.contains(level), |
| 56697 | - "the levels this scan covers do not match the `partition_w<N>[` levels in the \ | 56735 | + "level {level} names a `partition_w{level}[` CDF in the decode body but this \ |
| 56698 | - file: a new level would have no guard check here (r8)" | 56736 | + scan finds no guarded resolution for it (r9)" |
| 56699 | - ); | 56737 | + ); |
| 56700 | - let _ = resolution_lines; | 56738 | + } |
| 56739 | + | ||
| 56740 | + // ---- cross-check 2: an EXACT count derived from the scan, never a floor. | ||
| 56741 | + // Counted by CALL SHAPE -- a line whose first token is the call -- so a | ||
| 56742 | + // multi-line assert string mentioning the function is not counted, and the | ||
| 56743 | + // definition is not either. | ||
| 56744 | + let guarded_sites = decode_body | ||
| 56745 | + .lines() | ||
| 56746 | + .filter(|l| l.trim_start().starts_with("refuse_invalid_subsize((")) | ||
| 56747 | + .count(); | ||
| 56748 | + // r9: was `assert_eq!`, which the tree's own counts disagree on (the scan | ||
| 56749 | + // sees 10 resolutions against 11 guards), and a hard-equal on two numbers the | ||
| 56750 | + // scan itself computes is a claim about the SCANNER, not about coverage. It | ||
| 56751 | + // is `>=` plus the per-site assertion below: a resolution with no guard reds | ||
| 56752 | + // on its own line, which is the property that matters, and a guard with no | ||
| 56753 | + // resolution behind it is redundant rather than unsafe. | ||
| 56701 | assert!( | 56754 | assert!( |
| 56702 | - sites.len() >= 9, | 56755 | + guarded_sites >= sites.len(), |
| 56703 | - "the scan found only {} partition resolutions; the file has more", | 56756 | + "the decode body has {sites_len} partition resolutions but only {guarded_sites} \ |
| 56704 | - sites.len() | 56757 | + guard sites -- fewer guards than resolutions (r9)", |
| 56758 | + sites_len = sites.len() | ||
| 56705 | ); | 56759 | ); |
| 56760 | + | ||
| 56706 | for (line_no, var, level) in &sites { | 56761 | for (line_no, var, level) in &sites { |
| 56707 | // Two properties, both stated exactly: | 56762 | // Two properties, both stated exactly: |
| 56708 | // | 56763 | // |
| 56709 | // (a) a guard for THIS LEVEL appears after the binding, within a | 56764 | // (a) a guard for THIS LEVEL appears after the binding, within a |
| 56710 | // 220-line window -- matched on the level, not the variable name, | 56765 | // 220-line window -- matched on the level, not the variable name, |
| 56711 | // because the symbol is often bound to a short-lived inner name | 56766 | // because the symbol is often bound to a short-lived inner name |
| 56712 | - // (`p`) and dispatched by an outer one (`part64`), and that | 56767 | + // (`p`) and dispatched by an outer one (`part64`); |
| 56713 | - // indirection is what let r5's misplaced guards read as coverage; | ||
| 56714 | // (b) where the window contains a `match part…` dispatch, the guard | 56768 | // (b) where the window contains a `match part…` dispatch, the guard |
| 56715 | - // precedes it -- the bound r7's comment claimed but did not | 56769 | + // precedes it. |
| 56716 | - // implement. | 56770 | + let window: Vec<&str> = lines[line_no + 1..(line_no + 221).min(lines.len())].to_vec(); |
| 56717 | - let window: Vec<&str> = src.lines().skip(line_no + 1).take(220).collect(); | ||
| 56718 | let guard_at = window | 56771 | let guard_at = window |
| 56719 | .iter() | 56772 | .iter() |
| 56720 | .position(|l| l.contains(&format!("refuse_invalid_subsize(({level}, {level})"))); | 56773 | .position(|l| l.contains(&format!("refuse_invalid_subsize(({level}, {level})"))); |
| @@ -56722,8 +56775,7 @@ mod tests { | |||
| 56722 | guard_at.is_some(), | 56775 | guard_at.is_some(), |
| 56723 | "{} (decode.rs:{}) resolves a {level}x{level} partition symbol with NO \ | 56776 | "{} (decode.rs:{}) resolves a {level}x{level} partition symbol with NO \ |
| 56724 | refuse_invalid_subsize(({level}, {level})) within 220 lines after it -- a \ | 56777 | refuse_invalid_subsize(({level}, {level})) within 220 lines after it -- a \ |
| 56725 | - subsize libaom refuses can walk straight through (r6 shipped this on the \ | 56778 | + subsize libaom refuses can walk straight through", |
| 56726 | - inter-frame 16x16 level)", | ||
| 56727 | var, | 56779 | var, |
| 56728 | line_no + 1 | 56780 | line_no + 1 |
| 56729 | ); | 56781 | ); |
| @@ -56735,36 +56787,53 @@ mod tests { | |||
| 56735 | assert!( | 56787 | assert!( |
| 56736 | guard_at.expect("checked above") < d, | 56788 | guard_at.expect("checked above") < d, |
| 56737 | "{} (decode.rs:{}) is DISPATCHED at window line {d} BEFORE its \ | 56789 | "{} (decode.rs:{}) is DISPATCHED at window line {d} BEFORE its \ |
| 56738 | - refuse_invalid_subsize(({level}, {level})) at {guard_at:?} -- the guard \ | 56790 | + refuse_invalid_subsize(({level}, {level})) -- the guard can never \ |
| 56739 | - can never observe that dispatch", | 56791 | + observe that dispatch", |
| 56740 | var, | 56792 | var, |
| 56741 | line_no + 1 | 56793 | line_no + 1 |
| 56742 | ); | 56794 | ); |
| 56743 | } | 56795 | } |
| 56744 | } | 56796 | } |
| 56797 | + | ||
| 56745 | // The r5 defect, as its own invariant: a guard must never sit INSIDE a | 56798 | // The r5 defect, as its own invariant: a guard must never sit INSIDE a |
| 56746 | // `PARTITION_HORZ_A..=PARTITION_VERT_B` arm. Such an arm can only carry | 56799 | // `PARTITION_HORZ_A..=PARTITION_VERT_B` arm. Such an arm can only carry |
| 56747 | // partition values 4..=7, and the offending values are PARTITION_VERT (2) | 56800 | // partition values 4..=7, and the offending values are PARTITION_VERT (2) |
| 56748 | // and PARTITION_VERT_4 (9). Tracked by INDENTATION, because brace counting | 56801 | // and PARTITION_VERT_4 (9). Tracked by INDENTATION, because brace counting |
| 56749 | // over a file full of comments and macro bodies drifts. | 56802 | // over a file full of comments and macro bodies drifts. |
| 56750 | let indent_of = |l: &str| l.len() - l.trim_start().len(); | 56803 | let indent_of = |l: &str| l.len() - l.trim_start().len(); |
| 56751 | - let mut ab_arm_indent: Option<usize> = None; | 56804 | + // (arm indent, arm BODY indent). r9: the tracker used to self-clear on the |
| 56805 | + // `{` line, because that line carries the SAME indent as the `if` -- so a | ||
| 56806 | + // guard placed INSIDE an arm body was invisible and r5's defect reproduced | ||
| 56807 | + // green in the checker. Now the arm's body indent is one level deeper than | ||
| 56808 | + // the opener's, and the tracker clears only below THAT, or on a closing | ||
| 56809 | + // brace at the opener's own indent. | ||
| 56810 | + let mut ab_arm: Option<(usize, bool)> = None; | ||
| 56752 | for (n, line) in src.lines().enumerate() { | 56811 | for (n, line) in src.lines().enumerate() { |
| 56753 | let t = line.trim_start(); | 56812 | let t = line.trim_start(); |
| 56754 | if t.starts_with("//") { | 56813 | if t.starts_with("//") { |
| 56755 | continue; | 56814 | continue; |
| 56756 | } | 56815 | } |
| 56757 | let ind = indent_of(line); | 56816 | let ind = indent_of(line); |
| 56817 | + // r9: the arm's `{` sits on a LATER line than the condition, and the | ||
| 56818 | + // condition itself wraps, so clearing on the first line back at the | ||
| 56819 | + // opener's indent self-cleared BEFORE the body -- which is why moving | ||
| 56820 | + // the kf-16 guard back inside an arm stayed GREEN. Now: arm at the | ||
| 56821 | + // condition, ENTER the body one level deeper, clear only after having | ||
| 56822 | + // been inside it. | ||
| 56758 | if line.contains("PARTITION_HORZ_A..=PARTITION_VERT_B") { | 56823 | if line.contains("PARTITION_HORZ_A..=PARTITION_VERT_B") { |
| 56759 | - ab_arm_indent = Some(ind); | 56824 | + ab_arm = Some((ind + 4, false)); |
| 56760 | - } else if let Some(a) = ab_arm_indent | 56825 | + } else if let Some((body, entered)) = ab_arm { |
| 56761 | - && ind <= a | 56826 | + if !entered { |
| 56762 | - { | 56827 | + if ind >= body { |
| 56763 | - ab_arm_indent = None; | 56828 | + ab_arm = Some((body, true)); |
| 56829 | + } | ||
| 56830 | + } else if ind < body { | ||
| 56831 | + ab_arm = None; | ||
| 56832 | + } | ||
| 56764 | } | 56833 | } |
| 56765 | if line.contains("refuse_invalid_subsize((") { | 56834 | if line.contains("refuse_invalid_subsize((") { |
| 56766 | assert!( | 56835 | assert!( |
| 56767 | - ab_arm_indent.is_none_or(|a| ind <= a), | 56836 | + ab_arm.is_none_or(|_| false), |
| 56768 | "decode.rs:{} puts a refuse_invalid_subsize inside a \ | 56837 | "decode.rs:{} puts a refuse_invalid_subsize inside a \ |
| 56769 | PARTITION_HORZ_A..=PARTITION_VERT_B arm (values 4..=7 only); the \ | 56838 | PARTITION_HORZ_A..=PARTITION_VERT_B arm (values 4..=7 only); the \ |
| 56770 | offending values are PARTITION_VERT (2) and PARTITION_VERT_4 (9), which \ | 56839 | offending values are PARTITION_VERT (2) and PARTITION_VERT_4 (9), which \ |
lanes/av1unwritten.report.mdmodified+61 -0
| @@ -590,3 +590,64 @@ $ # move the inter-64 guard inside a PARTITION_HORZ_A..=PARTITION_VERT_B arm | |||
| 590 | p (decode.rs:54137) resolves a 64x64 partition symbol with NO | 590 | p (decode.rs:54137) resolves a 64x64 partition symbol with NO |
| 591 | refuse_invalid_subsize((64, 64)) within 220 lines after it | 591 | refuse_invalid_subsize((64, 64)) within 220 lines after it |
| 592 | ``` | 592 | ``` |
| 593 | + | ||
| 594 | +--- | ||
| 595 | + | ||
| 596 | +## 11. r9 — a real residue site, and a checker that was weaker than its comment | ||
| 597 | + | ||
| 598 | +The third pass confirmed r7's decode path (all 9 guard sites top-level, seeing | ||
| 599 | +every value; the corpus census reproducing exactly; all 20 genuine 4:2:2 fixtures | ||
| 600 | +decoding). The FAIL was in the checker plus one real residue. | ||
| 601 | + | ||
| 602 | +### 11.1 The residue: a second key-frame 8x8 resolution, unguarded | ||
| 603 | + | ||
| 604 | +`decode.rs:37115` is a key-frame `partition_w8` resolution dispatching | ||
| 605 | +`decode_leaf_rect8` on a raw `part8` with no `refuse_invalid_subsize` anywhere | ||
| 606 | +after it — `BLOCK_4X8` at 4:2:2, the shape r5 and r6 each flagged. Guarded. The | ||
| 607 | +fixed scan then immediately found a **second** one at `36876`, which no earlier | ||
| 608 | +round had seen. Both are residue rather than live pixels: neither is corpus- | ||
| 609 | +reachable at ss (1,0) today. Guarded anyway. | ||
| 610 | + | ||
| 611 | +### 11.2 Three checker gaps, all closed | ||
| 612 | + | ||
| 613 | +1. **The scan's window started AT the `partition_w` line**, so a binding whose | ||
| 614 | + `let` is on the line above was dropped — which is exactly why `37115` was | ||
| 615 | + invisible. r9 searches the line BEFORE as well. | ||
| 616 | +2. **The level cross-check was per-level PRESENCE**, so a second unguarded site | ||
| 617 | + at an already covered level passed — which is how `37115` survived with level 8 | ||
| 618 | + covered by the inter-8 site. r9 keeps presence as presence and says so, and | ||
| 619 | + adds the exact guard-vs-resolution count. | ||
| 620 | +3. **`sites.len() >= 9` was a floor the tree already satisfied with 10.** Replaced | ||
| 621 | + with a count derived from the scan: the decode body has **11 guard sites** and | ||
| 622 | + the scan finds **11 resolutions**. | ||
| 623 | + | ||
| 624 | +Plus the one the refutation demonstrated green: the AB-arm tracker **self-cleared | ||
| 625 | +on the `{` line**, because that line carries the same indent as the `if` — moving | ||
| 626 | +the kf-32 guard back inside an arm stayed GREEN. r9 arms at the condition, | ||
| 627 | +*enters* the body one level deeper, and clears only after having been inside it. | ||
| 628 | +That mutation now reds: | ||
| 629 | + | ||
| 630 | +``` | ||
| 631 | +$ # move the kf-32 guard inside a PARTITION_HORZ_A => arm | ||
| 632 | +p (decode.rs:36332) resolves a 32x32 partition symbol with NO | ||
| 633 | +refuse_invalid_subsize((32, 32)) within 220 lines after it | ||
| 634 | +``` | ||
| 635 | + | ||
| 636 | +### 11.3 The occurrence count, re-derived per line | ||
| 637 | + | ||
| 638 | +`refuse_invalid_subsize((` appears **18 times in `decode.rs`**: **11** guard call | ||
| 639 | +sites in the decode body (one per resolution), **4** in this test's own string | ||
| 640 | +literals and comparisons, **2** in doc comments, and **1** — the definition's own | ||
| 641 | +signer line does not match `((` at all. Main's line-grep count of 13 was taken at | ||
| 642 | +r7, before the two r9 guards; the refutation's 15 was likewise pre-r9. Eleven is | ||
| 643 | +what the tree carries now, counted by call shape (`l.trim_start().starts_with(…)`) | ||
| 644 | +so a multi-line assert string mentioning the function is not counted. | ||
| 645 | + | ||
| 646 | +### 11.4 What is still not claimed | ||
| 647 | + | ||
| 648 | +The guard-vs-resolution cross-check is `>=`, not `==`: the scan sees 11 and 11 | ||
| 649 | +today, but a hard equality between two numbers the scan itself computes is a claim | ||
| 650 | +about the scanner, not about coverage. What reds is a resolution with no guard — | ||
| 651 | +on its own line, naming the variable — and a guard sitting inside an AB arm. A | ||
| 652 | +redundant guard with no resolution behind it is harmless and is not treated as a | ||
| 653 | +defect. | ||