From 52e52541f9a400ec4af55befea92e489a0d8ee77 Mon Sep 17 00:00:00 2001 From: soul Date: Tue, 1 Dec 2026 02:17:01 +0100 Subject: [PATCH] Inventory grid: pipes get a round fillet, an edge ramp in canvas units and a refit (S16 worst rms .0855 to .0187, S32 .0431); look changes are compared without allocating Thermal: a quarter-circle fillet between perpendicular bars replaces the polynomial smooth union that chamfered T and + junctions at S16. NoticeLook compares fourteen floats in place, no array and no enumerator per Flush. Harness: LateLook changes every look field on a live grid under a Mask with no Resize and compares it with a grid built with the change. The Overlay capture's bound is 16, it adds a half-alpha regime and the mutation driver runs it (control, concave-bracket-dropped, alpha-multiply-dropped). Thermal atlas bound .075 and hull cell bound .132 by the margin rule; driver mutants look-notice-deleted and look-trimmed. Co-Authored-By: Claude Sonnet 5.5 --- .../Editor/InventoryGridOverlayCapture.cs | 13 ++- .../Editor/InventoryGridParityCapture.cs | 91 +++++++++++++++++-- Assets/Scripts/UI/Menu/InventoryGrid.cs | 47 +++++++--- Assets/Shaders/InventoryGrid.shader | 24 ++--- tests/mutation_tests_inventory_grid.py | 53 ++++++++++- 5 files changed, 186 insertions(+), 42 deletions(-) diff --git a/Assets/Scripts/Editor/InventoryGridOverlayCapture.cs b/Assets/Scripts/Editor/InventoryGridOverlayCapture.cs index 49896a63f..40fe15bbf 100644 --- a/Assets/Scripts/Editor/InventoryGridOverlayCapture.cs +++ b/Assets/Scripts/Editor/InventoryGridOverlayCapture.cs @@ -17,7 +17,8 @@ public static class InventoryGridOverlayCapture { private const string Pending = "InventoryGridOverlayCapture.pending"; private const string PngKey = "InventoryGridOverlayCapture.png"; - private const int Bound = 22; + // The parity harness's atlas bound (InventoryGridParityCapture.AtlasBound): sqrt(4 x 66). + private const int Bound = 16; public static void Run() { @@ -66,6 +67,7 @@ public static class InventoryGridOverlayCapture private IEnumerator Capture() { var failed = false; + var overallWorst = 0; var png = SessionState.GetString(PngKey, ""); var prefab = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/UI/Inventory.prefab"); var panel = prefab.GetComponentInChildren(true); @@ -83,7 +85,7 @@ public static class InventoryGridOverlayCapture yield return new WaitForEndOfFrame(); watchdog.Disarm(); } - foreach (var (name, size, multiplier) in new[] { ("S32m1", 32f, 1f), ("S16m1.5", 16f, 1.5f) }) + foreach (var (name, size, multiplier, alpha) in new[] { ("S32m1", 32f, 1f, 1f), ("S16m1.5", 16f, 1.5f, 1f), ("S32m1-halfalpha", 32f, 1f, .5f) }) { var canvasObject = new GameObject("Overlay canvas", typeof(RectTransform)); canvasObject.layer = LayerMask.NameToLayer("UI"); @@ -126,10 +128,10 @@ public static class InventoryGridOverlayCapture rect.sizeDelta = new Vector2(size, size); var node = cell.GetComponent(); node.Background.sprite = panel.NodeBackgroundTextures[masks[k] & 255]; - node.Background.color = bgColor; + node.Background.color = new Color(bgColor.r, bgColor.g, bgColor.b, bgColor.a * alpha); node.Icon.sprite = panel.NodeTextures[masks[k]]; node.Icon.pixelsPerUnitMultiplier = multiplier; - node.Icon.color = iconColor; + node.Icon.color = new Color(iconColor.r, iconColor.g, iconColor.b, iconColor.a * alpha); } yield return null; watchdog.Arm("end of frame, sprite cells"); @@ -149,6 +151,7 @@ public static class InventoryGridOverlayCapture rect.sizeDelta = new Vector2(size, size); var grid = go.AddComponent(); grid.Shader = shader; + grid.color = new Color(1, 1, 1, alpha); grid.IconTexel = InventoryGrid.TexelOf(66f, multiplier); grid.BgTexel = InventoryGrid.TexelOf(100f, 1f); grid.Resize(1, 1, size, new RectOffset(), GridOrientation.LowerLeft); @@ -178,6 +181,7 @@ public static class InventoryGridOverlayCapture if (a[i].r + a[i].g + a[i].b > 30) lit++; } } + overallWorst = Mathf.Max(overallWorst, worst); Log($"overlay {name}: {masks.Count} masks, scale {scale:F3}, max8bitDiff={worst}, {lit} lit pixels in the sprite render"); if (lit == 0 || worst > Bound) { @@ -207,6 +211,7 @@ public static class InventoryGridOverlayCapture Destroy(canvasObject); yield return null; } + Log($"SUMMARY overlayWorst={overallWorst} bound={Bound}"); Log(failed ? "FAIL" : "PASS"); EditorApplication.Exit(failed ? 1 : 0); } diff --git a/Assets/Scripts/Editor/InventoryGridParityCapture.cs b/Assets/Scripts/Editor/InventoryGridParityCapture.cs index b27398471..753cd1ce0 100644 --- a/Assets/Scripts/Editor/InventoryGridParityCapture.cs +++ b/Assets/Scripts/Editor/InventoryGridParityCapture.cs @@ -27,12 +27,14 @@ public static class InventoryGridParityCapture // least claimed mutant's reading (66, alpha-multiply-dropped), sqrt(4 x 66) = 16.2, a separation of about 4 on each side. The other // mutants read 122 to 255. private static int AtlasBound = 16; - // The bound on a thermal mask's rms difference, 0..1 channel units, in the atlas and in every cell of the real hull's thermal state: the - // geometric mean of the shipped worst reading (0.0980, the hull's menu-size cells at 1920, which sit at half-pixel offsets the sprites blur - // across) and the pipe-width-minus mutant's (0.1474), a separation of 1.22 on each side. - private static double ThermalBound = 0.120; + // The bound on a thermal mask's rms difference, 0..1 channel units, in the atlas (the sprites at 1:1 and 2:1): the geometric mean of the + // shipped worst reading (0.0430, S32 mask 0) and the pipe-width-minus mutant's (0.1306), a separation of 1.74 on each side. The real hull's + // thermal cells have their own bound, ThermalHullBound, because they sit at half-pixel offsets the sprites blur across: shipped 0.1007, + // mutant 0.1731, geometric mean 0.132, a separation of 1.31. + private static double ThermalBound = 0.075; + private static double ThermalHullBound = 0.132; private static int _atlasWorst, _hullWorst, _maskedWorst, _alphaClipWorst; - private static double _thermalWorst; + private static double _thermalWorst, _thermalHullWorst; private static string _mutant = ""; private static string _pngOut; @@ -54,7 +56,7 @@ public static class InventoryGridParityCapture _pngOut = Arg("-pngOut"); _mutant = Arg("-mutant") ?? ""; if (Arg("-atlasBound") != null) AtlasBound = int.Parse(Arg("-atlasBound")); - if (Arg("-thermalBound") != null) ThermalBound = double.Parse(Arg("-thermalBound"), System.Globalization.CultureInfo.InvariantCulture); + if (Arg("-thermalBound") != null) ThermalHullBound = ThermalBound = double.Parse(Arg("-thermalBound"), System.Globalization.CultureInfo.InvariantCulture); if (_mutant != "" && !Mutants.Contains(_mutant)) throw new InvalidOperationException("Unknown mutant " + _mutant); if (_pngOut != null) Directory.CreateDirectory(_pngOut); Log("mutant=" + (_mutant == "" ? "none" : _mutant)); @@ -64,10 +66,11 @@ public static class InventoryGridParityCapture if (!hullOnly) Thermal(Array.IndexOf(args, "-fitThermal") >= 0); if (!hullOnly) Variants(); if (!hullOnly) Masked(); + if (!hullOnly) LateLook(); if (!hullOnly) AlphaAndClip(); if (Array.IndexOf(args, "-noHull") < 0) Hull(); - Log($"SUMMARY atlasWorst={_atlasWorst} hullWorst={_hullWorst} thermalWorstRms={_thermalWorst:F4} maskedWorst={_maskedWorst} alphaClipWorst={_alphaClipWorst} bounds atlas={AtlasBound} thermal={ThermalBound}"); + Log($"SUMMARY atlasWorst={_atlasWorst} hullWorst={_hullWorst} thermalWorstRms={_thermalWorst:F4} thermalHullRms={_thermalHullWorst:F4} maskedWorst={_maskedWorst} alphaClipWorst={_alphaClipWorst} bounds atlas={AtlasBound} thermal={ThermalBound} thermalHull={ThermalHullBound}"); if (Breaches.Count > 0) { foreach (var breach in Breaches) Log("BOUND BREACHED " + breach); @@ -407,6 +410,76 @@ public static class InventoryGridParityCapture } } + // A look field changed on a live grid, with no Resize and no other write, reaches the pixels at the next Flush. Every look field is changed + // in turn on a grid that has already been drawn through a stencil Mask; the result is compared in one render with a grid built with the + // change, and the change is asserted visible by comparing that grid with one built without it. + private static void LateLook() + { + using var rig = new Rig(1920); + var fields = new (string name, Action change, bool thermal)[] + { + ("RuleInset", g => g.RuleInset = 2.4f, false), ("RuleWidth", g => g.RuleWidth = 2f, false), + ("ArmTexels", g => g.ArmTexels = 2f, false), ("FillInset", g => g.FillInset = 2f, false), + ("Softness", g => g.Softness = 1.8f, false), ("RuleAlpha", g => g.RuleAlpha = .7f, false), + ("BracketAlpha", g => g.BracketAlpha = .5f, false), ("FillAlpha", g => g.FillAlpha = .6f, false), + ("BlobRadius", g => g.BlobRadius = .22f, true), ("PipeHalfWidth", g => g.PipeHalfWidth = .2f, true), + ("Fillet", g => g.Fillet = .3f, true), ("PipeSoft", g => g.PipeSoft = 6f, true), + ("IconTexel", g => g.IconTexel = 3f, false), ("BgTexel", g => g.BgTexel = 3f, false), + }; + void Configure(InventoryGrid grid, bool thermal) + { + grid.Thermal = thermal; + grid.Resize(4, 4, 64, new RectOffset(), GridOrientation.LowerLeft); + for (var y = 0; y < 4; y++) + for (var x = 0; x < 4; x++) + { + var record = SampleRecord(x * 37 + y * 101 + 9 + 256 * ((x + y) % 2), new Color(.9f, .5f, .2f), new Color(.1f, .2f, .5f, .9f)); + record.Conductivity = (byte) (x * 5 + y * 3 + 7); + grid.SetCell(new int2(x, y), record); + } + grid.Flush(); + } + InventoryGrid Place(float x, bool masked) + { + var side = NewObject("Place", rig.Page, x, 100, 500); + if (masked) + { + side.AddComponent(); + side.AddComponent().showMaskGraphic = false; + } + var grid = MakeGrid((RectTransform) side.transform, 20, 20, 300, 1f); + ((RectTransform) grid.transform).sizeDelta = new Vector2(300, 300); + return grid; + } + foreach (var (name, change, thermal) in fields) + { + ClearPage(rig); + var live = Place(100, true); + Configure(live, thermal); + rig.Render(); + change(live); + live.Flush(); + var changed = Place(800, false); + change(changed); + Configure(changed, thermal); + var unchanged = Place(1300, false); + Configure(unchanged, thermal); + var drawn = rig.Render(); + var worst = 0; + var visible = 0; + for (var y = 100; y < 600; y++) + for (var x = 100; x < 600; x++) + { + worst = Mathf.Max(worst, MaxDifference(drawn[y * rig.Width + x], drawn[y * rig.Width + x + 700])); + visible = Mathf.Max(visible, MaxDifference(drawn[y * rig.Width + x + 700], drawn[y * rig.Width + x + 1200])); + } + Log($"late look {name}: live grid against a grid built with the change = {worst}; the change moves the picture by {visible}"); + _maskedWorst = Math.Max(_maskedWorst, worst); + if (worst > 1) Breaches.Add($"late look {name}: {worst} > 1"); + if (visible < 8) Breaches.Add($"late look {name}: the change is not visible ({visible}), so the check proves nothing"); + } + } + // The vertex alpha (a CanvasGroup fade, the drag ghost's half alpha) and a RectMask2D clip, against the same two on the sprite cells. private static void AlphaAndClip() { @@ -1081,8 +1154,8 @@ public static class InventoryGridParityCapture Log($"hull thermal w={width} background layer max8bitDiff={worstBackground}"); _hullWorst = Math.Max(_hullWorst, worstBackground); if (worstBackground > AtlasBound) Breaches.Add($"hull thermal background w={width}: {worstBackground} > {AtlasBound}"); - _thermalWorst = Math.Max(_thermalWorst, worstRms); - if (worstRms > ThermalBound) Breaches.Add($"hull thermal w={width}: cell rms {worstRms:F4} > {ThermalBound}"); + _thermalHullWorst = Math.Max(_thermalHullWorst, worstRms); + if (worstRms > ThermalHullBound) Breaches.Add($"hull thermal w={width}: cell rms {worstRms:F4} > {ThermalHullBound}"); } // Hit-testing: CellAt returns the cell at every cell centre and nothing over an absent cell; empty cells pass clicks through. diff --git a/Assets/Scripts/UI/Menu/InventoryGrid.cs b/Assets/Scripts/UI/Menu/InventoryGrid.cs index 11a2ac503..9a1de090b 100644 --- a/Assets/Scripts/UI/Menu/InventoryGrid.cs +++ b/Assets/Scripts/UI/Menu/InventoryGrid.cs @@ -2,7 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -using System.Linq; using UnityEngine; using UnityEngine.UI; using int2 = CultMath.int2; @@ -34,8 +33,8 @@ public class InventoryGrid : MaskableGraphic, ILayoutElement, ICanvasRaycastFilt // Look, in texels of the sheet sprite; the shader's constants (IG-G). public float RuleInset = 1.5f, RuleWidth = 1f, ArmTexels = 1f, FillInset = 3f, Softness = 1f; public float RuleAlpha = .2f, BracketAlpha = 1f, FillAlpha = 13f / 255f; - // Thermal pipes as fractions of the cell, fitted to the 16 pipe sprites (IG-B4): bars of half width .127, a blob, and a fillet between each perpendicular pair. - public float BlobRadius = .1274f, PipeHalfWidth = .1252f, Fillet = .1557f, PipeSoft = .0429f; + // Thermal pipes as fractions of the cell, fitted to the 16 pipe sprites (IG-B4): bars, a blob, and a round fillet between each perpendicular pair; PipeSoft is the edge ramp in canvas units. + public float BlobRadius = .1272f, PipeHalfWidth = .1261f, Fillet = .1172f, PipeSoft = 1.212f; // One texel of the sheet sprite in canvas units, per layer. The icon sheet is 66 pixels per unit: 1.51515 at multiplier 1, // 1.01010 at 1.5. The background sheet is 100: 1 at multiplier 1. public float IconTexel = TexelOf(66f, 1f), BgTexel = TexelOf(100f, 1f); @@ -119,21 +118,43 @@ public class InventoryGrid : MaskableGraphic, ILayoutElement, ICanvasRaycastFilt private void LateUpdate() => Flush(); - // The look fields are plain public fields: a change reaches the material at the next Flush, which marks it dirty. - private float[] _lookSeen = new float[0]; + // The look fields are plain public fields: a change reaches the material at the next Flush, which marks it dirty. The comparison + // allocates nothing. + private const int LookCount = 14; + private readonly float[] _lookSeen = new float[LookCount]; - private float[] Look() => new[] + private float LookValue(int i) { - RuleInset, RuleWidth, ArmTexels, FillInset, Softness, RuleAlpha, BracketAlpha, FillAlpha, - BlobRadius, PipeHalfWidth, Fillet, PipeSoft, IconTexel, BgTexel - }; + switch (i) + { + case 0: return RuleInset; + case 1: return RuleWidth; + case 2: return ArmTexels; + case 3: return FillInset; + case 4: return Softness; + case 5: return RuleAlpha; + case 6: return BracketAlpha; + case 7: return FillAlpha; + case 8: return BlobRadius; + case 9: return PipeHalfWidth; + case 10: return Fillet; + case 11: return PipeSoft; + case 12: return IconTexel; + default: return BgTexel; + } + } private void NoticeLook() { - var look = Look(); - if (look.SequenceEqual(_lookSeen)) return; - _lookSeen = look; - SetMaterialDirty(); + var changed = false; + for (var i = 0; i < LookCount; i++) + { + var value = LookValue(i); + if (value == _lookSeen[i]) continue; + _lookSeen[i] = value; + changed = true; + } + if (changed) SetMaterialDirty(); } // The block of cells inside this rect as GridLayoutGroup places a middle-centre block with this padding. diff --git a/Assets/Shaders/InventoryGrid.shader b/Assets/Shaders/InventoryGrid.shader index 4fd03499e..a5fa3c34c 100644 --- a/Assets/Shaders/InventoryGrid.shader +++ b/Assets/Shaders/InventoryGrid.shader @@ -41,11 +41,11 @@ Shader "UI/Inventory Grid" _RuleAlpha ("Rule alpha", Float) = 0.2 _BracketAlpha ("Bracket alpha", Float) = 1 _FillAlpha ("Fill alpha", Float) = 0.050980392 - // Look of the thermal pipes, as fractions of the cell. - _BlobRadius ("Blob radius", Float) = 0.1274 - _PipeHalfWidth ("Pipe half width", Float) = 0.1252 - _Fillet ("Fillet", Float) = 0.1557 - _PipeSoft ("Pipe softness", Float) = 0.0429 + // Look of the thermal pipes: radii and half width as fractions of the cell, the edge ramp in canvas units. + _BlobRadius ("Blob radius", Float) = 0.1272 + _PipeHalfWidth ("Pipe half width", Float) = 0.1261 + _Fillet ("Fillet", Float) = 0.1172 + _PipeSoft ("Pipe softness", Float) = 1.212 } SubShader @@ -178,14 +178,16 @@ Shader "UI/Inventory Grid" return a; } - float SmoothMin(float a, float b, float k) + // A quarter-circle fillet of radius r where two distance fields meet at a concave corner (a round union). + float RoundUnion(float a, float b, float r) { - float h = saturate(0.5 + 0.5 * (b - a) / max(k, 1e-5)); - return lerp(b, a, h) - k * h * (1.0 - h); + float2 u = max(float2(r - a, r - b), 0.0); + return max(r, min(a, b)) - length(u); } // The pipes of the thermal view (IG-B4), in cell fractions: a blob and a bar from the centre to each conducting edge, as a - // plain union, with a fillet only between each perpendicular pair of bars (a smooth union everywhere put a bump on straight bars). + // plain union, with a round fillet only between each perpendicular pair of bars (a smooth union everywhere put a bump on straight bars and chamfered + // the inner corners). The edge ramp is PipeSoft canvas units wide whatever the cell size, as the sprites' one-pixel edge is. float Pipes(float2 p, uint cond) { float2 q = p / _CellSize - 0.5; @@ -203,9 +205,9 @@ Shader "UI/Inventory Grid" { int n = (c + 1) % 4; if (bars[c] < Far && bars[n] < Far && dot(q, dirs[c] + dirs[n]) > 0.0) - d = min(d, SmoothMin(bars[c], bars[n], _Fillet)); + d = min(d, RoundUnion(bars[c], bars[n], _Fillet)); } - return saturate(0.5 - d / _PipeSoft); + return saturate(0.5 - d * _CellSize / _PipeSoft); } fixed4 frag(v2f IN) : SV_Target diff --git a/tests/mutation_tests_inventory_grid.py b/tests/mutation_tests_inventory_grid.py index fbc48b6bc..5237cbcf3 100644 --- a/tests/mutation_tests_inventory_grid.py +++ b/tests/mutation_tests_inventory_grid.py @@ -47,6 +47,8 @@ MUTANTS = { "alpha-multiply-dropped": (None, (SHADER, "color *= IN.color.a;", "color *= 1.0;"), "atlas"), "clip-multiply-dropped": (None, (SHADER, "color *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);", "color *= 1.0;"), "atlas"), "modified-material-unpushed": (None, (GRID, "PushUniforms(drawn);", "// PushUniforms(drawn);"), "masked"), + "look-notice-deleted": (None, (GRID, " NoticeLook();", " // NoticeLook();"), "masked"), + "look-trimmed": (None, (GRID, "private const int LookCount = 14;", "private const int LookCount = 5;"), "masked"), } @@ -95,11 +97,32 @@ def run_harness(log: Path, extra: list[str]) -> tuple[int, str]: return code, log.read_text(encoding="utf-8", errors="replace") -def summary(text: str) -> tuple[int, int, float, int, int]: - m = re.search(r"SUMMARY atlasWorst=(\d+) hullWorst=(\d+) thermalWorstRms=([0-9.]+) maskedWorst=(\d+) alphaClipWorst=(\d+)", text) +# The Overlay capture (a ScreenSpaceOverlay canvas in play mode) must also see these shader mutants. +OVERLAY_MUTANTS = {"concave-bracket-dropped", "alpha-multiply-dropped"} + + +def run_overlay(log: Path) -> tuple[int, str]: + take_lock() + try: + proc = subprocess.Popen([UNITY_EXE, "-batchmode", "-projectPath", str(REPO_ROOT), "-executeMethod", + "InventoryGridOverlayCapture.Run", "-logFile", str(log)]) + (LOCK / "holder.txt").write_text(f"nibu-hands-invgrid-mutation {proc.pid}\n") + code = proc.wait(timeout=1500) + finally: + release_lock() + return code, log.read_text(encoding="utf-8", errors="replace") + + +def overlay_worst(text: str) -> int: + m = re.search(r"SUMMARY overlayWorst=(\d+)", text) + return int(m.group(1)) if m else -1 + + +def summary(text: str) -> tuple[int, int, float, int, int, float]: + m = re.search(r"SUMMARY atlasWorst=(\d+) hullWorst=(\d+) thermalWorstRms=([0-9.]+) thermalHullRms=([0-9.]+) maskedWorst=(\d+) alphaClipWorst=(\d+)", text) if not m: raise SystemExit("no SUMMARY line in the harness log") - return int(m.group(1)), int(m.group(2)), float(m.group(3)), int(m.group(4)), int(m.group(5)) + return int(m.group(1)), int(m.group(2)), float(m.group(3)), int(m.group(5)), int(m.group(6)), float(m.group(4)) def replace_unique(path: Path, anchor: str, mutated: str) -> str: @@ -115,6 +138,7 @@ def main() -> int: SCRATCH.mkdir(parents=True, exist_ok=True) failures: list[str] = [] readings: dict[str, tuple[int, float]] = {} + thermal_hull_readings: dict[str, float] = {} print("\n=== control: unmutated tree ===") code, text = run_harness(SCRATCH / "control.log", []) @@ -123,9 +147,14 @@ def main() -> int: print("control FAILED") else: print("control OK: exit 0, PASS") - atlas_c, hull_c, thermal_c, masked_c, alphaclip_c = summary(text) + atlas_c, hull_c, thermal_c, masked_c, alphaclip_c, thermal_hull_c = summary(text) shipped = max(atlas_c, hull_c, alphaclip_c) + code_o, text_o = run_overlay(SCRATCH / "overlay-control.log") + if code_o != 0 or "[InventoryGridOverlay] PASS" not in text_o: + failures.append("overlay control: expected exit 0 and PASS") + print(f"overlay control: exit {code_o}, worst {overlay_worst(text_o)} (bound 16)") bound_atlas = int(re.search(r"private static int AtlasBound = (\d+);", HARNESS.read_text(encoding="utf-8")).group(1)) + bound_thermal_hull = float(re.search(r"private static double ThermalHullBound = ([0-9.]+);", HARNESS.read_text(encoding="utf-8")).group(1)) bound_thermal = float(re.search(r"private static double ThermalBound = ([0-9.]+);", HARNESS.read_text(encoding="utf-8")).group(1)) print(f"shipped worst: {shipped} (atlas {atlas_c}, hull {hull_c}), thermal rms {thermal_c}; bounds {bound_atlas}, {bound_thermal}") @@ -137,9 +166,19 @@ def main() -> int: finally: if edit: edit[0].write_bytes(original.encode("utf-8")) - atlas_m, hull_m, thermal_m, masked_m, alphaclip_m = summary(text) + atlas_m, hull_m, thermal_m, masked_m, alphaclip_m, thermal_hull_m = summary(text) + thermal_hull_readings[name] = thermal_hull_m reading = {"atlas": max(atlas_m, hull_m, alphaclip_m), "thermal": thermal_m, "masked": masked_m}[kind] readings[name] = (kind, reading) + if name in OVERLAY_MUTANTS: + original_o = replace_unique(*edit[:1], edit[1], edit[2]) + try: + code_om, text_om = run_overlay(SCRATCH / f"overlay-{name}.log") + finally: + edit[0].write_bytes(original_o.encode("utf-8")) + print(f"{name} on the Overlay capture: exit {code_om}, worst {overlay_worst(text_om)}") + if code_om != 1 or "BOUND BREACHED" not in text_om: + failures.append(f"{name}: not killed by the Overlay capture (exit {code_om})") killed = code == 1 and "BOUND BREACHED" in text claimed = kind in ("thermal", "masked") or reading >= 1.2 * bound_atlas print(f"{name}: exit {code}, reading {reading} ({kind}), killed={killed}, claimed={claimed}") @@ -158,6 +197,10 @@ def main() -> int: print(f"thermal: shipped {thermal_c}, bound {bound_thermal}, mutant {thermal_least:.4f}, geometric mean {math.sqrt(thermal_c * thermal_least):.4f}") if bound_thermal < 1.2 * thermal_c or thermal_least < 1.2 * bound_thermal: failures.append("thermal bound is not separated by 1.2 on each side") + hull_least = thermal_hull_readings.get("pipe-width-minus") + print(f"thermal hull: shipped {thermal_hull_c}, bound {bound_thermal_hull}, mutant {hull_least}") + if hull_least is not None and (bound_thermal_hull < 1.2 * thermal_hull_c or hull_least < 1.2 * bound_thermal_hull): + failures.append("thermal hull bound is not separated by 1.2 on each side") for name, (kind, reading) in readings.items(): if kind == "atlas" and reading < 1.2 * bound_atlas: print(f"UNCLAIMED: {name} reads {reading}, under 1.2 x the bound {bound_atlas}")