Skip to content

test: close the audit's "additional test findings" tail#74

Merged
lesnik512 merged 2 commits into
mainfrom
test/close-additional-test-findings
Jun 13, 2026
Merged

test: close the audit's "additional test findings" tail#74
lesnik512 merged 2 commits into
mainfrom
test/close-additional-test-findings

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

The 2026-06-12 code audit's formally-tracked test holes (T1–T8) shipped in 0.9.0, but the prose "Additional test findings" list below that table was never tracked. This closes all ~11 of them. One small source change (a fake-client fidelity fix); everything else is test-only. 482 tests pass at 100% coverage.

Substance (not just count)

  • Fake fidelity: FakeOutboxClient terminal writes matched a None token against a None-token row (None == None) where the real SQL no-ops (NULL = NULL). Now guarded + pinned. The two loop-mode no-token tests and the lease-lost tests previously asserted only "the handler ran" — now they assert the row is preserved / lease_lost fires with the right phase / the paired acked/nacked_retried is suppressed (P17).
  • De-flaked the elapsed < 0.7 drain bound → a graceful_timeout-relative < 1.6x bound (still catches the 2x-drain regression).
  • Real coverage added: FastAPI transactional contract end-to-end (Depends session → chained OutboxResponse through the wrapper + session-per-delivery); OTel consume-span assertion (was meter-only); started-foreign-broker no-warn; router kwarg forwarding; _default_retry_strategy() pinned.
  • De-tautologized the two OTel recorder tests (meter-precedence now uses distinct readers; default-provider patches get_meter and asserts the event lands).
  • Convention: hoisted the 6 inline imports in test_unit.py (all redundant shadows / trivially hoistable, no import-behavior tests); dropped stale dev-plan references from a test_relay.py comment.

Verification

  • just test — 482 passed, 100% coverage (the --cov-fail-under=100 gate).
  • just lint-ci — clean.

A follow-up commit corrects the archived code-audit findings doc, which had claimed "nothing deferred."

🤖 Generated with Claude Code

lesnik512 and others added 2 commits June 13, 2026 15:44
The 2026-06-12 code audit's formally-tracked test holes (T1–T8) shipped in
0.9.0, but the prose "Additional test findings" list below that table was
never tracked or fixed. Close all of it. One small source change (a fake
fidelity fix); everything else is test-only. 482 tests pass at 100% coverage.

Fake / subscriber fidelity:
- testing.py: FakeOutboxClient.delete_with_lease / mark_pending_with_lease now
  require ``acquired_token is not None`` to match, mirroring SQL's
  ``NULL = NULL`` (no match). Previously a None token matched a None-token row
  (``None == None``) where the real client no-ops. Pinned with a direct test.
- test_fake.py: the two loop-mode no-lease-token tests now assert the row is
  preserved (the worker's early-return), not just that the handler ran.
- test_fake.py: the lease-lost terminal/retry tests now assert the lease_lost
  metric fires with the right phase AND that the paired acked/nacked_retried is
  suppressed (P17 emit-after-flush), not just that the handler ran.

Flake / robustness:
- test_fake.py: replace the load-sensitive ``elapsed < 0.7`` drain bound with a
  graceful_timeout-relative ``< 1.6x`` bound (still catches the 2x-drain
  regression, won't flake under CI load).

Coverage gaps:
- test_unit.py: pin _default_retry_strategy() to its documented parameters.
- test_relay.py: a STARTED foreign broker emits NO warning at start() (negative
  of the existing unstarted-broker warning test).
- test_fastapi.py: the transactional contract end-to-end — a Depends-resolved
  session flows into a chained OutboxResponse through the FastAPI wrapper, and
  each delivery resolves its own fresh session (session-per-delivery); plus
  OutboxRouter forwards broker kwargs to the inner broker.
- test_middleware_opentelemetry.py: assert the consume-scope span actually fires
  (was: meter-only assertions, zero span coverage).
- test_metrics_opentelemetry.py: de-tautologize the two recorder tests — the
  meter-precedence test now uses distinct readers to prove the meter wins over
  meter_provider; the default-provider test patches get_meter and asserts the
  event lands.

Convention / hygiene:
- test_unit.py: hoist the 6 inline imports (11 occurrences) to module top — all
  were convenience shadows of existing top-level imports or trivially hoistable;
  none were import-behavior tests.
- test_relay.py: drop stale dev-plan references ("this plan", "Task 6") from a
  comment, making it self-contained.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The archived findings doc claimed nothing was deferred, but the prose
"Additional test findings" tail below the T1–T8 table was never tracked or
fixed until #74. Name the tail and record the PR that closed it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 8e97719 into main Jun 13, 2026
3 checks passed
@lesnik512 lesnik512 deleted the test/close-additional-test-findings branch June 13, 2026 13:01
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