Skip to content

refactor(tests): split compact command lifecycle coverage - #123765

Merged
steipete merged 1 commit into
mainfrom
codex/split-compact-command-tests
Aug 14, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/split-compact-command-tests

Conversation

@steipete

@steipete steipete commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Related: #123705

What Problem This Solves

Resolves a CI failure where the compact-command test suite exceeded the 1,000-line oxlint budget after concurrent compaction changes landed on main. The file reached 1,049 effective lines, which blocked unrelated pull requests such as #123705 in the core lint shard.

Why This Change Was Made

The session-authority tests now live in a focused lifecycle suite, while both suites share one mock and fixture module. This preserves all existing cases, gives each suite clear growth headroom, and fixes the max-lines violation without changing or suppressing the ratchet.

Production delta: +0/-0. Tests/support: +328/-285 (net +43).

User Impact

No product behavior changes. Maintainers get the same 38 compact-command regression cases in smaller, independently focused files, and unrelated pull requests are no longer blocked by this max-lines failure.

Evidence

  • Before: src/auto-reply/reply/commands-compact.test.ts was 1,141 physical / 1,049 effective lines on current main; fix(ui): prevent duplicate Skills preload requests #123705's check-lint-core-4 failed on run 31821117620.
  • After: the original suite is 868 physical lines and the lifecycle suite is 213; pinned [email protected] and [email protected] pass all three touched files.
  • Blacksmith Testbox focused proof: 2 files passed, 38/38 tests.
  • Blacksmith Testbox check:changed passed the core-test plan, including max-lines ratchet, formatting, dependency/boundary guards, dead-export scans, test typecheck, and changed-file lint.
  • Exact-head CI is green for checks-node-changed and the formerly failing check-lint-core-4.
  • Autoreview: clean, no accepted/actionable findings (0.99 confidence).

@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete steipete self-assigned this Aug 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 14, 2026, 1:33 PM ET / 17:33 UTC.

ClawSweeper review

What this changes

The PR moves compact-command lifecycle tests into a focused suite and extracts their shared Vitest mocks and fixtures into a test-support module.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer scope review: current main already clears the original max-lines blocker, but this maintainer PR may still be worthwhile after rebasing and consolidating the newly parallel test fixture.

Priority: P3
Reviewed head: bf56830b718c215e77841b201cc46181a9eb02f9
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The lifecycle split is sound, but current-main fixture duplication must be resolved before it is a clean refactor.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior change; the relevant proof is its focused and hosted test evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior change; the relevant proof is its focused and hosted test evidence.
Evidence reviewed 7 items Current main already clears the original lint failure: The test-specific max-lines rule allows 1,000 nonblank, noncomment lines; current main has 925 in the original compact-command suite, versus 1,049 at this PR's base.
The PR preserves the lifecycle assertions: The patch moves six authority/lifecycle cases verbatim and extracts their existing mock baseline; it changes no production source.
Lifecycle behavior has a single production owner: The handler checks session authority before and after awaited run shutdown and compaction work; the moved tests exercise those boundaries.
Findings 1 actionable finding [P2] Consolidate the current context-budget fixture
Security None None.

How this fits together

Compact commands enter the command-handler registry, validate session authority across awaited lifecycle steps, and then invoke session compaction. The changed tests cover those lifecycle safeguards without modifying the production command path.

flowchart LR
  A[Compact command] --> B[Command handler]
  B --> C[Session authority checks]
  C --> D[Compaction runtime]
  E[Lifecycle test suite] --> B
  F[Shared test fixtures] --> E
  G[Context-budget test suite] --> B
Loading

Decision needed

Question Recommendation
Should this PR be rebased as a three-suite cleanup now that current main already satisfies the original max-lines requirement? Rebase and unify fixtures: Keep the lifecycle split, but migrate the current context-budget suite to the shared support module before merge.

Why: The original CI-unblock outcome is present on current main, while the remaining lifecycle split is optional maintenance scope that should be weighed against the added shared-fixture migration.

Before merge

  • Consolidate the current context-budget fixture (P2) - Current main added commands-compact-context-budget.test.ts after this branch's base, with the same runtime mock, fixture builder, and reset setup. Rebase and migrate that suite to this support module so the split does not leave two mock baselines that can drift.
  • Resolve merge risk (P1) - The branch is behind current main, which already removed the lint blocker through a separate context-budget split; merging the branch unchanged leaves duplicate compact-command mock and fixture ownership.

Findings

  • [P2] Consolidate the current context-budget fixture — src/auto-reply/reply/commands-compact.test-support.ts:9-21
Agent review details

Security

None.

PR surface

Source +104, Tests -61. Total +43 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 104 0 +104
Tests 2 224 285 -61
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 328 285 +43

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests and test support +328/-285 (net +43) The change is behavior-neutral test maintenance, so its remaining value is cleaner suite ownership rather than runtime capability.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Use one compact-command test-support module for the general, lifecycle, and context-budget suites, leaving each suite focused while preserving a single mock baseline.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Use one compact-command test-support module for the general, lifecycle, and context-budget suites, leaving each suite focused while preserving a single mock baseline.

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

Not applicable as a product-bug reproduction: current main's compact-command test has 925 effective lines, below the configured 1,000-line cap.

Is this the best way to solve the issue?

No for the original CI unblock, because current main already resolves it; the lifecycle split is best only if it also consolidates the current context-budget fixture.

Full review comments:

  • [P2] Consolidate the current context-budget fixture — src/auto-reply/reply/commands-compact.test-support.ts:9-21
    Current main added commands-compact-context-budget.test.ts after this branch's base, with the same runtime mock, fixture builder, and reset setup. Rebase and migrate that suite to this support module so the split does not leave two mock baselines that can drift.
    Confidence: 0.95

Overall correctness: patch is incorrect
Overall confidence: 0.95

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against e03d1a42f808.

Labels

Label changes:

  • add P3: This is low-risk test-suite maintenance; current main already resolves the reported CI block.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior change; the relevant proof is its focused and hosted test evidence.

Label justifications:

  • P3: This is low-risk test-suite maintenance; current main already resolves the reported CI block.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior change; the relevant proof is its focused and hosted test evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: He has the strongest compact-command history and authored recent current-main work in this area. (role: recent area contributor; confidence: high; commits: 8885be47563f, c3887db7c174; files: src/auto-reply/reply/commands-compact.test.ts, src/auto-reply/reply/commands-compact.ts)
  • Vito Cappello: Recent history shows a focused compaction repair on the same command and test surface. (role: adjacent compaction contributor; confidence: medium; commits: f5c46de8ac50; files: src/auto-reply/reply/commands-compact.test.ts, src/auto-reply/reply/commands-compact.ts)

Rank-up moves

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

  • Rebase onto current main and migrate the context-budget suite to the shared fixture module.
  • Refresh the focused and exact-head validation after the rebased test topology is in place.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-14T17:25:12.464Z sha bf56830 :: needs maintainer review before merge. :: none

@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 14, 2026
@steipete
steipete merged commit 0cd18e1 into main Aug 14, 2026
115 checks passed
@steipete
steipete deleted the codex/split-compact-command-tests branch August 14, 2026 17:43
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant