Repository navigation
test(gauntlet): pin stray-procs' set -e load path and its real ps call - #666
Conversation
Two gaps from PR #632's third review: - A set -e caller that finds strays while the load reader fails must still continue; dropping '|| load=""' now fails a row. - The real _sp_ps/_sp_load run against PATH shims: a ps that rejects unknown -o keywords (macOS has no etimes) and lists rows only for -U <uid>, and uptime in macOS and Linux formats. Mutating etime= to etimes=, -U to -A, or either load parse step fails a row.
|
Fresh-context review: FIX FIRST @ cce630f Two-axis review (mattpocock-skills:code-review). A separate subagent ran each axis against merge-base a14ec7e. Spec (MISSING=0 CREEP=0 WRONG=1)
Standards (HARD=1 JUDGEMENT=3)
Fix: the shim will print columns in the requested order, and without |
Review of cce630f (FIX FIRST): the shim checked -o keywords but always printed pid etime %cpu command, so reordering the columns or leaving out the -o list in stray-procs.sh stayed green though awk would then read the wrong fields on a real machine. The shim now emits columns in the requested order, and with no -o list prints the macOS default PID TTY TIME CMD columns under a header; both mutations fail a row. harness.sh is sourced at the top, house style, and an empty shim dir stops the test.
|
Fresh-context review: MERGE @ 5b80d35 Second two-axis review (mattpocock-skills:code-review). New subagents ran it against merge-base a14ec7e. Spec (MISSING=0 CREEP=0 WRONG=1). Both gaps are closed, confirmed by mutation on a
The one "wrong" item was the PR table's reorder count, which depends on the order chosen. It's now corrected in the body. Standards (HARD=0 JUDGEMENT=4). Clean on:
Judgement calls, none blocking:
Verdict: MERGE. No hard violation, and no spec gap in the code. |
Closes the two test gaps that the third fresh-context review of #632 left open. This PR is test-only:
scripts/_lib/stray-procs.shdoesn't change. Refs #158.Why
set -eload path:stray_procs_reportpromises it never returns non-zero. But the onlyset -erow covered theps-failure path, so dropping|| load=""left 21/21 green. Abash -ecaller that found strays while the load reader failed would then have exited 1.pscall: every row stubbed the private_sp_ps/_sp_load, so the realps -U <uid> -o pid=,etime=,%cpu=,command=never ran. Changingetime=toetimes=, which macOSpsdoesn't have, still passed.What
tests/scripts/test-gauntlet-stray-procs.shgets 4 more rows (21 to 25):bash -eccaller with strays and a failing_sp_loadreaches the next command.psshim: behaves like macOSpswherever the report depends on it. An unknown-okeyword is an error, and columns come out in the order-oasks for. With no-olist, it prints the defaultPID TTY TIME CMDcolumns under a header. It lists rows only for-U <your uid>. Checks that the real call feeds the report.uptimeshim: prints the macOS format (load averages: 3.21 2.00 1.00) and the Linux format (load average: 4.56, 2.00, 1.00). Checks that both parse.tests/_lib/harness.sh(fresh_tmpdir, with_cleanup_trashon EXIT).No version bump;
merge-pr.shdoes that at merge time.Verified
25/25 pass, and shellcheck (warning level) is clean.
Mutations of
stray-procs.sh: each of these 7 makes the suite fail. The last two came from the first review of this PR, and the lib was restored after each (git diffempty):|| load=""etime=→etimes=ps -U "$(id -u)"→ps -A-ocolumns reorderedetime=,pid=,…; 3 for orders that move%cpuorcommand, such aspid=,%cpu=,etime=,command=-olist left outaudit.shexits 0, and the pre-push gauntlet passed all layers oncce630fd.