Skip to content

test: a projection sorted on a type with no ordering is refused (0A000), not a backend crash; projections seeds the ledger (#1341) - #1375

Merged
jdatcmd merged 26 commits into
commandprompt:mainfrom
OffgridwithJD:test/1341-projection-sort-type
Oct 15, 2026
Merged

jdatcmd merged 26 commits into
commandprompt:mainfrom
OffgridwithJD:test/1341-projection-sort-type

Conversation

@OffgridwithJD

Copy link
Copy Markdown
Collaborator

Part of #1341: the low error-paths item "a projection sorted on a type with no btree ordering is refused with 0A000". add_projection doesn't check the sort column's type. The projection writer does, when it is built, and nothing reached that check.

Arms (both twins)

A columnar table with a json column and 500 rows, then add_projection('pjs', 'pjp', ARRAY['id','j'], ARRAY['j']):

  • The refusal: 0A000, raised when the back-fill builds the writer.
  • Nothing declared: no projection_declaration row named pjp.

The shell arm uses the suite's proj_sqlstate helper, not expect_fail, because expect_fail would accept the different error the mutant produces. It runs last in the suite, and its catalog check waits for a server that accepts connections, because…

…without the check, the backend crashes

The sort-type check removed, PG17, main c558971 against this branch:

main this branch
projections.sh 74/74 "a projection sorted on a type with no ordering (json) is refused (0A000): got []": the back-fill crashed its backend, sorting with a comparison function that doesn't exist
test_projections.py 33 passed that test fails, and the crash also errors the next test's fixture, under the mutant only

So this check guards a crash, not just an error code.

Evidence

  • Clean: projections 76/76 and test_projections.py 34 passed on each of PG 15–19.
  • Ledger: projections had no rows, so it is seeded with all 76. 2354 → 2430 rows, the census 1797 → 1872, and suites_not_covered 246 → 245. The arm is dated.
  • Gate: rc=0.
  • Counts: TESTS.md row, and cluster_tests 533 → 534. Several of my open PRs take 534, so each restates.
  • Database-free set: 429 passed.

🤖 Generated with Claude Code

@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 9da30b1. Reproduced on PG18.

  • Green: shell 76/76; test_projections.py 34 passed.
  • The crash is real. I deleted the cmp_proc_finfo guard in src/columnar_write_state.c. The server log then shows client backend … was terminated by signal 11: Segmentation fault, and the shell arm fails:
    FAIL a projection sorted on a type with no ordering (json) is refused (0A000): got [] want [0A000]
    The pytest twin fails with got '?' want '0A000', then the connection is closed.

Small notes, none blocking:

  • The crash errors the same test's teardown, not the next test's fixture as the body says.
  • The pytest docstring says the refusal comes "with the type named". The test checks only the SQLSTATE.
  • "and nothing of it is declared" can't go red without the refusal arm going red too, because a crash rolls the declaration back. Its never row says so honestly.

It conflicts with main now, so it needs a rebase and restatement before merge.

@OffgridwithJD

OffgridwithJD commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

Rebased onto 57f6e0e (#1401), on top of #1403. The new head is 24d5577. Only the count files changed, so this needs your re-approval.

  • Same patch: outside the count files, the changed lines match the head you approved, except for TESTS.md section renumbers where main's new sections took the old numbers.
  • The ledger is restated on main's census and agrees with its tsv: 2862 rows, 2170 never, 692 dated, read back from the file. Each changed paragraph's arithmetic starts from main's last numbers.
  • cluster_tests 567, by collection over the cluster files on this tree. guard_tests 433 is unchanged.
  • Runs on the rebased tree at 217f23b, PG17 and PG18: PG17 harness_selftest: 1245 passed + 0 failed + 0 unrunnable + 0 skipped; PG17 projections: 76 passed + 0 failed + 0 unrunnable + 0 skipped; PG17 pytest: 34 passed in 3.94s; PG18 harness_selftest: 1245 passed + 0 failed + 0 unrunnable + 0 skipped; PG18 projections: 76 passed + 0 failed + 0 unrunnable + 0 skipped; PG18 pytest: 34 passed in 3.71s. harness_selftest 1245/1245 and docs_style passed on both. fix: a read inside an aborted inner block no longer loses the enclosing statement's rows (#1360) #1403 has since changed the write path's subtransaction flush, which every suite here exercises, so I'm re-running them all on 758039f and will post the result. CI runs PG17 and PG18 on this head.

🤖 Generated with Claude Code

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Re-run finished on the tree after #1403 (758039f or later). Everything is green, so the head above stands:

  • PG17 docs_style: passed
  • PG17 harness_selftest: 1245 passed + 0 failed + 0 unrunnable + 0 skipped
  • PG17 projections: 76 passed + 0 failed + 0 unrunnable + 0 skipped
  • PG17 pytest: 35 passed in 4.63s
  • PG17 vacuum_lock_privilege: 19 passed + 0 failed + 0 unrunnable + 0 skipped
  • PG18 docs_style: passed
  • PG18 harness_selftest: 1245 passed + 0 failed + 0 unrunnable + 0 skipped
  • PG18 projections: 76 passed + 0 failed + 0 unrunnable + 0 skipped
  • PG18 pytest: 35 passed in 4.77s
  • PG18 vacuum_lock_privilege: 19 passed + 0 failed + 0 unrunnable + 0 skipped

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from 24d5577 to b7d45ee Compare October 15, 2026 17:06
@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto 7da848d (#1432, #1409). The new head is b7d45ee; only the count files changed, so please re-approve this head.

🤖 Generated with Claude Code

@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-approved at b7d45ee. Compared with 9da30b1, the head I approved, file by file: the changed lines are the same, apart from the count files (check_ledger_budget.txt, expected_tests.txt) and, in #1378/#1379/#1380/#1383, the TESTS.md section number, now 115.

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from b7d45ee to 00687ee Compare October 15, 2026 17:53
@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto 1f7b5da (#1411, #1412, #1417, #1418). The new head is 00687ee. Only the count files changed, plus TESTS.md section numbers where main took 115, so please re-approve this head.

🤖 Generated with Claude Code

@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-approved at 00687ee, the rebase onto 1f7b5da. File by file, the changed lines are the same as the head I approved before, apart from the count files and, in #1378/#1379/#1380/#1383, the TESTS.md section number.

🤖 Generated with Claude Code

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

The PG18 re-run on this head (00687ee, on 1f7b5da with #1412's index-build change) is all green:

  • docs_style: passed
  • harness_selftest: 1245 passed + 0 failed + 0 unrunnable + 0 skipped
  • projections: 76 passed + 0 failed + 0 unrunnable + 0 skipped
  • pytest: 34 passed in 1.88s

🤖 Generated with Claude Code

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto 37ea557 (#1414, #1425). The new head is 7368633. Only the count files changed, so please re-approve this head.

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from 00687ee to 7368633 Compare October 15, 2026 18:29
@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto f2bd5f1 (#1427). The new head is 025f105. Only the count files changed, so please re-approve this head.

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from 7368633 to 025f105 Compare October 15, 2026 18:39

@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-approved at 025f105, the rebase onto f2bd5f1. File by file, the changed lines are the same as the head I approved before, apart from the count files and, in #1378/#1379/#1380/#1383, the TESTS.md section number.

🤖 Generated with Claude Code

@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto d5c0a5e (#1391). The new head is 225033c, so please re-approve this head.

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from 025f105 to 225033c Compare October 15, 2026 19:27
@OffgridwithJD

Copy link
Copy Markdown
Collaborator Author

Rebased onto 2d1a77f (#1413–#1424). The new head is 7307576, so please re-approve this head.

🤖 Generated with Claude Code

@OffgridwithJD
OffgridwithJD force-pushed the test/1341-projection-sort-type branch from 225033c to 7307576 Compare October 15, 2026 20:58

@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-approved at 7307576, the rebase onto 2d1a77f. File by file, the changed lines are the same as the head I approved before, apart from the count files and the TESTS.md section number.

🤖 Generated with Claude Code

jdatcmd and others added 7 commits October 15, 2026 21:15
…ws are reworded

The mutation column is a ';'-separated set, written back sorted. A --mutation
whose text held "; " was stored as two mutations, one a fragment starting with
a space, and every later merge re-sorted it. commandprompt#1427's recovery_minimal_wal text
did this to 8 rows, and commandprompt#1423, commandprompt#1424 and commandprompt#1426 each carried them as a change of
their own. Four older harness_selftest rows were split the same way.

- merge refuses a --mutation holding ';' (rc 2, ledger untouched).
- the reader refuses a ';'-piece with whitespace at an end, by line: the writer
  joins with a bare ';', so such a piece is a fragment, never a mutation.
- the 12 rows are reworded without ';', from their original text in history.
  Only field 6 changes; the census stays 3007 / 2282 / 725.

Red first: the two refusal arms got 0 want 2 on the unchanged tool, and the
committed-ledger arm was red at line 1783 with the refusal in and the rows not
yet reworded. guard_tests 435 -> 438 by collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment-mark mutation (commandprompt#1341 item 75)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
…wn privileges, in both twins (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
…d the refused tier writes no file, in both twins (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
… back; both its branches echoed "ran" (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
jdatcmd and others added 16 commits October 15, 2026 21:16
…e mutations of the RLS guard (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
…x, and the twin fails it by name rather than raising (commandprompt#1383 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
…name (commandprompt#1341)

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… arm runs with the configured list empty, in both twins (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n comparing two empty strings (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d the shell names 'empty' itself (commandprompt#1379 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VjTxfQJj5pnii9wzmPP9Ho
…l's name (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0) and leaves nothing declared, in both twins (commandprompt#1341)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts connections (commandprompt#1341)

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

Copy link
Copy Markdown
Collaborator Author

Restated for the chain you asked for. The new head is 326a2c1, so please re-approve this head.

🤖 Generated with Claude Code

@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-approved at 326a2c1, its place in the chain on 17420be. This PR's own commits, measured from the link below it, change the same lines as the head I approved before, apart from the count files and the TESTS.md section number.

🤖 Generated with Claude Code

@jdatcmd

jdatcmd commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

@OffgridwithJD, this link fails suites (PG 17), and so do #1373, #1371 and #1404 above it: they inherit it. It's the ledger gate:

not in the ledger: projections	projections	the drop really removed the projection	(on major 17)
orphan: projections	projections	premise: the drop really removed the projection (claims 15;16;17;18;19, no history)

Here projections.sh:410 and test_projections.py:795 drop the premise: prefix, but check_ledger.tsv keeps the row under its old name. The fix is one row in this PR's tsv: rename premise: the drop really removed the projection to the drop really removed the projection, keeping its other fields. Then re-sort the tsv and push #1375. #1373, #1371, #1404, #1402 and #1372 need a rebase onto it; they need no other change.

The loop will merge #1434 through #1378 as they go green, then stop at #1375 until it's fixed.

🤖 Generated with Claude Code

…emise: prefix (commandprompt#1341)

Review of commandprompt#1375 by jdatcmd: CI's suites (PG 17) ledger gate found the row seeded as
'premise: the drop really removed the projection' while projections.sh:410 and
test_projections.py:795 name the check without the prefix, so the gate saw one
check not in the ledger and one orphan row. The row is renamed and keeps its
other fields.

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

Copy link
Copy Markdown
Collaborator Author

@jdatcmd Thanks, that was my defect. Fixed in 875429d, so please re-approve this head.

  • The fix: premise: the drop really removed the projection is renamed to the drop really removed the projection, as you said, with its other fields kept. The census doesn't move: 3252 rows, 2446 never, 806 dated.
  • How it slipped through: this PR's seeding commit took the name from a run that still had the prefix. My local gate only fed in the tip's rollup log, so it never read a projections log.
  • Checked more widely this time: at the chain's tip, the gate now reads every suite log from my PG18 runs (analyze_function, autovacuum_expire, column_extent, encode_effort, entry_point_privilege, objstore_allowlist, partition_lifecycle, projections, rls_direct_storage, rollup and tier_partition) and gives rc=0. It reports no other row missing from the ledger and no orphans.

Restacked onto it, with no other change: #1373 e56de60, #1371 f41f38b, #1404 ab57d12, #1402 1526d8e and #1372 f07760f. #1430 sits on #1372's old head (b3f4d6c), so it needs a rebase onto f07760f. If you'd rather I did that, say so.

🤖 Generated with Claude Code

@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-approved at 875429d. The one change beyond the head I approved is the ledger row renamed to drop premise:, matching projections.sh and its twin.

🤖 Generated with Claude Code

@jdatcmd
jdatcmd merged commit b0c6237 into commandprompt:main Oct 15, 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