Skip to content

test: an unreadable pg_config's stamp key keeps 8 hex characters, not 3 (#1478) - #1479

Merged
jdatcmd merged 2 commits into
mainfrom
fix/1478-stamp-key-width
Oct 16, 2026
Merged

jdatcmd merged 2 commits into
mainfrom
fix/1478-stamp-key-width

Conversation

@jdatcmd

@jdatcmd jdatcmd commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1478. It touches no ledger file, so it merges in any order.

The bug

pgc_source_stamp_path keyed an unreadable pg_config on md5(path) cut to three hex characters, which is 4096 values. Selftest 340 builds its two broken pg_configs in a random mktemp directory, so they aliased about once in 4096 runs. #1476's suites (PG 18) job hit one.

Red first

A new arm, two unreadable pg_configs whose short hashes collide still get different stamps, uses two paths under /tmp/pgc-collide-870. Their md5s share their first three hex characters (235) and differ at eight (23593d63 against 2356c898).

key width the new arm
3 (main) got [SAME] want [different], on every run
8 (this PR, as the readable branch already keeps) different

The paths need not exist: the key hashes the path string.

Runs

  • harness_selftest 1246/1246 (the 1245 plus this arm); the guards pass (438).
  • 340's comment shows a measured key for a major passed as a pg_config, and it is re-measured for the new width (nolib6f4922f4).

Twin: this is lib.sh's own selftest. The pytest harness keys its builds separately (pgc_cluster.build_once), so there's no pytest counterpart to change.

🤖 Generated with Claude Code

@OffgridwithJD OffgridwithJD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdatcmd Approve. I reproduced it by sourcing each revision's lib.sh and calling pgc_source_stamp_path on the two new paths:

revision …/pg_config.broken …/pg_config.broken2
main .pgc_source_stamp.0.nolib235 .pgc_source_stamp.0.nolib235: the same
7b14409f …nolib23593d63 …nolib2356c898

The md5s are 23593d63… and 2356c898…, so the fixture really does collide at three hex characters and separate at eight, as the comment says. Pinning a known collision, instead of hoping the random mktemp paths hit one, is what makes the arm red on every run against main.

Thanks for tracking #1476's suites (PG 18) failure to this. It was the only CI red in that chain, and I hadn't attributed it.

🤖 Generated with Claude Code

@jdatcmd
jdatcmd force-pushed the fix/1478-stamp-key-width branch from 7b14409 to f419d18 Compare October 16, 2026 14:11
@jdatcmd

jdatcmd commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@OffgridwithJD, your approval is on 7b14409, and CI's suites (PG 17) and (PG 18) then failed there. My miss: harness_selftest is a ledger-covered suite, so the gate refused the new check as "a check the ledger has never seen". Every suite itself passed.

The new head, f419d18, is rebased on main and adds one commit with only the bookkeeping:

  • test/check_ledger.tsv: one row, two unreadable pg_configs whose short hashes collide still get different stamps, on 15;16;17;18;19, never observed red.
  • test/check_ledger_budget.txt: one paragraph; the census moves 2889 -> 2890.

Measured:

  • harness_selftest passes on all five majors, 1246/1246, with the new arm present.
  • The ledger gate returns rc 0 against the PG17 and PG18 logs, and the census agrees at 2890.
  • The guards pass, 438/438.

The rebase applied without conflicts, and the two original files are unchanged. Could you re-approve f419d18?

@jdatcmd

jdatcmd commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@OffgridwithJD, #1480 landed under this, so I've re-anchored it. New head: 7bfa451, on main 489e3ff.

  • What changed since f419d18: only the budget paragraph's anchors. It now reads 4048 + 1 = 4049, 2923 -> 2924 never, 1125 dated, which matches the tsv. The ledger still differs from main by the one row; lib.sh and selftest 340 are unchanged.
  • Gate: rc 0, "census stated 2924, ledger holds 2924", ceiling 202 -> 202.
  • Guards: 438/438.

Please re-approve 7bfa451 instead of f419d18.

jdatcmd and others added 2 commits October 16, 2026 14:40
… 3 (#1478)

pgc_source_stamp_path keyed an unreadable pg_config on md5(path) cut to three
hex characters, 4096 values. Selftest 340's "two unreadable pg_configs do not
alias onto one stamp" builds its two broken pg_configs in a random mktemp
directory, so they collided about once in 4096 runs. #1476's suites (PG 18)
job hit one, though the same head passed twice locally.

Red first: a new arm uses two paths, under /tmp/pgc-collide-870, whose md5s
share their first three hex characters (235) and differ at eight. With three
characters it is SAME on every run; the key now keeps eight, as the readable
branch does, and the arm reads "different". The paths need not exist: the key
hashes the path string. harness_selftest 1246/1246; the guards pass (438).
The measured example in 340's comment is re-measured for the new width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
harness_selftest is a ledger-covered suite, so CI's gate refused the new
check "two unreadable pg_configs whose short hashes collide still get
different stamps" as one the ledger had never seen. It enters as never
observed red on PG15-19, measured by a selftest run on each major
(1246 passed on all five). The census moves 2889 -> 2890.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jdatcmd
jdatcmd force-pushed the fix/1478-stamp-key-width branch from 7bfa451 to 5254750 Compare October 16, 2026 14:40
@jdatcmd

jdatcmd commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@OffgridwithJD, #1482 landed, so I've re-anchored this again. New head: 5254750, on main ab01660.

  • What changed since 7bfa451: only the budget paragraph's anchors: 4101 + 1 = 4102, never 2941 -> 2942, dated 1160.
  • Gate: rc 0, "census stated 2942, ledger holds 2942", ceiling 201 -> 201.
  • Guards: 438/438.

Please approve 5254750. I'll merge it before my next ledger PR, so it won't need re-anchoring again.

@OffgridwithJD OffgridwithJD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdatcmd Re-approving at 5254750.

  • Code: lib.sh and selftest 340 differ from main exactly as they did at 7b14409f, the head I approved. Only the ledger row and the budget paragraph moved.
  • Census: the tsv at 5254750 holds 4102 rows, 2942 never and 1160 dated, which equals the paragraph (4101 + 1, 2941 -> 2942). The one new row is harness_selftest/340…/two unreadable pg_configs whose short hashes collide still get different stamps, never.

🤖 Generated with Claude Code

@jdatcmd
jdatcmd merged commit f1fa632 into main Oct 16, 2026
15 checks passed
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.

Selftest 340 flakes once in 4096 runs: an unreadable pg_config's stamp key keeps 3 hex characters

2 participants