Repository navigation
fix: native_upgrade_converge.sh stops its cluster on exit (#1321) - #1322
Conversation
jdatcmd
left a comment
There was a problem hiding this comment.
Review of f51ca44. The fix is right, and I measured it: on PG17, native_upgrade_converge is 21/21 from this head, and the box had 5 stale /tmp/pgcolumnar-test servers and 3 workdirs before the run, and the same 5 and 3 after. A pre-fix run would have added one of each. The five leftovers are probably from earlier converge runs, mine or yours, before this fix. Part 620's detector design is good too: comments stripped, handlers resolved as commands or function bodies, a one-line handler stopping at its own line, and eight built suites driven before the population arm.
One thing blocks, the owner's twin rule: every test has a .sh twin and an independent pytest twin, and neither calls or imports the other. Part 620 is shell only. The precedent is #1286, where selftest parts 600 and 610 got test_capability_decline.py as their twin, written with pytest's own machinery and reading no shell harness.
For 620, a twin could parse each suite with its own Python reader:
- find the
trap ... EXITlines, resolve the handler, and requirepgc_on_exitorpgc_teardownin a suite that callspgc_setup; - drive the same eight constructed suites, each written by the test from its own strings;
- run the population arm over the real tree.
Same check names, so compare_to_bash can grade it if you add the pair. Cluster-free, so it goes in NO_CLUSTER with a TESTS.md section.
Everything else I'd approve as is.
From @jdatcmd's review of commandprompt#1322: the twin rule applies to selftest parts (precedent: parts 600/610 and test_capability_decline.py, commandprompt#1286). test_suite_exit_trap.py reads the suites and lib.sh as text with its own reader -- shlex for trap lines, the shell's own comment rule -- and drives the same eight suites, written from its own strings, before the population arm. Same five check names. Red on the tree before the fix, naming native_upgrade_converge.sh only; five mutations of its reader each redden the arms the part's matching mutation does. NO_CLUSTER; guard_tests 415 -> 419 by collection; TESTS.md section 97. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The twin is in at 1ec4fe6, one commit on top of f51ca44. Nothing else changed.
It writes the same eight suites from its own strings and drives them before the population arm. The five check names match the part's. Evidence
Not paired in TESTS.md 97 collides with #1319's 97. Whichever merges second renumbers. |
jdatcmd
left a comment
There was a problem hiding this comment.
Approved at 1ec4fe6. The twin is what the rule asks for: test_suite_exit_trap.py reads lib.sh and the suites as text with its own Python reader, with no subprocess, bash or shell helper.
Run here:
- on this head: the twin and the relevant
test_harness_depstests give 6 passed. - red on main, with the twin copied onto origin/main, where converge still has the bug:
no suite's own EXIT trap leaves its cluster running: got '[native_upgrade_converge.sh]' want '[]', and the three detector tests pass. It fails for exactly the right reason.
Together with my earlier measurement (5 stale servers before a converge run and 5 after), this is good to merge once CI is green.
|
For the record: my approval landed on 9df6615, pushed while I was testing 1ec4fe6. I've since read it. It's one entry in The PR is now DIRTY against main after #1319 merged, so CI hasn't run. Once you rebase, I'll compare each file's +/- lines against 9df6615 and merge when CI is green. |
|
Rebased onto 024e737 (after #1319). Head is now 12bec19, which replaces 9df6615.
|
9df6615 to
12bec19
Compare
From @jdatcmd's review of commandprompt#1322: the twin rule applies to selftest parts (precedent: parts 600/610 and test_capability_decline.py, commandprompt#1286). test_suite_exit_trap.py reads the suites and lib.sh as text with its own reader -- shlex for trap lines, the shell's own comment rule -- and drives the same eight suites, written from its own strings, before the population arm. Same five check names. Red on the tree before the fix, naming native_upgrade_converge.sh only; five mutations of its reader each redden the arms the part's matching mutation does. NO_CLUSTER; guard_tests 415 -> 419 by collection; TESTS.md section 97. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jdatcmd
left a comment
There was a problem hiding this comment.
Re-approved at 12bec19. I checked each file's +/- lines against 9df6615 myself (base b6656ac, versus 024e737 now). Everything is identical except check_ledger_budget.txt and TESTS.md, the two restatements you named. Merging when CI is green; #1311 also takes TESTS.md section 98, so whichever merges second renumbers.
|
@OffgridwithJD, I merged #1311 first; both were green and approved. This now needs one more rebase: TESTS.md section 99 and the budget restated. I'll re-approve by the per-file comparison as before. |
pgc_setup arms trap pgc_on_exit EXIT; native_upgrade_converge.sh replaces it with a trap that only restores its fixtures, so every run leaves its server running and its workdir in /tmp. Selftest part 620 reads every suite's text for an EXIT trap that reaches neither pgc_on_exit nor pgc_teardown, after driving the detector on eight suites written for it. Red on main, PG17: 1227 passed + 1 failed, the failure naming native_upgrade_converge.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndprompt#1321) pgc_setup arms trap pgc_on_exit EXIT; the suite's own trap cleanup EXIT replaced it, so every run left its PostgreSQL server listening and its workdir in /tmp, and a run that died lost commandprompt#1233's TERMINATED line. cleanup now calls pgc_on_exit first, so the wrapper reads the suite's status before anything overwrites it. Selftest part 620 is green with this: 1228/1228 on PG15-19. Driven on PG17: native_upgrade_converge 21/21, its workdir removed, no test server left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndprompt#1321) Clean: harness_selftest 1228/1228 on PG15-19. The population arm is dated by the run before the fix; the detector arms by five mutations of the detector. Census 1686 -> 1687; rows 2008; the gate agrees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From @jdatcmd's review of commandprompt#1322: the twin rule applies to selftest parts (precedent: parts 600/610 and test_capability_decline.py, commandprompt#1286). test_suite_exit_trap.py reads the suites and lib.sh as text with its own reader -- shlex for trap lines, the shell's own comment rule -- and drives the same eight suites, written from its own strings, before the population arm. Same five check names. Red on the tree before the fix, naming native_upgrade_converge.sh only; five mutations of its reader each redden the arms the part's matching mutation does. NO_CLUSTER; guard_tests 415 -> 419 by collection; TESTS.md section 97. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entory (commandprompt#1321) CI's cluster leg at 1ec4fe6: test_harness_deps found the twin reading the shell harness's text and not declared in SHELL_REFERENCES. It reads the suites and pgc_setup as data with its own reader, never sourcing or running them; the entry says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12bec19 to
c18d020
Compare
|
@jdatcmd I rebased onto f25863b (the #1311 merge). The head is now c18d020. Per-file patch identity against the head you approved (12bec19 on 024e737). Eight of the ten files are byte-identical. The other two:
Checked on the rebased tree:
#1311 touched no selftest part, so part 620 and its manifest line are as you approved them. |
|
Merging now: approved at c18d020, CI green. |
Fixes #1321.
native_upgrade_converge.shcalledpgc_setup, which armstrap pgc_on_exit EXIT, and then armed its owntrap cleanup EXIT. Bash keeps one EXIT trap, so every run, passing or failing, left its PostgreSQL server listening and/tmp/pgcolumnar-test.*behind, and a run that died lost #1233's TERMINATED line.Changes
cleanupcallspgc_on_exitfirst, so the wrapper reads the suite's exit status before anything overwrites$?.pgc_on_exitnorpgc_teardown, in a suite that callspgc_setup. Comments are stripped first. The handler is resolved as either a quoted command or a function body, and a one-line function stops at its own line, never running on into the next function's.EXIT INT TERM), one that names the teardown only in a comment, one where only the next function has it, three that chain correctly, and one with nopgc_setup.Evidence
native_upgrade_converge.shand nothing else.harness_selftest1228/1228 on each of PG15–19.native_upgrade_convergeis 21/21, its workdir is gone, no test server is left, and no fixture.pgcbakremains. Before the fix, each converge run left one server: four started within a second of a run's last log line (the fifth predates the logs I kept), and one once held aflocklong enough to stall a selftest.pgc_on_exit, and seesEXITonly at the end of the line.lib.sharrivesnever. The census goes 1686 → 1687 on 2008 rows, andgatepasses (rc=0).test_mutation_ledger.py39 passed; docs_style PASSED.The 17 suites that chain
pgc_teardownrather thanpgc_on_exitare left alone here; the question about them is on #1321.🤖 Generated with Claude Code