Repository navigation
test(discord,gateway,wizard,agents,heartbeat,cron): remove low-value tests (batch d085) - #160481
Conversation
Remove duplicate context projections, thread-policy and preview matrix rows, reply-hydration variants, and mocked core binding/retry replays. Reuse local hydration and durable-recovery fixtures. Keep both original Vitest projects. Tests: 103 -> 65 (-36.9%). Test LOC: 3294 -> 2229 (-32.3%). Coverage: statements 1954 -> 1946 (-0.41%); branches 1457 -> 1451 (-0.41%); functions 373 -> 368. Both groups included; no file loses >3 statements. The requested 50% reduction was not reached. Retention rationale follows. R1 = distinct covered owner statements/branches; R2 = verified regression; R3 = security boundary. Table rows below remain separate executed cases. ack-policy: - Current policy, account undefined/off (2): R1 global fallback/account override; R2 1b3da64 acknowledgement changes without reconnecting. bot-self-filter: - Skip own messages before debounce: R1 early self-filter completion branch. debounce-policy: - Change timing without losing queued messages: R1 multi-original flush and cancellation of pending entries. debounce-reply-target: - Separate ordinary batch and another-message reply: R1 reply-key partition; R2 09f9e53. preflight-channel-context: - Unicode display names preserve matching slug: R2 d419bcf. context: - Batched/singleton identities (2): R1 both source-ID projection branches. - Bot sender, host builder and live owner authority: R2 984f5a5, 34f29ed, 286ff4f; R3 revocation and opaque route authority. - Canonical guild ID: R2 8668aeb. - PluralKit remains human: R2 984f5a5; R1 proxy sender branch. - Forwarded media recorded once: R1 room-event recording and frozen provenance. - Forwarded command text stays ordinary content: R2 fc5e53d; R3 provenance. - Missing attachment notice: R2 a68ff99; R1 singular notice. - Escaped malicious transcript: R2 97fe326; R3 untrusted framing. - Plural notice/resolved attachment: R1 plural and resolved-media branches. context-history: - Quiet ingress/debounced originals: R1 native recovery entry and exclusions; R2 6e5f6f9. - Pagination: R1 second physical REST page. - Allowlisted identities: R1 filtering; R3 sender visibility. - Cold role lookup: R1 native guild-member read. - Unchanged/replaced cached media (2): R1 both media-identity branches. - REST failure without stale fallback: R1 catch; R3 stale context exclusion. - Zero history: R1 no-fetch history branch. - Bound-session reset cutoff: R1 bound scope/cutoff; R3 reset isolation. - Existing tombstone: R1 no-recovery state; R3 reset isolation. - Abort/policy/reset/tombstone during REST (4): R1 distinct invalidation guards; R3 authority and lifecycle revalidation. - Active thread/cross-room/future rows: R1 filtering; R3 conversation isolation. - Auto-thread parent history and parent ID: R1 auto-thread exclusion; R2 0b85966. - Other-bot history excluding self: R2 b078de4. preflight-owned-threads: - Schema overrides/default/type rejection: R1 restoring this case recovered 45 config-schema statements and 17 branches in the measured comparison. - Explicit relaxed policy/automatic thread/guild override (3): R1 distinct mention-policy resolution paths. - Strict explicit mention/implicit reply (2): R1 acceptance and rejection. - Human-owned thread: R1 ownership mismatch. - Disallowed sender: R3 sender authorization. draft-preview.rest: - Accepted/refused handoff (2): R1 adoption branches; R2 24a03ac. - Late handoff with queued preview: R1 changed-message-ID ownership branch. - Retained preamble after final gate: R1 delayed publication; R2 24a03ac. - Missing ID/failed edit (2): R1 distinct unconfirmed-receipt guards. - Authority revoked while awaiting receipt: R3 live authority. - Block-mode plan retract/resume: R1 chunker, progress deletion and reset. - Error final retains draft: R1 final-delivery retention lifecycle. - Late queued preview/teardown with repeated delete failure (2): R1 distinct cleanup paths; R2 d27b0e9. hydration: - Partial internal message/getters: R1 partial reconstruction and metadata. - Failed current-message hydration: R1 unavailable outcome. - Empty bot reply in referenced channel: R1 empty nested payload; R2 5cd1d13 and b078de4. - Mismatched nested reply success/failure (2): R1 invalid payload recovery and discard branches; R3 exclusion of unrelated reply context. - Missing reply fetch failure: R1 original-message fallback. - Deleted/forwarded references: R1 intentional no-hydration branches. ingress-recovery: - Cancellation routes and replacement: R1 dispatch/buffer/preflight cancellation and exhausted-row settlement; R2 5af3d49. - Pending admission shutdown: R1 active admission ownership and draining. - Exhausted queued processing failure: R1 queued abandonment and follower release. - Started job returns/throws after cancellation (2): R1 success/catch cancellation; R2 286ff4f. - Queued job skipped on deactivation: R1 skipped-job cleanup; R2 286ff4f. Removed core stale-binding replays are owned by get-reply.binding-route-owner, dispatch-from-config.binding-activity, dispatch-from-config.ordinary-hook-route-change, and ingress-retry-policy tests; the removed Discord hooks built the route and context themselves. Removed visibility-only mock proof is covered through message-handler.process.draft-progress's unacknowledged-preamble case. No production or shared support edits. Baseline tests were green. Restored schema coverage after the first comparison and reverted a shared-helper reuse that orphaned an out-of-scope export. No test retries, skips, timeout increases, weakened assertions, or config/ratchet changes. Validation: full remaining shard 65/65 passed (44.42s); final hydration 7/7 passed (42.66s) after the behavior-neutral mock-reference lint fix. Both coverage groups passed; the snapshot remains applicable across that reference-only change. Final check:changed exited 0, including types, boundaries, dead exports, and extension lint (0 warnings, 0 errors). Local oxfmt, plain oxlint, and diff checks passed. No hosted CI or autoreview was run under this shard workflow. Lease-expiry retries only affected source preparation; completed failing gate attempts were stopped before blind retry.
Port t0068 onto the campaign lane while retaining the interval-only fake timers and both typing cases updated on main. Validation: Testbox passed all 18 tests (14 tool-response, 4 typing), with no skips. oxlint, oxfmt --check, and git diff --check passed. Independent review found no actionable issues.
|
🦞👀 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: blocked before merge. Reviewed September 28, 2026, 10:07 AM ET / 14:07 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch consolidates and removes tests for Discord, Gateway sessions, onboarding, prepared models, heartbeat, and cron, and removes two line-limit baseline entries. Merge readiness⛔ Blocked before merge - 6 items remain This cleanup remains useful because current main still contains the tests it removes. Two distinct onboarding regression checks lose focused coverage, so the branch is not ready to merge. Priority: P3 Review scores
Verification
How this fits togetherThese suites exercise OpenClaw behavior at channel, agent, Gateway, and setup boundaries. Their assertions feed the test and CI results maintainers use to detect regressions before merging. flowchart LR
A[Product behavior] --> C[Focused test suites]
B[Test fixtures] --> C
C --> D[Assertions]
D --> E[Test and CI results]
E --> F[Maintainer review]
Before merge
Findings
Agent review detailsSecurityNeeds attention: No production authority or supply-chain code changes, but the branch removes a distinct authorization-boundary regression check. PR surfaceTests -11858, Other -2. Total -11860 across 57 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the reduced suite while retaining one focused check for authorization before every provider copy and one for committed-import recovery after a valid config edit. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR maintains tests rather than reporting a runtime bug. The coverage gaps are visible by comparing the deleted cases with the surviving tests and production branches. Is this the best way to solve the issue? No, not yet. Fixture consolidation is a reasonable approach, but these two distinct regression checks should survive it. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e0def1451b3. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…tests (batch d085) (openclaw#160481) * test(discord): deslop t0072 tests * test(gateway): deslop t0059 tests * test(wizard): deslop t0073 tests * test(agents): deslop t0079 tests * test(discord): deslop t0069 tests Remove duplicate context projections, thread-policy and preview matrix rows, reply-hydration variants, and mocked core binding/retry replays. Reuse local hydration and durable-recovery fixtures. Keep both original Vitest projects. Tests: 103 -> 65 (-36.9%). Test LOC: 3294 -> 2229 (-32.3%). Coverage: statements 1954 -> 1946 (-0.41%); branches 1457 -> 1451 (-0.41%); functions 373 -> 368. Both groups included; no file loses >3 statements. The requested 50% reduction was not reached. Retention rationale follows. R1 = distinct covered owner statements/branches; R2 = verified regression; R3 = security boundary. Table rows below remain separate executed cases. ack-policy: - Current policy, account undefined/off (2): R1 global fallback/account override; R2 695e50f acknowledgement changes without reconnecting. bot-self-filter: - Skip own messages before debounce: R1 early self-filter completion branch. debounce-policy: - Change timing without losing queued messages: R1 multi-original flush and cancellation of pending entries. debounce-reply-target: - Separate ordinary batch and another-message reply: R1 reply-key partition; R2 21bcb7c. preflight-channel-context: - Unicode display names preserve matching slug: R2 5e837c1. context: - Batched/singleton identities (2): R1 both source-ID projection branches. - Bot sender, host builder and live owner authority: R2 f6bd064, e0e72a8, 17b26dc; R3 revocation and opaque route authority. - Canonical guild ID: R2 ffb2614. - PluralKit remains human: R2 f6bd064; R1 proxy sender branch. - Forwarded media recorded once: R1 room-event recording and frozen provenance. - Forwarded command text stays ordinary content: R2 ff56fbb; R3 provenance. - Missing attachment notice: R2 0644c5f; R1 singular notice. - Escaped malicious transcript: R2 15cc80f; R3 untrusted framing. - Plural notice/resolved attachment: R1 plural and resolved-media branches. context-history: - Quiet ingress/debounced originals: R1 native recovery entry and exclusions; R2 ddca0dd. - Pagination: R1 second physical REST page. - Allowlisted identities: R1 filtering; R3 sender visibility. - Cold role lookup: R1 native guild-member read. - Unchanged/replaced cached media (2): R1 both media-identity branches. - REST failure without stale fallback: R1 catch; R3 stale context exclusion. - Zero history: R1 no-fetch history branch. - Bound-session reset cutoff: R1 bound scope/cutoff; R3 reset isolation. - Existing tombstone: R1 no-recovery state; R3 reset isolation. - Abort/policy/reset/tombstone during REST (4): R1 distinct invalidation guards; R3 authority and lifecycle revalidation. - Active thread/cross-room/future rows: R1 filtering; R3 conversation isolation. - Auto-thread parent history and parent ID: R1 auto-thread exclusion; R2 0aafd7e. - Other-bot history excluding self: R2 b312707. preflight-owned-threads: - Schema overrides/default/type rejection: R1 restoring this case recovered 45 config-schema statements and 17 branches in the measured comparison. - Explicit relaxed policy/automatic thread/guild override (3): R1 distinct mention-policy resolution paths. - Strict explicit mention/implicit reply (2): R1 acceptance and rejection. - Human-owned thread: R1 ownership mismatch. - Disallowed sender: R3 sender authorization. draft-preview.rest: - Accepted/refused handoff (2): R1 adoption branches; R2 6573afc. - Late handoff with queued preview: R1 changed-message-ID ownership branch. - Retained preamble after final gate: R1 delayed publication; R2 6573afc. - Missing ID/failed edit (2): R1 distinct unconfirmed-receipt guards. - Authority revoked while awaiting receipt: R3 live authority. - Block-mode plan retract/resume: R1 chunker, progress deletion and reset. - Error final retains draft: R1 final-delivery retention lifecycle. - Late queued preview/teardown with repeated delete failure (2): R1 distinct cleanup paths; R2 7e91c2d. hydration: - Partial internal message/getters: R1 partial reconstruction and metadata. - Failed current-message hydration: R1 unavailable outcome. - Empty bot reply in referenced channel: R1 empty nested payload; R2 da471a8 and b312707. - Mismatched nested reply success/failure (2): R1 invalid payload recovery and discard branches; R3 exclusion of unrelated reply context. - Missing reply fetch failure: R1 original-message fallback. - Deleted/forwarded references: R1 intentional no-hydration branches. ingress-recovery: - Cancellation routes and replacement: R1 dispatch/buffer/preflight cancellation and exhausted-row settlement; R2 2cd1614. - Pending admission shutdown: R1 active admission ownership and draining. - Exhausted queued processing failure: R1 queued abandonment and follower release. - Started job returns/throws after cancellation (2): R1 success/catch cancellation; R2 17b26dc. - Queued job skipped on deactivation: R1 skipped-job cleanup; R2 17b26dc. Removed core stale-binding replays are owned by get-reply.binding-route-owner, dispatch-from-config.binding-activity, dispatch-from-config.ordinary-hook-route-change, and ingress-retry-policy tests; the removed Discord hooks built the route and context themselves. Removed visibility-only mock proof is covered through message-handler.process.draft-progress's unacknowledged-preamble case. No production or shared support edits. Baseline tests were green. Restored schema coverage after the first comparison and reverted a shared-helper reuse that orphaned an out-of-scope export. No test retries, skips, timeout increases, weakened assertions, or config/ratchet changes. Validation: full remaining shard 65/65 passed (44.42s); final hydration 7/7 passed (42.66s) after the behavior-neutral mock-reference lint fix. Both coverage groups passed; the snapshot remains applicable across that reference-only change. Final check:changed exited 0, including types, boundaries, dead exports, and extension lint (0 warnings, 0 errors). Local oxfmt, plain oxlint, and diff checks passed. No hosted CI or autoreview was run under this shard workflow. Lease-expiry retries only affected source preparation; completed failing gate attempts were stopped before blind retry. * test(discord): deslop t0070 tests * test(heartbeat): deslop t0068 tests Port t0068 onto the campaign lane while retaining the interval-only fake timers and both typing cases updated on main. Validation: Testbox passed all 18 tests (14 tool-response, 4 typing), with no skips. oxlint, oxfmt --check, and git diff --check passed. Independent review found no actionable issues. * test(agents): deslop t0077 tests * test(agents): deslop t0080 tests * test(cron): deslop t0088 tests * test(cron): narrow the scheduled policy fixture type
What Problem This Solves
Duplicate test cases and repeated fixtures make the Discord, Gateway, wizard, prepared-model runtime, heartbeat, and cron suites harder to maintain. This is maintainer-requested test-reduction batch d085.
User Impact
No user-visible behavior or production code changes. The batch retains distinct authorization, lifecycle, recovery, delivery, and configuration regressions while removing overlapping proof and consolidating test setup.
Why This Change Was Made
Replays ten coverage-gated campaign commits onto current main. Every shard's recorded covered-statement and covered-branch loss is below 1%; these are historical in-shard comparisons, not a claim that coverage was remeasured after replay.
All ten commits were applied; none were skipped. Two replay conflicts were resolved in favor of current main's behavior:
src/wizard/setup.finalize.test.ts: keep the newer gateway-probe assertions, current health-check assertions, and skipped-service readiness case; apply the fixture consolidation and remove only the intended redundant readiness rows.src/infra/heartbeat-runner.typing.test.ts: keep the newer two-second keepalive regression, interval-only fake timers, and separate failure cleanup case; retain shared fixture consolidation instead of replacing that regression with the older success table row.No production seam was removed.
config/max-lines-baseline.txtonly drops two obsolete entries. No changed path matches the current CODEOWNERS rules. The heartbeat cron-carried-task prompt regression remains inheartbeat-runner.isolated-key-stability.test.ts.Evidence
pnpm install --frozen-lockfile --prefer-offline, targetedoxfmt --write, plainoxlint -c .oxlintrc.json(exit 0), andgit diff --checkpassed.CI=1 pnpm install --frozen-lockfile --prefer-offline && CI=1 pnpm test <all 50 surviving changed test files>passed 640 tests across 50 files, with no failures or skips. Source hashes were verified before execution. Leasetbx_01m3kwteh91yrq51yg7zk75h9r; run; stopped after success. The wrapper exit code and timing record establish success; external lease cleanup can change the linked Actions lifecycle status.OPENCLAW_TESTBOX=1 node scripts/check-changed.mjs -- <all 57 changed paths>passed the structural guards and 24 core test graphs, then failed with TS18048 inrun.tools-allow.test.ts: its always-present policy fixture had an optional indexed-access type. The follow-up commit narrows that fixture toNonNullable<CronStoredJob["scheduledToolPolicy"]>without changing runtime behavior. The failed run's leasetbx_01m3ky6q8vxtb967zg27kfaxggwas stopped; run.core-test-services-crongraph, remainingcore-test-ui-componentsgraph, extension test typecheck, coercion/deprecated-API guards, and all dead-export scans passed in the continuation. Its broad core lint then found an unrelated max-lines error in untouchedui/src/lib/sessions/session-roster-observations.ts(713 > 700). Main had already fixed that inf8ae4fc466a; this branch was rebased onto465fdd5adba67a2b8cef72fcc8c7fd688b7c9967.git range-diffconfirms all 11 patches are identical across that rebase. Continuation leasetbx_01m3m0vbqxzrfkyqjwf6gtnc94was stopped; run. No lint exception was added.pnpm lint:core(28,909 files),pnpm lint:extensions(10,535 files), andpnpm lint:scripts(1,249 files), each with exit 0 and lint reporting zero warnings/errors. Testbox verified heada2eabf5fdb92e6a8388a43800c5a5cfa93338225. Leasetbx_01m3m33qsjz3byyc1e2xpgtfmg; run; stopped successfully.afterAllcleanup. All task-owned leases are stopped.Shard inventory, line counts, and original coverage evidence
Replayed diff: tests +5,480/−18,089 (net −12,609); production +0/−0; baseline configuration +0/−2. Static test declarations: 810 → 510 (−300). Declarations count each registration once, including generic table declarations; executed table rows are not separate declarations.
t0080 uses the final repair report, which restored inline-provider coverage and a config-change row; its earlier report was superseded. All coverage groups were included. Current-head test/check results are listed above separately.
t0072 files:
extensions/discord/src/monitor/message-handler.route-owner-admission.test.ts,extensions/discord/src/monitor/message-handler.routing-preflight.test.ts.t0059 files:
config/max-lines-baseline.txt,src/gateway/session-utils.fs.test.ts,src/gateway/session-utils.perf.test.ts,src/gateway/session-utils.plugin-runtime.test.ts,src/gateway/session-utils.queued-collector.test.ts,src/gateway/session-utils.search.test.ts,src/gateway/session-utils.single-row-cache.test.ts,src/gateway/session-utils.subagent.test.ts,src/gateway/session-utils.telegram-recreate.test.ts,src/gateway/session-utils.test.ts.t0073 files:
src/wizard/setup.app-recommendations.test.ts,src/wizard/setup.completion.test.ts,src/wizard/setup.default-agent.test.ts,src/wizard/setup.finalize.test.ts,src/wizard/setup.gateway-config.test.ts,src/wizard/setup.inference-verification.test.ts,src/wizard/setup.memory-import.test.ts,src/wizard/setup.migration-import.test.ts,src/wizard/setup.migration-resources.test.ts,src/wizard/setup.migration-stage.test.ts,src/wizard/setup.migration-transaction.test.ts.t0079 files:
src/agents/prepared-model-runtime.published-resources.test.ts,src/agents/prepared-model-runtime.registry-borrow.test.ts,src/agents/prepared-model-runtime.reload-auth.test.ts,src/agents/prepared-model-runtime.reply-fallback.test.ts,src/agents/prepared-model-runtime.run-resources.test.ts,src/agents/prepared-model-runtime.scoped-refresh.test.ts,src/agents/prepared-model-runtime.sources.test.ts,src/agents/prepared-model-runtime.stale-resources.test.ts.t0069 files:
extensions/discord/src/monitor/message-handler.context-history.test.ts,extensions/discord/src/monitor/message-handler.context.test.ts,extensions/discord/src/monitor/message-handler.draft-preview.rest.test.ts,extensions/discord/src/monitor/message-handler.draft-preview.visibility.test.ts,extensions/discord/src/monitor/message-handler.hydration.test.ts,extensions/discord/src/monitor/message-handler.ingress-recovery.test.ts,extensions/discord/src/monitor/message-handler.preflight-owned-threads.test.ts.t0070 files:
extensions/discord/src/monitor/message-handler.preflight.acp-bindings.test.ts,extensions/discord/src/monitor/message-handler.preflight.test.ts.t0068 files:
src/infra/heartbeat-runner.tool-response.test.ts,src/infra/heartbeat-runner.typing.test.ts.t0077 files:
src/agents/prepared-model-runtime.auth-recovery.test.ts,src/agents/prepared-model-runtime.auth-store.test.ts,src/agents/prepared-model-runtime.auth-usage.test.ts,src/agents/prepared-model-runtime.auto-selection.test.ts,src/agents/prepared-model-runtime.batch.test.ts,src/agents/prepared-model-runtime.cancelled-admission.test.ts,src/agents/prepared-model-runtime.catalog-owner.test.ts,src/agents/prepared-model-runtime.catalog-publication.test.ts,src/agents/prepared-model-runtime.catalog-sharing.test.ts,src/agents/prepared-model-runtime.configured-catalog.test.ts,src/agents/prepared-model-runtime.configured.test.ts.t0080 files:
src/agents/prepared-model-runtime.startup-static.test.ts,src/agents/prepared-model-runtime.test.ts.t0088 files:
src/cron/isolated-agent/run.tools-allow.test.ts,src/cron/isolated-agent/run.usage-accounting.test.ts.