chooseSeed silently ignores an unparseable SEED instead of failing loudly #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
chooseSeedincmd/rogue/main.gofalls back to the time+pid default whenSEEDis set but cannot be parsed. The user asked for a specific dungeon andsilently got a random one.
Set-but-invalid configuration should fail loudly. Silently substituting a
different value is the worst of the three options (honour it, reject it, or
quietly ignore it) because nothing distinguishes "I typo'd
SEED" from "theseed worked".
This matters more here than in a typical program:
SEEDexists precisely so adungeon can be reproduced — for bug reports, for the seed-compat work, and
for wizard-mode debugging. A silently-ignored seed produces an unreproducible
session while the user believes it is pinned, which can send someone chasing a
"non-deterministic" bug that is nothing of the kind.
Found by the reworker of PR #23 (recorded there as M5) and correctly left
alone as out of scope.
Definition of done
SEEDset and unparseable → the program exits non-zero with a message thatnames
SEEDand shows the offending value. It must not start a game.SEEDunset → unchanged behaviour (time+pid default).SEEDset and valid → unchanged behaviour.SEED=an error or the same as unset? Is a negative value accepted? Statethe choice rather than letting it fall out of
strconv.check should happen before raw mode is raised, or after
Fini; do notintroduce a path that prints an error into a raw terminal.
make checkfully green.TODO.mdupdated in the same commit — Completed Steps entry, and do notrotate "Next Step".
(closes #N).Implementation requirements
git show origin/c-master:main.c,and the
ROGUEOPTS/seed handling). If C was permissive, this is adeliberate divergence and must be commented as such — but "fail loudly on
invalid config" is the right call regardless, since C had no
SEEDenvironment variable to be faithful to in the first place. Confirm that.
pendingSavercode settled in PR #23.game/testdata/.c-masterandmodern-roguealone.lock across ~18 concurrent sessions. Run
make lint/make checkin a retryloop and only accept a run that neither reports
parallel golangci-lint is runningnor mentions paths outside your ownworktree. Otherwise you may report green on a red branch.
maketargets only. Do NOT modify.golangci.yml. No Dockerfile/CI/script/.Depends on
PR #23 (#12) — it touches the same file; land that first to avoid a conflict.
Priority
Low-medium. Small, self-contained, and removes a genuine debugging trap.