Repository navigation
improve(reef): strengthen resend metadata and outbound cleanup tests - #156522
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR strengthens Reef resend metadata assertions and settles held outbound sends before fixture cleanup. Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes focused, useful test improvements, with no actionable findings; exact-head CI remains pending. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherReef outbound adapters pass messages through the encrypted flow, which records delivery metadata in worker-owned storage before relay dispatch; these tests inspect that metadata and manage fixture lifetimes. flowchart TD
A[Outbound adapter] --> B[Reef message flow]
B --> C[Guard classification]
C --> D[Worker delivery storage]
D --> E[Relay transport]
F[Test assertions and cleanup] --> B
F --> D
Technical reviewBest possible solution: Keep the existing fixtures and production owners, tighten metadata assertions, and always release and settle held sends before database teardown. Do we have a high-confidence way to reproduce the issue? The base source accepts arbitrary hash strings and numeric timestamps, and an assertion before its try block can leave the guard-held send unsettled; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch is a small complete repair of the stated test weaknesses: independent expected metadata and finally-owned cleanup preserve existing lifecycle assertions without introducing another owner or helper layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a7a8c397dda7. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +14. Total +14 across 2 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 29, 2026, 5:50 AM ET / 09:50 UTC (Revision 3). |
Baseline-Refresh: ab72e2064acec306a46234b494147abe33f1755f
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
|
@clawsweeper re-review Please review exact current head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…penclaw#156522) * refactor(reef): use canonical trust storage in flow tests * fix: refresh the reviewed correction baseline Baseline-Refresh: ab72e2064acec306a46234b494147abe33f1755f * test(reef): assert resend metadata and drain held sends Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Reef's resend tests accepted arbitrary payload hashes and timestamps, and an assertion failure while an outbound guard was held could leave its send running into fixture teardown.
User Impact
No user-visible behavior change. This is a test-only change: two test files, +34/−20 lines; production delta 0. No migration or operator action.
Why This Change Was Made
Assert the independent hash of the actual padded message and bound the persisted send timestamp around the send. The held-guard fixture now observes the send immediately and always releases its authorities and gate, then joins that same send before database cleanup. The unapproved-peer fixture also releases its authority.
Reconciliation preserves current SQLite fixtures, awaited seeding, scheduler cleanup and retired paths. The original
overdueNotifiedAtclock bracket is intentionally not restored: current consumers use a once-only marker, already covered by the trust-store tests; elapsed-time behavior usessentAt.Evidence
--maxWorkers=1; 45/45 tests passed on each. Default pinned Bun on macOS; unchanged database-worker configuration and isolation.Measured costs and proof limits
flow-receipts.test.tsflow-send.test.tsflow.test.tsoutbound.test.tstransport-capacity-recovery.test.tsThese are the native runner's printed suite durations, not complete per-file process wall times. JSON test spans and summed case durations measure another layer. Whole-command wall time was 114.704 s at baseline and 204.946 s at the candidate; preparation of 46.093 s and 113.737 s respectively is included. These timings are not additive, matched benchmarks or evidence of a speedup.
Control command wall times: hash 26.552 s, past timestamp 13.115 s, future timestamp 18.349 s, held-guard cleanup 20.814 s. The hash control's first validator expected object-diff text absent from Vitest's JSON stack field; an independently reviewed validator-only correction qualified the retained exact assertion frame and original execution/restoration receipt without rerunning it.
This is fixture and owner-boundary proof, not live-channel, restart or real-timeout proof. Fixed sensitive-body exclusions remain unread; no credential-internals claim. Dependency contracts were inspected directly, while the isolated local reviewer received explicit allowed repository context rather than vendor source.
Follow-up outside this patch: other mocked-flow outbound fixtures could consolidate explicit authority ownership; this change does not claim to repair every fixture lifetime.