Skip to content

Add property-style tests for base64 padding and uuidv7 shifts#66

Draft
NikolayS wants to merge 1 commit into
masterfrom
claude/testplan-encode-uuid-tests
Draft

Add property-style tests for base64 padding and uuidv7 shifts#66
NikolayS wants to merge 1 commit into
masterfrom
claude/testplan-encode-uuid-tests

Conversation

@NikolayS

Copy link
Copy Markdown
Owner

What

Adds property-style regression tests in src/test/regress that close input-boundary gaps around two recent fixes:

  • 1f41403 "Fix truncation rules for base64 encoding" — the base64url work (e1d9171) accidentally relaxed = padding acceptance for plain base64; the fix re-gates the relaxed rule on the url variant.
  • 7575215 "Reject infinite and out-of-range interval shifts in uuidv7()".

Why

The commits above each shipped a single targeted test. This adds broader property coverage so the restored boundaries stay locked in:

strings (base64 / base64url):

  • Round-trip identity encode(decode(encode(x))) = x for both variants across input lengths 0..8, covering every padding phase (len % 3 in {0,1,2}). Uses a deterministic byte pattern, so output is stable.
  • Padding/truncation rejection matrix: each unpadded trailing-group length (1/2/3 chars) × variant, asserting the exact error. base64 rejects every unpadded partial group (invalid base64 end sequence); base64url accepts 2- and 3-char remainders but rejects a lone 1-char remainder; misplaced = padding (unexpected "=" while decoding ...) is rejected in both.

uuid (uuidv7 interval):

  • Monotone-ordering property: strictly increasing uuidv7(interval) shifts yield strictly increasing (sortable) UUID values, comparing the uuid values themselves rather than only the extracted timestamps. Complements the infinite-interval and out-of-range rejection tests from 7575215.

All uuidv7 tests assert properties/errors only — never literal random UUID values.

Test evidence

Built with meson setup build --buildtype=debug -Dcassert=true -Dtap_tests=enabled and ninja -C build.

ok  - test_setup
ok  - strings   (267 ms)
ok  - uuid      (128 ms)
# All 3 tests passed.

Full parallel_schedule run: strings (test 22) and uuid (test 16) both ok, regression.diffs empty.

Notes

Test-only change: 4 files, +188 lines (sql/strings.sql, sql/uuid.sql, and matching expected/*.out).

Closes #60

🤖 Generated with Claude Code

https://claude.ai/code/session_01PtxA6B4d47ietk5dGsseuP


Generated by Claude Code

Recent fixes exposed input-boundary gaps in the base64/base64url decode
path and in uuidv7(interval). This extends the regression suite with
property-style coverage that guards those boundaries:

strings: encode/decode round-trip identity for both base64 and base64url
across input lengths 0..8 (every padding phase, len % 3 in {0,1,2}), plus
a padding/truncation rejection matrix covering each unpadded
trailing-group length (1/2/3 chars) x variant. base64 rejects every
unpadded partial group; base64url accepts 2- and 3-char remainders but
rejects a lone 1-char remainder and misplaced "=" padding. This locks in
the truncation rules restored in commit 1f41403.

uuid: a monotone-ordering property asserting that strictly increasing
uuidv7(interval) shifts yield strictly increasing (sortable) UUID values,
comparing the uuid values themselves rather than only the extracted
timestamps. Complements the out-of-range and infinite-interval rejection
tests added in commit 7575215.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PtxA6B4d47ietk5dGsseuP
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.

Add property tests for base64/base64url and uuidv7 boundaries

2 participants