Skip to content

refactor(tests): prune duplicate state-read capture cases - #182936

Merged
steipete merged 1 commit into
mainfrom
dbasync/testprune
Oct 24, 2026
Merged

steipete merged 1 commit into
mainfrom
dbasync/testprune

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The state-read transport tests repeat command-by-command snapshot and byte-accounting scenarios after those operations moved to generic structural owners in #169379 and #169754.

User Impact

No production behavior changes. This removes 17 redundant cases from two test files (41 → 24, −41.5%) and 215 net test lines (1,104 → 889).

Why This Change Was Made

Keep four representative capture cases for nested Unicode fields, arrays, booleans/numbers, prepared/queued mutation, and ACP batches. Remove command-name variants that exercise the same generic structured clone and byte walker. All lifecycle, authority, storage, migration, and PostgreSQL proof remains. There are no production changes or new seams.

The owner audit covered 36 test files and 340 expanded cases, including a final bounded session/transcript pass. This batch is smaller than the 30–150 target: the remaining worker tests protect distinct failures and were retained rather than used to fill a quota.

Removed rows and surviving proof

All removed rows exercise the same generic command snapshot and byte-charge owner; their mocked replies do not test domain reads.

Removed rows Retained capture/charging proof
onboardingRecommendations.read; workspace.snapshot; pluginBlob.lookup/entries; sandboxRegistry.get/runtimeIds; updateRuns.get (7) githubPublications.sharedObservation: nested objects and UTF-8 selectors
updateRuns.list (1) updateRuns.reconciliationCandidates: arrays, booleans, numeric fields and mutation
subagents.runs descendants/maintenance; skills.library.manifests (3) acpSessions.metadata batch: arrays of objects, nested arrays and optional entries
abbreviated audit.run.inspect queries (2) Full audit.run.inspect query: prepared capture and mutation while queued
mcpOAuth.statuses; userPreferences.values (2) acpSessions.metadata batch: complete batch capture and incremental byte charging
workerPlacements.changeSnapshot; agentDeletionJournal.status (2) Retained generic transport tests above, through the same captureOpenClawStateReadSource owner

Evidence

Acceptance rule recorded before the first run: run the two changed suites on pinned base a31e54a90d6 and candidate; count 41 → 24 expanded cases with zero lost distinct contracts and all retained tests passing. No new static findings. Warm timing requires the campaign lock, load <24, at least five interleaved samples per revision; cold runs stay separate. Report median/p95/range; a >20% regression stops acceptance. If the host stays busy for 60 minutes, report counts and test outcomes with no wall-time claim.

Codex review found no accepted/actionable P0–P2 findings. Formatting, type-aware core lint and diff whitespace checks pass. The initial default lint command attempted plugin declarations and refused the external virtual store; the supported core configuration passed without that unrelated preparation. Focused baseline: 41/41 cases pass; candidate: 24/24 pass. Exact-head CI run 40135535259 passed changed tests, types, lint, source contracts, architecture and baseline ratchets. PostgreSQL shards 1 and 3 passed; shard 2 failed seven unrelated interactive-setup cases because its synthetic runtime omitted standalone-runtime-profile.mjs. The maintainer has attributed this to the main-branch fixture regression introduced by #182856 (4a38dbd): createSourceRuntime omits the newly required root file. The failing test and fixture helper are untouched by this PR; their blobs match the CI main parent. The coordinator has authorized inherited-failure landing while the separate repair is in progress. Exact failure: run 40135535259, job 120996441483; the aggregate ci-gate is red for the same failure. Every other executed CI job passed. This lane does not claim a separate main execution. Local baseline/candidate dead-code comparisons are identical: 48 dependency, 63 unused-file, and 1,233 export finding lines, zero new findings. Refreshed census covers 2,691 other open main-target PRs with zero overlapping files, so no merge-tree comparison is applicable. No SQL harness is needed for this test-only change.

Timing fallback: after more than 60 minutes waiting (21:41:48–22:41:52 UTC on 2026-10-24), host load remained above the required <24 threshold and no qualified samples were collected. Correctness-only Vitest durations were 101.41 seconds baseline and 24.96 seconds candidate, but these runs had different cache state and heavy host contention; they are not an A/B result. Acceptance uses counts and passing retained contracts. No speedup, median/p95, or CPU saving is claimed.

The read transport now snapshots and charges commands through generic structural owners. Keep representative nested, array, prepared and queued captures while removing 17 command-name variants. All lifecycle and authority cases remain; production code is unchanged.
@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@steipete
steipete marked this pull request as ready for review October 24, 2026 21:44
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T21:45:53.381213Z 123d530 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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 Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR removes redundant command-specific capture tests while retaining representative structural capture and byte-accounting cases.

