|
19 | 19 | # FAULT a mark exists but cannot be read as evidence (no denominator on a pass that owes one) |
20 | 20 | # WAIVED the register says this one is out of scope, with a reason |
21 | 21 | # ADOPTED the project joined the pipeline above this obligation's stage |
22 | | -# NOT YET DUE a project/cluster row whose from-stage the register's Current stage has not reached |
| 22 | +# NOT YET DUE final-look only: gate-check's derived Current stage has not reached its from-stage |
23 | 23 | # N/A this project is not running the pipeline at all (a-la-carte; existing-app-assurance.md) |
24 | 24 |
|
25 | 25 | set -uo pipefail |
@@ -167,18 +167,23 @@ _ob_rank() { case "$1" in P|p) echo 0 ;; [0-7]) echo $(( $1 + 1 )) ;; *) echo 99 |
167 | 167 | # _ob_current_stage <register> → prints P or 0-7 from the register's "## Current stage" line, or |
168 | 168 | # nothing when it cannot be read (no section, or a hand-written line that names no stage). |
169 | 169 | # |
170 | | -# Why: the from-stage column was read only against --adopt, so a project/cluster row was owed |
171 | | -# from the day PROJECT.md existed. final-look (from-stage 6, the whole-app LOOK run LAST) read |
172 | | -# PENDING on a project still at Stage P — an obligation reported before it can be performed is |
173 | | -# noise, and noise teaches people to skip the obligation lines (review of #303, 2026-10-13). |
174 | | -# The readout is gate-check's own ("**Stage N — Title**, …", or "**All gates passed**"); the |
175 | | -# scaffold line init-project.sh writes ("**Stage P — Kickoff**") parses the same way. |
176 | | -# Unreadable → empty → the caller keeps the old behaviour (owed): "could not tell the stage" |
177 | | -# must never read as "not due yet". |
| 170 | +# Why: the from-stage column was read only against --adopt, so final-look (from-stage 6, the |
| 171 | +# whole-app LOOK run LAST) read PENDING on a project still at Stage P (review of #303). |
| 172 | +# |
| 173 | +# ONLY gate-check's own derived readout counts — a line containing "(derived by gate-check". |
| 174 | +# A hand-written line, and the scaffold line init-project.sh writes ("**Stage P — Kickoff**"), |
| 175 | +# read as unreadable → empty → owed. Field evidence (review of #321): hand-written lines |
| 176 | +# disagreed with the gates in 8 of 12 projects and gate-check never overwrites them; the |
| 177 | +# scaffold line often never advances because projects query `gate-check.sh . 5` directly. |
| 178 | +# "Could not tell the stage" must never read as "not due yet". |
178 | 179 | _ob_current_stage() { |
179 | 180 | local reg="$1" line |
180 | 181 | [ -f "$reg" ] || return 0 |
181 | 182 | line="$(awk '/^## Current stage/{f=1;next} f && /^## /{exit} f && /^\*\*/{print;exit}' "$reg" 2>/dev/null | tr -d '\r')" |
| 183 | + case "$line" in |
| 184 | + *"(derived by gate-check"*) ;; |
| 185 | + *) return 0 ;; |
| 186 | + esac |
182 | 187 | case "$line" in |
183 | 188 | "**All gates passed"*) printf '7'; return 0 ;; |
184 | 189 | esac |
@@ -270,22 +275,25 @@ _ob_has_denominator() { |
270 | 275 | # "Newest" is by COMMIT TIME, not by position (#155). A report kept as one dated file with an |
271 | 276 | # addendum per build row carries several stamps; whether the author appends addenda at the |
272 | 277 | # bottom or prepends them under the headline, the stamp that says the most recent thing is the |
273 | | -# one whose commit is newest. Unresolvable stamps are skipped; with none resolvable, the last |
274 | | -# stamp in the file is returned (and the callers then treat it as unmeasurable). |
| 278 | +# one whose commit is newest. If ANY stamp does not resolve here (history rewritten by a squash |
| 279 | +# or rebase, a shallow clone), the order of the stamps cannot be measured, so the last stamp in |
| 280 | +# the file is returned, as before: picking an older resolvable stamp instead would report STALE |
| 281 | +# on a report this checker cannot actually date (review of #321). |
275 | 282 | _ob_valid_at_stamps() { |
276 | 283 | tr -d '\r' < "$1" 2>/dev/null \ |
277 | 284 | | grep -oiE 'VALID[[:space:]]+AT:?[[:space:]]*[0-9a-f]{7,40}' \ |
278 | 285 | | grep -oiE '[0-9a-f]{7,40}$' |
279 | 286 | } |
280 | 287 | _ob_newest_stamp() { |
281 | | - local root="$1" hit="$2" h t best="" best_t=-1 last="" |
| 288 | + local root="$1" hit="$2" h t best="" best_t=-1 last="" unresolved=0 |
282 | 289 | while IFS= read -r h; do |
283 | 290 | [ -n "$h" ] || continue |
284 | 291 | last="$h" |
285 | 292 | t="$(git -C "$root" show -s --format=%ct "${h}^{commit}" 2>/dev/null || true)" |
286 | | - [ -n "$t" ] || continue |
| 293 | + if [ -z "$t" ]; then unresolved=1; continue; fi |
287 | 294 | if [ "$t" -ge "$best_t" ]; then best="$h"; best_t="$t"; fi |
288 | 295 | done <<< "$(_ob_valid_at_stamps "$hit")" |
| 296 | + [ "$unresolved" = 1 ] && best="" |
289 | 297 | printf '%s' "${best:-$last}" |
290 | 298 | } |
291 | 299 | _ob_stale() { |
@@ -452,10 +460,11 @@ mxtk_obligations_report() { |
452 | 460 | continue |
453 | 461 | fi |
454 | 462 |
|
455 | | - # Not yet due: a project/cluster row whose stage the register has not reached. Module rows |
456 | | - # are not touched — they are owed by a module being OPENED FOR WORK (_ob_modules), which is |
457 | | - # its own "due" test, and their verdicts stay exactly as before. |
458 | | - if [ "$scope" != "module" ] && [ "$(_ob_rank "$from_stage")" -gt "$current_rank" ]; then |
| 463 | + # Not yet due: final-look ONLY, the one row that by definition runs last. Every other row |
| 464 | + # keeps its verdict whatever the readout says — an early stale FAIL holds the derived |
| 465 | + # readout back while the build goes on, and a general rule would hide owed passes behind it |
| 466 | + # (review of #321). |
| 467 | + if [ "$ob" = "final-look" ] && [ "$(_ob_rank "$from_stage")" -gt "$current_rank" ]; then |
459 | 468 | printf 'Obligation %-10s NOT YET DUE — owed from stage %s; the register'"'"'s Current stage is %s (%s)\n' \ |
460 | 469 | "$ob" "$from_stage" "$current" "$skill" |
461 | 470 | continue |
|
0 commit comments