Skip to content

test: refusals and the month/year path in the partition lifecycle and tiering, in both twins (#1341) - #1350

Merged
jdatcmd merged 2 commits into
commandprompt:mainfrom
OffgridwithJD:test/1341-partition-tier-refusals
Oct 14, 2026
Merged

jdatcmd merged 2 commits into
commandprompt:mainfrom
OffgridwithJD:test/1341-partition-tier-refusals

Conversation

@OffgridwithJD

Copy link
Copy Markdown
Collaborator

Part of #1341: the items in my features that I claimed there. Nine arms, in both twins, each red first under a mutation that removes the branch it tests.

The arms

arm what it pins
a width that is not positive, or a negative lead, is refused before any DDL partition_create_ahead: 0 seconds, -1 day and ahead => -1 each give 22023 with its own message, and nothing is created
a parent that is not RANGE-partitioned on one column is refused before any DDL a LIST parent, a two-column RANGE parent, and a plain table: 55000, nothing created
a parent partitioned on a key that is not a timestamp is refused before any DDL a date key and an integer key: 55000, nothing created
a timestamptz / timestamp parent with a month width starts at this month's first and steps by calendar months 3 partitions, each [first of a month, + 1 month), starting this month
a year width starts at this month's first and steps by calendar years 2 partitions, each + 1 year
a NULL cutoff is refused, in both overloads partition_drop_plan(…, NULL::timestamptz) and (…, NULL::timestamp): 22023
a server that does not exist is refused before anything moves tier_partition: 42704, rows unchanged, still a local table, no file
a fault step that is not one of tier_partition's is refused SET pgcolumnar.tier_fault_after = 'exprot': 22023

Two design points

  • The width arms want the message, not just the SQLSTATE. Without the width check, a zero width never moves the counting loop on, so the 1000-partition cap answers, also with 22023. A code-only arm would be green under the mutation it exists for.
  • Relation names in the wants are schema-qualified. The function formats regclass under its own search_path = pg_catalog, pg_temp, so it prints public.lp. The wants compute format('%I.%I', …) in the session, rather than hard-coding a name that only matches by accident. My first run had it the other way, and every clean run caught it.

Red first (PG17, both twins; each mutant reddens only its own arm)

mutation what the arm saw
no width/ahead check 22008 stride must be greater than zero (twice) and ok: 0
no RANGE-on-one-column check (create_ahead's copy only) 42P16 from ATTACH (LIST, two columns), 42P17 for the plain table
no timestamp-key check (create_ahead's copy only) ok: 2: the date-keyed parent silently got partitions; 22P02 for the integer
no month/year branch 0A000 from date_bin, on all three arms
no NULL-cutoff check, both overloads 0|0: an empty plan, no error
no missing-server branch 42704 still arrives, from core at CREATE FOREIGN TABLE, but the file is written (…|r|file)
the check hook accepts anything ok

Clean: partition_lifecycle 59/59 on each of 15–19; tier_partition 73/73 on 18–19, and 72 + 1 named SKIP on 15–17 (as on main). Both pytest files pass on each. compare_to_bash: partition_lifecycle 51 literal + 4 template matches, tier_partition 50 + 6, 0 missing. shellcheck -S warning is clean. No pytest tests added (new arms inside existing tests), so the counts don't move.

Ledger

Nine new rows, all dated by the mutations above (each merged with --target): rows 2313 → 2322, and checks_never_observed_red stays 1797. Gate against origin/main: census agrees, ceiling 246. None of the new rows is a premise:, so #1347's rule has nothing to say about them.

Left on #1341

The "run as the caller" item for these functions is a design question, not a missing arm, so I've left it open there.

Overlap: #1342, #1346 and #1347 also move the budget. Whichever merges later restates it.

🤖 Generated with Claude Code

@jdatcmd

jdatcmd commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

@OffgridwithJD, I reviewed 5d0b734 and reproduced two of the claims on PG18 with both pytest files:

tree result
this head 5 passed
partition_create_ahead's timestamp-key check disabled 1 failed: "a parent partitioned on a key that is not a timestamp…": got 42P17 empty range bound specified for partition "bydate_…"|22P02 …
tier_partition's missing-server branch disabled 1 failed: …|r|file want …|r|nofile. The Parquet file is written before core's 42704.

One difference from your table: on the pytest side, the date key with a 6-hour width gets 42P17 from core rather than ok: 2, because your shell twin uses 1 day. The arm is red either way, so no change is needed.

The other arms read well. Requiring the message, not only the SQLSTATE, on the width arm is the right call, since the 1000-partition cap answers 22023 too.

It needs a rebase before I approve. #1342 and #1349 merged, so main is at 2316 rows / 1796 never. With your nine dated rows that becomes 2325 / 1796. #1346 and #1347 are queued too, so whoever lands later restates from main. I'll approve and merge on the rebased head once CI is green.

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto d0ae0b1 (#1349 and #1342 merged); the head is now cbaa1bd. The two suites and their pytest twins are byte-identical to the tested 5d0b734. The ledger is redone from main's (2316/1796/520): 2325 / 1796 / 529, all nine new rows dated, with the budget restated. Gate: census agrees, ceiling 246.

@jdatcmd

jdatcmd commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

@OffgridwithJD, I checked cbaa1bd against the head I reviewed (5d0b734): all four test files are identical, so the review stands. Your restated budget (2325 / 1796) is right for d0ae0b1.

One more rebase, sorry: #1346 merged since. Main is now d926b62 at 2321 / 1798, so with your nine dated rows it becomes 2330 / 1798. Your PR doesn't change expected_tests.txt, so that should apply cleanly. Once it's rebased and CI is green, I'll approve and merge.

#1347 is also waiting on a re-approval; whichever lands second restates.

@jdatcmd jdatcmd 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.

Approving the content at cbaa1bd. The test files are identical to 5d0b734, which I reviewed. On PG18 I reproduced the timestamp-key and missing-server claims: clean 5 passed, and each mutant reddened its own arm.

Not mergeable yet: check_ledger_budget.txt conflicts with main (74cde39), whose census #1346 moved to 2321 / 1798. Please rebase and restate from a recount; with your nine dated rows I expect 2330 / 1798. Once CI is green on the new head, I'll check only the ledger and budget, re-approve and merge.

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-partition-tier-refusals branch from cbaa1bd to c0311ab Compare October 13, 2026 23:38
@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

@jdatcmd, rebased onto main 74cde39 (#1346 and #1352 merged). The new head is c0311ab, replacing cbaa1bd.

  • Conflict: only check_ledger_budget.txt. fix: refuse a build whose PG_CONFIG gives no PGXS, before any probe reads stdin (#1344) #1346's block is kept, and mine is restated on top: 2330 rows / 1798 never (2321 + 9, all dated).
  • Patch unchanged: outside the budget, the changed lines match cbaa1bd's exactly (git diff -U0, hunk headers ignored).
  • Ledger: the tsv auto-merged. It equals main's rows plus my nine keys, with nothing else moved or lost, and no duplicate keys.
  • Gate: over the five-major logs with --against origin/main, rc=0. The census agrees at 1798 and the ceiling stays 246 → 246.
  • Database-free set: 427 passed.

Whichever of #1347, #1354, #1351 and #1353 lands first, the others restate from main.

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

@jdatcmd, rebased again, onto 95b4112 (#1347 merged). The new head is 6728793, replacing c0311ab.

Whichever of this and #1354 lands second restates.

jdatcmd and others added 2 commits October 14, 2026 00:11
… tiering, in both twins (commandprompt#1341)

Nine behaviours no arm exercised, each now an arm in both twins:

partition_create_ahead, before any DDL:
- a zero or negative width, or a negative lead (22023);
- a parent not RANGE-partitioned on one column: LIST, two columns, not
  partitioned at all (55000);
- a key that is not a timestamp: date, an integer type (55000);
- a month or year width starts at this month's first and steps by the
  calendar, for a timestamptz and a timestamp key.
partition_drop_plan refuses a NULL cutoff, in both overloads (22023).
tier_partition refuses a server that does not exist before anything moves.
pgcolumnar.tier_fault_after refuses a value that is not a step name.

The width arms want the message as well as the code: without the width
check, a zero width never moves the counting loop on and the 1000-partition
cap answers with the same 22023. The relation in a message is named the way
the function names it, schema-qualified under its own search_path.

Red first on PG17, each mutation removing the branch its arm tests, in both
twins. Each reddens only its own arm:
- no width check: `22008 stride must be greater than zero` and `ok: 0`;
- no RANGE check: 42P16 from ATTACH, 42P17 for an unpartitioned table;
- no key-type check: a date key silently gets partitions (`ok: 2`);
- no month branch: 0A000 from date_bin;
- no NULL-cutoff check: `0|0`, an empty plan;
- no missing-server branch: 42704 from core, but the file is written;
- an open check hook: the bogus SET succeeds.
Clean: partition_lifecycle 59/59 on each of 15-19; tier_partition 73/73 on
18-19, 72 + 1 named SKIP on 15-17; both pytest files green on each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mpt#1341)

Five-major clean runs of both suites, and each mutation merged with
--target naming its arm. Nine rows, all dated. Restated from main d0ae0b1:
rows 2316 -> 2325, and checks_never_observed_red stays 1796.

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

Copy link
Copy Markdown
Collaborator Author

@jdatcmd, rebased onto e848f8f (#1354 merged). The new head is 7d7d634, replacing 6728793. Your approval is on cbaa1bd, so this needs a re-approval before it can merge.

If you merge this before #1351, #1353 or #1355, those three restate after it.

@jdatcmd jdatcmd 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.

Re-approving 7d7d634.

  • Ledger: a recount gives 2336 / 1803, which agrees with checks_never_observed_red 1803. No duplicate keys, and no dated premise: row, so #1347's gate rule is satisfied.
  • Patch: all four test files are byte-identical to cbaa1bd, the head I reviewed and reproduced.
  • Database-free set: 429 passed on this head.

Merging.

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