Skip to content

test: harden weak audit assertions (F7-04, F7-06, F7-11, F7-10, F7-05, F3-05)#91

Merged
lesnik512 merged 1 commit into
mainfrom
test/f-hardening-batch
Jun 14, 2026
Merged

test: harden weak audit assertions (F7-04, F7-06, F7-11, F7-10, F7-05, F3-05)#91
lesnik512 merged 1 commit into
mainfrom
test/f-hardening-batch

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

PR 2 of the tail program. Strengthens tests the 2026-06-14 pass-3 audit flagged as passing-too-easily (they'd survive real regressions).

  • F7-04 — new test_fetch_skips_rows_locked_by_another_transaction: locks 20 of 30 rows in an open transaction, then asserts a concurrent client.fetch promptly claims the disjoint 10. A regression from FOR UPDATE SKIP LOCKED to plain FOR UPDATE would block on the locked rows → the bounded wait_for fails via timeout. (The existing no-double-claim test guards its named invariant but would pass without SKIP LOCKED.)
  • F7-06 — assert dispatch_one threads row.id + row.acquired_token (the load-bearing lease guard) into delete_with_lease, not just the connection.
  • F7-11 — capture and assert the relayed body on the successful at-least-once retry (a retry relaying an empty/wrong payload would have passed the call-count + row-deletion checks).
  • F7-10 — identity-check the FastAPI-injected producer/client against the swapped fakes (the Context(...) annotation string is the load-bearing artifact; isinstance would pass on a wrong instance). Adds TestOutboxBroker.fake_producer, symmetric with fake_client.
  • F7-05 — assert the DLQ headers audit column round-trips (off-Postgres guard on the fake's DLQ copy).
  • F3-05 — new test_dlq_cte_quotes_adversarial_table_names pins identifier quoting at the one raw-SQL site (table names with embedded " and ;); a refactor dropping format_table would fail it.

Verification

  • just test509 passed, 100% coverage
  • just lint clean (ruff + ty)

Deferred to a follow-up

  • F7-07 (NOTIFY-wakeup determinism — fiddly spy on _wait_for_notify_or_timeout)
  • F7-09 (telemetry exact bounds — spans 4 metrics/middleware test files)
  • F1-08 (route sync dispatch through fake_client.fetch — touches the sync-dispatch path, higher risk; deserves its own focused change)

🤖 Generated with Claude Code

…, F3-05)

Strengthen tests the pass-3 audit flagged as passing-too-easily:

- F7-04: new test_fetch_skips_rows_locked_by_another_transaction locks 20 rows in an
  open transaction and asserts a concurrent fetch promptly claims the disjoint 10 — a
  regression to plain FOR UPDATE blocks and fails via wait_for timeout. (The sibling
  no-double-claim test would pass without SKIP LOCKED.)
- F7-06: assert dispatch_one threads row.id + acquired_token (the lease guard) into
  delete_with_lease, not just the connection.
- F7-11: capture and assert the relayed body on the successful at-least-once retry.
- F7-10: identity-check the FastAPI-injected producer/client against the swapped fakes
  (the Context annotation string is load-bearing); add TestOutboxBroker.fake_producer.
- F7-05: assert the DLQ headers audit column round-trips (off-Postgres guard).
- F3-05: new test_dlq_cte_quotes_adversarial_table_names pins identifier quoting at the
  one raw-SQL site (names with embedded " and ;).

just test -> 509 passed, 100% coverage; just lint clean.

Deferred to a follow-up: F7-07 (NOTIFY-wakeup determinism), F7-09 (telemetry exact
bounds, 4 files), F1-08 (sync-dispatch via fake fetch — higher risk).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 7726cc1 into main Jun 14, 2026
3 checks passed
@lesnik512 lesnik512 deleted the test/f-hardening-batch branch June 14, 2026 13:42
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.

1 participant