Repository navigation
test(review): drive review and apply rules through behavior instead of source text - #1807
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 replaces source-text assertions with behavioral tests for review, apply, recovery, and status commands, and removes an unused test wrapper. Review scores
ProductKind: Test only · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful: current main still contains the brittle assertions it replaces, and the review found no actionable patch defect. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherClawSweeper records reviews of GitHub items and checks freshness and ownership before publishing decisions or closing items. These tests exercise those safeguards and the commands that write status and reconcile recovery labels. flowchart TD
A[Test fixtures] --> B[Review and apply owners]
A --> C[Status and recovery commands]
B --> D[Recorded reviews and guarded actions]
C --> E[Status files and loopback HTTP]
D --> F[Behavior assertions]
E --> F
Technical reviewBest possible solution: Keep behavioral coverage in the existing command entry points and production owners while preserving the established safeguards. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR replaces brittle tests rather than fixing a reported runtime bug; the body records mutation checks for the protected behaviors. Is this the best way to solve the issue? Yes: exercising existing command entry points and owners is a maintainable replacement for source-text assertions, and existing publication tests cover the removed ordering checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3009fdbb5be9. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes: No label 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 9, 2026, 6:23 AM ET / 10:23 UTC (Revision 3). |
f51797d to
194ca9b
Compare
194ca9b to
89f3446
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
What
Remove every source-text test from the review/apply cluster (row 7 of the cleanup plan). Each test that read
src/**or raw.github/**text is now a behavior test through a real entry point, one parsed-YAML guard, or deleted with a named covering test.review-comment-rendering)review-command-workflow.test.ts"scheduled structural-clean / content-clean …" (drivescreateReviewCommandWorkflow; hydration throws on a structural hit,structuralFetches >= 2, inspection call,runner_preflight_v1, metrics file). Gaps closed in that test: the carried report now must carry the lease owner and comment id, and a newcontent-heldscenario assertscoordination-held.jsongets the winning lease expiry.gitInforelease pins → newreview-blob-hydration.test.ts"review git info trusts only the release marked latest and fails closed otherwise" (real git, fakegh release list). Pull-check digest pins deleted:reviewStructuralRecordFromGraphqlreturns no PR record without a valid checks digest (fail closed).releaseStateCompleteshort-circuit pin deleted: release identity is part of the fingerprint (review-structural-cache.test.ts"changed author association or release identity forces hydration").review-comment-rendering)reviewStartLeaseWinnerCommentIdForTest, existing export).review-comment-rendering)apply-label-sync.test.ts"exact publication rechecks after batched labels and again before close" (ownedLeaseReleaseIndex > closeIndex, no DELETE of the superseded lease). The close-time recheck inapply-close-executionhad no behavior coverage, so newapply-lease-guards.test.ts"apply does not close an item after it loses its mutation lease during close execution" drives exportedexecuteApplyClose.review-comment-rendering)apply-label-sync.test.ts"exact publication rechecks after batched labels and again before close" (exact publication withclawsweeper-recovery-stuck: one batched label edit after the durable comment PATCH, recovery label gone) and "apply-decisions clears a recovery escalation only after publishing a completed PR review".review-activity-cursor)frontMatterValue→ realcreateApplyReviewActivityGuard(same cursor passes, changed cursor blocks).review-placeholder-recovery)dist/review-placeholder-recovery.jsagainst a loopback GitHub/queue server and asserts the target-token label DELETE. This covers the CLI wiring that only the slice checked.sweep-status)dist/clawsweeper.js statusin a private root (symlinkeddist). The oldsweepStatusApplyHealthForTesttest became one of them and the wrapper is deleted.review-output-policy)sweep-workflow.test.ts"exact oversized PR admission uses the built predicate…" checks on the parsed step; the CLI itself refuses hosted review without debug retention ("hosted review requires explicit debug retention and destination").review-prompt-context)test/structural-invariants.test.ts: parsed sweep.yml env maps; everyCLAWSWEEPER_UNCONFIRMED_PRODUCT_DIRECTION_CLOSE_ENABLEDvalue defaults to'false'.test/structural-invariants.test.tsis not on main yet, so this PR creates it with the shared header and adds its guard under// review-prompt-context.test.ts guards.Why
These tests pinned identifiers, slices and call order. Any rename or extraction broke them while behavior stayed the same. The replacements test the behavior through the CLI or the exported owner.
Proof
Counter (
count-source-text.mjs), merge base26c28e7:export function *ForTestin src: 10 → 10. Unique*ForTestnames in src: 96 → 95 (sweepStatusApplyHealthForTestremoved with its runtime re-export). Diff: +418 / −297 (src −10 lines).Mutation proofs (local src or workflow edit, rebuild, run the test, revert):
statusCommand: drop thestate.startsWith("Apply ")clearsweepStatusApplyHealth: norun_urlstampwriteSweepStatus: droppreviousStatus?.lastCloseApplyHealth ??sweepStatusApplyHealth: do not keep previous healthreview_activity_cursor: unknownrunReviewPlaceholderRecovery({})contributorauthorreview_lease_owner: unknowncoordination-held.jsonnever writtengitInfousesreleases[0]currentApplyMutationLeaseBlockReason()calls in close execution →null(also: keep only the first)'false'→'true'Coverage checks for (c) claims (mutation, covering test fails): lease released before
executeApplyCloseand recovery batch flushed before publication →apply-label-sync"exact publication rechecks after batched labels and again before close"; structural revalidation skipped, or hydration on a structural hit → "scheduled structural-clean …".Shipped CLI path (
status, touched by the wrapper removal): main (merge base, built fromgit archive) and branch give byte-identical status JSON (exceptupdated_at) for anApply startedupdate over a retained close health.pnpm run check: green atf51797dca(exit 0; node tests 7003, pass 6966, fail 0). After rebasing onto main for aclawsweeper-runtime.tsconflict, re-run at194ca9b1b: 7005 tests, one failure in the known load flaketest/repair/command-proof-consumer.test.ts(180 s timeout); re-run alone it passes 29/29. Lint, format and typecheck clean.Codex dispositions
codex review --base origin/main: "No actionable defects were found against the supplied merge base." Nothing to fix.Merge Danger
Low. Src change is the removal of an unused test-only wrapper and its re-export; no runtime path changes.
test/structural-invariants.test.tsis also created by the open cleanup-r7 branches; whichever merges second resolves the add/add conflict by keeping both sections.