Example: An ACP metadata batch contains keys ["principal-根🦞", "second-principal"] that change after submission.

  • Before: The suite checks batch capture alongside equivalent MCP OAuth and user-preference variants.
  • After: The retained ACP case still checks the original keys and byte charge through the shared transport.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused and source-supported test cleanup with successful Node and static checks; validation remains limited to test coverage, and the required CI gate is unresolved.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR changes only tests and requires no shipped-behavior demonstration; successful current-head Node checks support the retained suites.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction reduces repetitive test maintenance while preserving representative transport contracts and all unchanged lifecycle and authority cases.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-directed test cleanup preserves distinct capture and lifecycle coverage, with no introduced defect found; the required CI gate remains red.

Priority: P3
Reviewed head: 123d53089c077b30acad792a61ec4e032f77b97e

Before merge

None.

Findings

None.

Agent review details

How this fits together

State-read callers pass commands into a transport that captures their inputs, accounts for queued bytes, and dispatches reads through the worker pool.

flowchart LR
  A[State read caller] --> B[Read operation owner]
  B --> C[Transport deep capture]
  C --> D[Structural byte accounting]
  D --> E[Worker pool]
  E --> F[Read result and cleanup]
Loading

Technical review

Best possible solution:

Retain this focused consolidation and settle the required CI failure before landing.

Do we have a high-confidence way to reproduce the issue?

No product bug is claimed; source inspection confirms that the removed command variants exercise generic capture and accounting owners.

Is this the best way to solve the issue?

The patch is a small, coherent cleanup: retain distinct structural and lifecycle failures in the existing suites and remove duplicate command-name variants.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8c6ad0edc3c9.

Provenance checked

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Verified PR scope: The introduced diff changes only the two test suites; the verified synthetic merge also changes only those files relative to its base parent. (123d53089c07)
  • Shared capture and accounting owners: createReadTransport deep-clones every command before yielding, and requestBytes walks captured values structurally rather than selecting command-specific fields; these production files match fetched main. (src/state/openclaw-state-read-worker.ts:263, 8c6ad0edc3c9)
  • Distinct retained contracts: Retained cases cover nested Unicode selectors, arrays, booleans and numbers, mutation before preparation and queued dispatch, and complete ACP batches; stream cancellation, revocation, cleanup failure, sibling isolation, and generation ownership remain unchanged. (src/state/openclaw-state-read-worker.test.ts:474, 123d53089c07)
  • Prior owner decisions: refactor: simplify private state and process transports #169379 established structural queue accounting, and refactor(state): simplify private reader and error transport #169754 replaced per-command capture with one deep clone; their recorded rationale supports removing equivalent transport-only variants. (src/state/openclaw-state-read-request.ts:6, 22e89d92d55f)
  • Current-head validation: Current-head changed Node tests, compact Node tests, changed-boundary tests, lint, and selected test-type checks succeeded. PostgreSQL conformance failed on interactive-setup PTY exits before onboarding authentication, and the aggregate gate reports that lane's failure; no matching base failure or head-versus-revert comparison establishes attribution. (123d53089c07)
  • Inspection limits and checkout integrity: Root policy was read in full; no additional ancestor AGENTS.md governs these paths, and the maintainer-notes directory is absent. Historical blob inspection encountered unavailable promisor objects, and job-log downloads were blocked at GitHub's storage host; REST job results and annotations remained readable. Final git status is clean. (AGENTS.md, 123d53089c07)

PR surface

Tests -215. Total -215 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 137 352 -215
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 137 352 -215

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0/-0; tests +137/-352, net -215 The reduction removes equivalent command variants without introducing production machinery or test seams.

Labels

Label changes:

  • add P3: This is low-risk test maintenance with no production behavior change.
  • 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.

Label justifications:

  • P3: This is low-risk test maintenance with no production 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.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Establish the PostgreSQL setup failure's attribution with matching base evidence or a head-versus-revert comparison.

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.

Reviewed October 24, 2026, 6:16 PM ET / 22:16 UTC.

@steipete
steipete merged commit 51400ac into main Oct 24, 2026
197 of 201 checks passed
@steipete
steipete deleted the dbasync/testprune branch October 24, 2026 22:31
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
Consolidate command-name variants after state-read snapshotting and byte accounting moved to generic owners. Retain nested Unicode, arrays, numeric/boolean fields, prepared and queued mutation, and ACP batch coverage.

Remove 17 redundant cases and 215 net test lines across two suites. No production behavior changes. Focused baseline and candidate suites pass; static diagnostics add no findings.

The unrelated PostgreSQL interactive-setup fixture failure in CI run 40135535259 is inherited from openclaw#182856 and attributed by the campaign coordinator; the separate repair owner is handling it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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