Skip to content

improve(reef): strengthen resend metadata and outbound cleanup tests - #156522

Merged
vincentkoc merged 3 commits into
mainfrom
refactor/reef-test-fixtures-20260923
Oct 29, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
refactor/reef-test-fixtures-20260923

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

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 overdueNotifiedAt clock bracket is intentionally not restored: current consumers use a once-only marker, already covered by the trust-store tests; elapsed-time behavior uses sentAt.

Evidence

  • Baseline and candidate: the same five complete suites in one normal serial repository-runner invocation each, --maxWorkers=1; 45/45 tests passed on each. Default pinned Bun on macOS; unchanged database-worker configuration and isolation.
  • Four causal controls qualified: a schema-valid wrong hash, positive stale timestamp, positive future timestamp, and an assertion failure while the guard is held. Each produced only its intended failure and restored the exact committed source. The cleanup control observed send settlement and authority release before actual database cleanup, then successful cleanup, real timers and state-directory removal.
  • Targeted formatting, lint, diff checks and the test-lines ratchet passed: 6,257,805 lines against an effective ceiling of 6,322,950. Changed-check classification completed.
  • Exact-head CI passed: all 50 jobs terminal (17 successful, 33 skipped). Changed-test types passed, including the actual extension-test leaf in 20.6 s (85 s whole job). Extension lint, baseline ratchets, and changed-extension tests passed in 129 s, 738 s and 152 s whole-job wall time respectively; these include setup and are separate from the local suite timings below.
  • Fresh independent local review completed with no actionable P0–P3 findings. The full exact-head ClawSweeper review, revision 3, has no findings, before-merge actions or rank-up moves.
Measured costs and proof limits
Suite Tests Baseline reported suite time Candidate reported suite time
flow-receipts.test.ts 9 8,667 ms 11,644 ms
flow-send.test.ts 3 3,525 ms 3,989 ms
flow.test.ts 20 8,714 ms 11,811 ms
outbound.test.ts 10 2,150 ms 2,878 ms
transport-capacity-recovery.test.ts 3 3,638 ms 4,227 ms

These 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.

@vincentkoc vincentkoc self-assigned this Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: reef Channel integration: reef size: L labels Sep 23, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 23, 2026
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR strengthens Reef resend metadata assertions and settles held outbound sends before fixture cleanup.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test improvement supported by reported in-process controls; the evidence appropriately makes no shipped-entry-point claim.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR changes no shipped runtime behavior; its body reports owner-boundary suite runs and targeted wrong-metadata and cleanup controls without claiming live-channel proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Weak metadata checks can miss delivery regressions, and a failed held-guard assertion can contaminate fixture teardown.
Reason: The maintainer-authored direction adds distinct regression detection and reliable cleanup within existing tests, with no production or configuration change.

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
Reviewed head: c8e6ecf9c427df82f1f2c7143a3d3acaf3e6ec89

Before merge

None.

Findings

None.

Agent review details

How this fits together

Reef 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
Loading

Technical review

Best 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

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Exact introduced change: The pinned introduction diff changes only the two test files: independent payload-hash and timestamp assertions, immediate rejection observation, and finally-based authority release and send settlement. (extensions/reef/src/outbound.test.ts:97, c8e6ecf9c427)
  • Independent hash verified: SHA-256 of the canonical payload {"text":" rephrased coordination "} equals the newly asserted 44d4b2f2632d2133b1289c24b32a715064283bbc7ff233af31d5ce0c42be87fe; the production proposal hashes the original body rather than normalized resend text. (extensions/reef/src/flow-send.test.ts:81, c8e6ecf9c427)
  • Cleanup ordering: The fixture closes the state database in afterEach; the changed finally block releases both authorities, resolves the paused guard, and awaits the observed send before that teardown can begin. (extensions/reef/src/outbound.test.ts:113, c8e6ecf9c427)
  • Original lifecycle contract preserved: fix(reef): stop exposing retired account runtime #129131 established generation-owned revocation and protection of the replacement runtime; this PR retains the rejection, no-relay-I/O, and replacement-runtime assertions. (extensions/reef/src/outbound.test.ts:110, 0f927537045a)
  • Current main and prior review reconciled: Current-main comparison confirms the metadata weakness and cleanup gap remain; GitHub reports this exact head mergeable, so the previous review's conflict warning is resolved. (a7a8c397dda7)
  • Reported validation and current checks: The full PR body reports baseline/candidate 45-test passes and four targeted causal controls, explicitly limiting claims to fixture and owner-boundary behavior; live REST checks show the aggregate CI gate pending and dependency/security-sensitive review statuses successful. (c8e6ecf9c427)

Likely related people:

  • Peter Steinberger: Raw commit 0f92753 adds extensions/reef/src/outbound.test.ts:140 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0f927537045a; files: extensions/reef/src/outbound.test.ts)

PR surface

Tests +14. Total +14 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 34 20 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 34 20 +14

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0/-0; tests +34/-20, net +14 Growth strengthens independent metadata checks and failure-path teardown without adding production machinery or new test cases.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is a focused test reliability improvement with no shipped behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-23T13:19:45.228Z sha 5ea5656 :: needs changes before merge. :: none
  • reviewed 2026-10-08T10:19:23.652Z sha 5ea5656 :: blocked before merge. :: none

Reviewed October 29, 2026, 5:50 AM ET / 09:50 UTC (Revision 3).

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@vincentkoc vincentkoc changed the title refactor(reef): use canonical trust storage in flow tests improve(reef): strengthen resend metadata and outbound cleanup tests Oct 29, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 29, 2026 09:45
@clawsweeper

clawsweeper Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact current head c8e6ecf9c427df82f1f2c7143a3d3acaf3e6ec89. The PR body records the reconciled fixture scope, five-suite baseline/candidate proof, four causal controls, measured costs and remaining hosted checks.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 29, 2026
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@vincentkoc
vincentkoc merged commit 523deb3 into main Oct 29, 2026
200 of 201 checks passed
@vincentkoc
vincentkoc deleted the refactor/reef-test-fixtures-20260923 branch October 29, 2026 10:07
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: reef Channel integration: reef P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant