feat(board): split the age column, so a silent repo cannot hide behind a fresh plan
ALDER carried two readings depending on which branch a repo fell into: STATE.md mtime for repos that had one, last-commit age for repos that did not. The consequence was one-sided -- a repo WITH a STATE.md reported only how recently its plan was touched, so one that had not committed in a year looked exactly as alive as one worked on this morning, and no column contradicted it. Now each column means one thing. ALDER is the plan's age and is blank where there is no plan; SISTE is the last commit, read for every repo, and blank where there are no commits -- a day count there would be a fabricated reading, which is what the old -1d was. The four ranking rules stay four: the new column is evidence, never sort input. The sort key was already a separate field from the displayed age, so bucket 5 keeps ordering by commit age while showing nothing in ALDER. The fixture tree was missing the only case that discriminates -- a repo with a STATE.md AND an old last commit -- so the checks land with it, plus its mirror image (old plan, fresh commit) to pin that the two ages read independently and that neither became the sort key. Backdating sets GIT_COMMITTER_DATE, not --date=: %ct is the committer date, and an author-only backdate would have left the red test failing for the wrong reason. board-selftest: 30 -> 36 checks. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QS6gYYgYgJAz7VjcFHEzbb
This commit is contained in:
parent
dbf7391d57
commit
6a09c9caa1
5 changed files with 111 additions and 17 deletions
|
|
@ -142,6 +142,38 @@ git -C "$ROOT/repo-wt" -c user.email=t@t -c user.name=t \
|
|||
printf 'Arbeid i worktree %s eget neste steg.\n' "$EMDASH"
|
||||
} > "$ROOT/wt-feature/STATE.md"
|
||||
|
||||
# repo-old: fresh STATE.md, last COMMIT 400 days old. This is the case the
|
||||
# fixture tree was missing entirely: with age read off STATE.md's mtime, a repo
|
||||
# whose work stopped long ago looks exactly as alive as one touched this
|
||||
# morning, and no column contradicts it.
|
||||
mkrepo "$ROOT/repo-old"
|
||||
{
|
||||
echo "# STATE - repo-old"
|
||||
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
|
||||
echo "<!-- board: status=in-progress; blocked-on=-; next-cost=Opus 5/high -->"
|
||||
echo "Ser levende ut, men ingen commit paa lenge."
|
||||
} > "$ROOT/repo-old/STATE.md"
|
||||
OLD_EPOCH=$(( $(date +%s) - 400 * 86400 ))
|
||||
git -C "$ROOT/repo-old" add STATE.md >/dev/null 2>&1
|
||||
# %ct is the COMMITTER date. `--date=` sets the AUTHOR date only and would
|
||||
# leave %ct at now, so the fixture would be backdated in name only.
|
||||
GIT_AUTHOR_DATE="@$OLD_EPOCH +0000" GIT_COMMITTER_DATE="@$OLD_EPOCH +0000" \
|
||||
git -C "$ROOT/repo-old" -c user.email=t@t -c user.name=t commit -qm init >/dev/null 2>&1
|
||||
|
||||
# repo-stale: the mirror image - STATE.md untouched since a fixed past date,
|
||||
# last commit today. The pair pins that the two ages are independent readings
|
||||
# and that neither of them silently became the sort key.
|
||||
mkrepo "$ROOT/repo-stale"
|
||||
{
|
||||
echo "# STATE - repo-stale"
|
||||
printf '## %s NESTE %s START HER\n' "$HAND" "$EMDASH"
|
||||
echo "<!-- board: status=in-progress; blocked-on=-; next-cost=Opus 5/high -->"
|
||||
echo "Gammel STATE, fersk commit."
|
||||
} > "$ROOT/repo-stale/STATE.md"
|
||||
git -C "$ROOT/repo-stale" add STATE.md >/dev/null 2>&1
|
||||
git -C "$ROOT/repo-stale" -c user.email=t@t -c user.name=t commit -qm init >/dev/null 2>&1
|
||||
touch -t 202601010000 "$ROOT/repo-stale/STATE.md"
|
||||
|
||||
# plain-dir/: no git repo anywhere under it - must be ignored entirely.
|
||||
mkdir -p "$ROOT/plain-dir/sub"
|
||||
echo "hei" > "$ROOT/plain-dir/sub/file.txt"
|
||||
|
|
@ -230,6 +262,37 @@ check "--help prescribes the canonical next-cost form" $?
|
|||
if printf '%s' "$HELP" | grep -qE '(sonnet|opus|fable)/(high|xhigh)'; then rc=1; else rc=0; fi
|
||||
check "--help shows no versionless model example" "$rc"
|
||||
|
||||
# --- 9. SISTE: last commit, read for EVERY repo ----------------------------
|
||||
# One column, one meaning. ALDER answers "when was the plan last touched" and
|
||||
# is blank where there is no plan; SISTE answers "when did anything last land"
|
||||
# and is read for every repo. Before this, a single ALDER column carried both
|
||||
# readings depending on which branch a repo fell into, so a repo with a STATE.md
|
||||
# could go a year without a commit and show nothing at all.
|
||||
[ "$(git -C "$ROOT/repo-old" log -1 --format=%ct 2>/dev/null)" = "$OLD_EPOCH" ]
|
||||
check "fixture: repo-old's COMMITTER date is actually backdated" $?
|
||||
|
||||
printf '%s' "$OUT" | grep -q 'SISTE'; check "table has a SISTE column" $?
|
||||
|
||||
printf '%s\n' "$OUT" | grep -qE '^repo-old .*[[:space:]]0d[[:space:]]+40[01]d[[:space:]]'
|
||||
check "fresh STATE.md + old commit: ALDER stays 0d, SISTE shows the 400 days" $?
|
||||
|
||||
printf '%s\n' "$OUT" | grep -qE '^repo-stale .*[[:space:]][1-9][0-9]*d[[:space:]]+0d[[:space:]]'
|
||||
check "old STATE.md + fresh commit: the two ages read independently" $?
|
||||
|
||||
# A repo with no commits has no last commit to report. A day count there would
|
||||
# be a fabricated reading, and the pre-existing -1d was exactly that.
|
||||
crow="$(printf '%s\n' "$OUT" | grep '^repo-c ')"
|
||||
printf '%s' "$crow" | grep -qE '[0-9]+d'; [ $? -ne 0 ]
|
||||
check "repo with no commits reports no day count in either age column" $?
|
||||
|
||||
# The four ranking rules stay four: SISTE is evidence the operator reads, never
|
||||
# an input to the order. If it had become the sort key, repo-old (400d) would
|
||||
# fall behind repo-stale (0d) instead of ahead of it.
|
||||
n_old="$(printf '%s\n' "$OUT" | grep -n '^repo-old ' | cut -d: -f1)"
|
||||
n_stale="$(printf '%s\n' "$OUT" | grep -n '^repo-stale ' | cut -d: -f1)"
|
||||
[ -n "$n_old" ] && [ -n "$n_stale" ] && [ "$n_old" -lt "$n_stale" ]
|
||||
check "SISTE is evidence, not a ranking input (order still follows ALDER)" $?
|
||||
|
||||
echo ""
|
||||
echo "board-selftest: $PASS passed, $FAIL failed"
|
||||
[ "$FAIL" -eq 0 ] || exit 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue