From cf6d583ef89655a5c909102d80990475574850ce Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sun, 15 Nov 2026 19:52:50 -0400 Subject: [PATCH] The ticket needs an arm, not just a column (rebuilt on main, which carries the bug) Main's copy still drops field 6 from the correlation (cut -f2,4,5), so every attribution record would lose the npu-hold ticket -- the one field engine#2542 exists to capture -- and no self-test arm would notice, because the fixture's ticket field was never asserted. Two changes: keep field 6, and assert ticket2 for the fault instant. Proved able to fail by reverting the cut and watching 'FAIL: the npu-hold ticket was dropped from the record'. Rebuilt on current main rather than rebasing: main gained this file after my branch was cut, so the rebase saw two additions of the same path (AA) and would have needed a manual merge of identical intent. --- tools/diag/accel_sampler.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/diag/accel_sampler.sh b/tools/diag/accel_sampler.sh index ab569071a..50ceae194 100755 --- a/tools/diag/accel_sampler.sh +++ b/tools/diag/accel_sampler.sh @@ -124,7 +124,7 @@ sample_once() { # one line per (moment, holder); "none" when nothing holds the } correlate() { # $1 lo $2 hi -> "pid:cmd:scope" for every sample in [lo,hi], deduplicated - awk -F'\t' -v lo="$1" -v hi="$2" '$1 >= lo && $1 <= hi' "$SAMP" 2>/dev/null | cut -f2,4,5 | sort -u | tr '\n' ';' + awk -F'\t' -v lo="$1" -v hi="$2" '$1 >= lo && $1 <= hi' "$SAMP" 2>/dev/null | cut -f2,4,5,6 | sort -u | tr '\n' ';' } selftest() { # prove the correlation before an event needs it: the window, the fields, and the miss case @@ -134,6 +134,10 @@ selftest() { # prove the correlation before an event needs it: the window, the SAMP=$d/samples.log out=$(correlate 1005 1015) # +-5 s around a fault at 1010 case "$out" in *222*) ;; *) echo "FAIL: the holder at the fault instant is missing"; fail=1 ;; esac + # The ticket is the field this whole issue is about: without it a record cannot say which hold was live. This arm exists + # because a refactor dropped exactly that field while every other arm stayed green (review of engine#2591); the fixture + # already carries ticket1/ticket2, so it needs no new data. + case "$out" in *ticket2*) ;; *) echo "FAIL: the npu-hold ticket was dropped from the record"; fail=1 ;; esac case "$out" in *111*) echo "FAIL: a sample outside the window was included"; fail=1 ;; esac out=$(correlate 2000 2010) [ -z "$out" ] || { echo "FAIL: a window with no samples produced '$out'"; fail=1; } @@ -147,7 +151,7 @@ selftest() { # prove the correlation before an event needs it: the window, the [ -f "$d/rot.log.1" ] || { echo "FAIL: rotation did not keep a previous file"; fail=1; } [ "$(stat -c %s "$d/rot.log")" -eq 0 ] || { echo "FAIL: the live file was not truncated"; fail=1; } rm -rf "$d" - [ "$fail" = 0 ] && echo "accel-sampler self-test: ok (window, fields, empty window, no-holder sample, rotation)" + [ "$fail" = 0 ] && echo "accel-sampler self-test: ok (window, fields+ticket, empty window, no-holder sample, rotation)" return "$fail" }