Skip to content

test(lifecycle): refuse a staging suffix that is the pid, not one containing it - #192

Open
REPPL wants to merge 2 commits into
mainfrom
test/staging-name-pid-check
Open

REPPL wants to merge 2 commits into
mainfrom
test/staging-name-pid-check

Conversation

@REPPL

@REPPL REPPL commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Resolves iss-2610040003465642.

Why

TestTheStagingNameIsUnguessable refused any staging name whose text contained the process id. os.MkdirTemp's suffix is a random decimal of up to ten digits, so a four- or five-digit pid turns up in it by chance. That failed PR 180's linux run with .dessau-incoming-1415576321, although PR 180 changes only records.

What changes

  • The check now compares the suffix after .dessau-incoming- with the pid exactly, in a helper named carriesPid. The hazard the test exists for is a name derived from the pid, and that is still refused.
  • TestCarriesPidMeansDerivedFromIt carries the observed collision and a pid-derived name.
  • Nothing in the code under test changes.

impact: internal.

Watched to fail

Against the old substring check, carriesPid(".dessau-incoming-1415576321", 4155) returned true where false is wanted. Both tests then passed 50 times in a row.

Gates

gofmt -l . is empty and go vet ./... is clean. go test -race ./... is green apart from internal/bind's IPv6 listener test, which cannot pass in a container without IPv6.

REPPL added 2 commits October 4, 2026 00:05
…taining it

TestTheStagingNameIsUnguessable refused any name whose text contained
the process id, but os.MkdirTemp's suffix is a random decimal of up to
ten digits, so a pid's digits turned up in it by chance and failed an
unrelated PR's linux run (.dessau-incoming-1415576321). The hazard is a
pid-derived name; the check now compares the suffix with the pid
exactly, in a helper whose table test carries the observed collision.

Resolves iss-2610040003465642.

Assisted-by: Claude

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant