1 Commits
Author SHA1 Message Date
cgalo5758 41993a2fe2 Refuse any argument but --rebuild in reset-app-db.sh and its neighbours
reset-app-db.sh read one argument, --rebuild, and ignored any other,
so a mistaken argument such as --help restored the application
database from the demo snapshot and flushed the session store.
teardown-stack.sh and reset-test-db.sh take no argument and ignored
any that was given; teardown-stack.sh then removes the stack's
containers and volumes and deletes test/.env, test/secrets/ and
test/testdata/, and reset-test-db.sh drops and recreates the test
databases. Each script now prints its usage line on stderr and exits 2
for an argument it does not take (for reset-app-db.sh, anything but a
single --rebuild), before it reads anything. No argument, and
--rebuild for reset-app-db.sh, behave as before.

TestScriptsRefuseUnknownArguments runs a copy of each script from a
temporary directory with no environment file beside it, with the
database, container and git commands replaced by stubs that record
their name and fail. It has 15 leaf subtests: 7 for reset-app-db.sh and
4 each for reset-test-db.sh and teardown-stack.sh. At the parent
the same test file fails on the 5 refusal rows of reset-app-db.sh and
the 3 of each neighbour (11 in all), each exiting 1 where 2 and the
usage line are wanted, and passes the 4 accepted rows. At the commit
all of them pass.

15 breaks, each caught by the new test (new side only; the test is new,
so it has no parent side). Not probed: the real scripts were not run
with an argument, since a script that accepted one would reset the
application database or delete the stack's keys; and the real
reset-app-db.sh and teardown-stack.sh were not run with no argument or
--rebuild after the change, for the same reason. The accepted path
past the environment-file check is shown only by the copies stopping
at the missing file (for reset-app-db.sh and reset-test-db.sh) or at
their first git call (for teardown-stack.sh), and reset-test-db.sh
with no argument was run once for real and succeeded.

Also not probed: no break moves the guard after the first read in any
of the three scripts, so the guard's position is checked by the
refusal rows but not probed. For reset-app-db.sh and reset-test-db.sh
the shims' record is a backstop that no single-line edit reaches,
because a copy that gets past the guard stops at the missing .env
before it calls any shim; teardown-stack.sh's accepted row does reach
the git shim.
2026-10-11 21:47:51 -05:00