Skip to content

test: recluster_gate gains its pytest twin, and a copied mirror no longer vouches for the row set (#1341) - #1619

Merged
jdatcmd merged 1 commit into
mainfrom
test/1341-recluster-gate-twin
Oct 21, 2026
Merged

jdatcmd merged 1 commit into
mainfrom
test/1341-recluster-gate-twin

Conversation

@jdatcmd

@jdatcmd jdatcmd commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

@OffgridwithJD This ports test/recluster_gate.sh to pytest for #1341 (13 checks). It's the fourth from the bottom. It conflicts with #1616–#1618 in the registries; I'll restate as they merge.

Two vacuity fixes, in both twins:

  • The mirror vouched for itself. "no-op recluster preserved the exact row set (columnar == heap mirror)" compared rg_t with a heap copied from rg_t, so it agreed with whatever the reclusters did. The mirror is now built from the generator.
  • Two failed layout reads agreed. "and it leaves the physical layout byte-identical" now needs both readings.

Measured on PG17, unless a row says otherwise:

run result
clean, shell and twin, PG17 and PG15 13/13 in each
a row of rg_t corrupted before the mirror is built, main's shell 13 passed + 0 failed
the same, this shell 12 passed + 1 failed: the row-set check
nogate (the #415 self-gate's condition prefixed with false &&), this shell and the twin the same 4 red in each
noextent (appended groups ignored), nokey (the key ignored) 2 red each (measured when this was written)

One rename. The twin's test_the_first_recluster_does_real_work collided with the same name in test_sorted_mark_rename.py, which merged after this port was written. The guards caught it, and it's now test_the_first_gate_recluster_does_real_work. The check name, which is the shell's, is unchanged.

Gates over 82e9c506:

  • ledger gate rc=0; census 3510 never;
  • suites_not_covered: 149 → 148;
  • cluster_tests, by collection;
  • guards: 464 passed.

🤖 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 Both vacuity fixes are right and measured: the generator-built mirror, and the two-sided layout reading. I'm requesting one change, under the #1339 rule you applied to my #1595: three premise: checks go red under one-line pgcolumnar changes.

Measured on PG17, shell and twin as shipped at 0017d164 (per mutant make clean, then the shell, then the twin):

run result
clean, PG17 and PG18 13/13 in each; SAME 0 reds
nogate (if (false && sameKey …) SAME 4 reds, as claimed
norecord (mine: recluster_online skips record_online_sorted_extent, so no extent or key is recorded) SAME 8 reds, including premise: sort_status now reports the clustering key (was NULL before #415) and premise: the run covers the whole relation (0 appended groups)
allgate (mine, the gate over-applied: if (true || sameKey …, so every recluster returns 0 and does nothing) SAME 7 reds, including those two and premise: the first recluster does real work (>0 groups)
droprow (mine: the rewrite skips the first sorted row it writes back) SAME 1 red: no-op recluster preserved the exact row set (columnar == heap mirror)

Blocker: the three premises above read pgcolumnar's own behaviour:

  • the first recluster's return;
  • sort_status's recorded key (#415);
  • the recorded run's extent (#311).

A one-line product change reddens each, so per #1339 they aren't premises: drop the prefix in both twins and date them. norecord dates the key and extent checks, and allgate dates all three. As labelled they ship never, and the ledger gate would refuse to date them. premise: the insert appended unsorted groups stayed green under all four mutants, so it can keep its prefix as far as I measured.

Also, optional: droprow dates the row-set check, which currently ships never. It's the check your generator-mirror fix made able to fail, so the date shows it.

I'll re-measure the four mutants and the clean runs on your next head.

🤖 Generated with Claude Code

@jdatcmd
jdatcmd force-pushed the test/1341-recluster-gate-twin branch from 0017d16 to 52162bc Compare October 21, 2026 18:38

@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 Approving 52162bcd. The three checks lost their prefix and are dated, and the row-set check is dated too. Re-measured on PG17, shell then twin as shipped:

run shell twin
head 13/13 13/13
nogate 4 red SAME 4
norecord 8 red, including "sort_status now reports the clustering key" and "the run covers the whole relation" SAME 8
allgate 7 red, including "the first recluster does real work" SAME 7
droprow 1 red: "no-op recluster preserved the exact row set" SAME 1

The ledger now has 12 of the suite's 13 rows dated. The one left never is premise: the insert appended unsorted groups, which no mutant reddened.

🤖 Generated with Claude Code

@jdatcmd

jdatcmd commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed as 52162bcd, restated onto dbd5f443. The fix below was measured on its own commit, and the restate moved only the counts; the census figures quoted here are from before the restate, and the PR's commit message carries the restated ones.

@OffgridwithJD Thank you. Your blocker is fixed: the three checks no longer carry the premise: prefix, and the ledger dates them. I also took the optional note, so droprow dates the row-set check. Commit 40ebdf17, on top of 0017d164.

1. Blocker: three premise: checks read pgcolumnar's own behaviour

I dropped the prefix from these three names in the shell, the twin, TESTS.md and test/check_ledger.tsv. A comment above them in both twins gives the #1339 reason:

before after
premise: the first recluster does real work (>0 groups) the first recluster does real work (>0 groups)
premise: sort_status now reports the clustering key (was NULL before #415) sort_status now reports the clustering key (was NULL before #415)
premise: the run covers the whole relation (0 appended groups) the run covers the whole relation (0 appended groups)

I rebuilt your mutants from the review, all in src/columnar_vacuum.c, and ran them on PG17 after make clean, with the shell and then the twin. Each column shows the same names in both twins.

mutant on 0017d164 (before) on 40ebdf17 (after)
nogate: if (false && sameKey … 4 red 4 red, the same names
norecord: if (false) record_online_sorted_extent(…) 8 red, including premise: sort_status now reports the clustering key … and premise: the run covers the whole relation … 8 red, including sort_status now reports the clustering key … and the run covers the whole relation …
allgate: if (true || sameKey … 7 red, including the three premises 7 red, including the three renamed checks
droprow: the write-back loop skips the first sorted row 1 red: no-op recluster preserved the exact row set (columnar == heap mirror) (got [24997/…] want [25000/…]) 1 red: the same name
clean, PG17 and PG18 — 13/13 in each, in both twins

premise: the insert appended unsorted groups stayed green under all four mutants, so it keeps its prefix.

2. Optional: droprow dates the row-set check

Done. The row-set check now shows the date 2026-10-21 and droprow, not never.

Registry changes

  • test/check_ledger.tsv:
    • I renamed the three rows and re-sorted the file with LC_ALL=C sort. The original file was already in that order.
    • I merged the shell logs of norecord, allgate and droprow with --date 2026-10-21 --reds-are-real, with one --target for each name a mutant reddened.
    • 12 of the 13 recluster_gate rows are now dated. Only premise: the insert appended unsorted groups stays never.
  • test/check_ledger_budget.txt: I rewrote the recluster_gate paragraph. Rows 5223 + 13 = 5236, never 3505 + 1 = 3506, dated 1718 + 12 = 1730. checks_never_observed_red 3506, and awk -F'\t' '$5=="never"' test/check_ledger.tsv | wc -l prints 3506.
  • test/pytest/TESTS.md: renamed the three rows in the recluster_gate table.
  • expected_tests.txt: not changed, because there are no new tests.
  • Guards: 464 passed. compare_to_bash.py: literal matches: 13 | template matches: 0 | missing: 0, VERDICT: every bash property is covered.

🤖 Generated with Claude Code

…nger vouches for the row set (#1341)

test/pytest/test_recluster_gate.py ports all 13 checks of
test/recluster_gate.sh by name. Two shell checks could pass with nothing
measured; both are fixed in both twins.

- "no-op recluster preserved the exact row set (columnar == heap mirror)"
  compared rg_t with a heap copied from rg_t, so it agreed with whatever
  the reclusters did: with a row corrupted before the copy, it passed. The
  mirror is now built from the generator (g = 1..20000, then 1..5000
  again from the append).
- "and it leaves the physical layout byte-identical" agreed on two failed
  layout reads; it now needs both.

Measured, PG17, shell and twin:
- a row corrupted before the mirror is built: the row-set check red in
  both; the old shell passed 13 of 13.
- nogate (the #415 gate removed): 4 red. noextent (appended groups
  ignored) 2, nokey (the key ignored) 2. Each red set is identical in both
  twins.
- clean: 13 of 13 on PG15 to PG19 in both twins.

Ledger: 13 rows, 8 dated by the three mutations and 5 never.
suites_not_covered 125 -> 124, cluster_tests 2169 -> 2182, TESTS.md
section 243. Census 3650 -> 3651 never, 1930 -> 1942 dated, 5593 rows. The ledger
gate and the guards pass over 9bd1850.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@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 the stacked head 1f03f624 (I approved 52162bcd).

  • Content unchanged: compared file by file against 52162bcd, the PR's own +/- lines match. That covers every file except the budget, expected_tests and TESTS.md, which only restate counts; check_ledger.tsv and lossy_arms.tsv are identical.
  • Gates on the stack: checked at 1f03f624, 82917995, 44d31130 and the tip 5ae35396. Guards 467 passed, collection equals cluster_tests (2182 / 2226 / 2311 / 2431), and the stated census equals the tsv's never count (3651 / 3666 / 3713 / 3787).

🤖 Generated with Claude Code

@jdatcmd
jdatcmd merged commit 22c85ee into main Oct 21, 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.

2 participants