Skip to content

test(channels): reuse shared indexed call guards - #137350

Merged
steipete merged 1 commit into
mainfrom
codex/test-channel-setup-indexed-call-guards
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-channel-setup-indexed-call-guards

Conversation

@steipete

@steipete steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Channel setup tests duplicate the same missing-recorded-call check in two local helpers, leaving a shared test precondition with multiple implementations.

Why This Change Was Made

Reuse the existing expectDefined helper through its narrow package entrypoint and remove the redundant mockCall wrapper. Keep the generic first-argument projection, all eleven uses, the three specific call indices, bracket semantics and catalog tuple cast.

User Impact

No user-visible behavior changes. All assertions, call counts, trust/workspace checks, navigation callbacks and persistent-effect coverage remain. Production: +0/-0. Tests: +8/-18 (net -10).

Evidence

  • The same complete channel setup, navigation-prompter and canonical expect suites passed before and after: 50 cases, with unchanged case names and observed execution order.
  • The normal one-path check-changed gate passed all 20 stages, including core-test types, formatting, structural guards, dead-export scans and lint.
  • Independent Codex review found no actionable P0–P2 issues; diff-scoped cleanup required no further changes.

Test-runner follow-up: the first baseline stopped before executing tests with a Vitest transform-cache ENOENT. One canonical same-selection --clearCache operation followed by the unchanged baseline passed. The exact historical cache-removal cause remains unproven; this patch contains no cache or runtime workaround.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review September 3, 2026 14:28
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 10:39 AM ET / 14:39 UTC.

ClawSweeper review

What this changes

The PR replaces duplicated mock-call guards in channel setup tests with the shared indexed-value assertion helper.

Merge readiness

✅ Ready for maintainer review

No blocking findings. This is a focused, behavior-neutral test cleanup; current main still has the duplicated local guards, so the PR remains useful. The maintainer label and maintainer-authored status also require it to remain open for normal handling.

Priority: P3
Reviewed head: 007c7041ba3ba77619567eaa0e2fd81a8e4d6737

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, scoped test refactor uses the workspace’s canonical assertion helper and preserves the setup-flow assertions.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR changes only test assertions; no user-facing or production behavior is changed and separate real-behavior proof is not applicable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR changes only test assertions; no user-facing or production behavior is changed and separate real-behavior proof is not applicable.
Evidence reviewed 6 items Introduced test-only refactor: The verified introduced delta changes only the channel-setup test: it imports the shared guard, routes the generic first-argument helper through it, removes the duplicate array-returning helper, and preserves the three indexed assertions.
Shared helper contract: The package-owned helper returns a defined value and throws for null or undefined; its narrow ./expect export is declared by the same workspace package. That matches the old guards for Vitest call-array entries while eliminating the duplicate implementation.
Test owner boundary: The local runChannelSetup test harness invokes setupChannels, whose production flow owns channel setup; the PR does not modify that runtime owner or its channel/plugin routing behavior.
Findings None None.
Security None None.

How this fits together

Channel setup tests drive interactive channel configuration with mocked prompts and plugin-catalog lookups. They verify the setup flow’s request shape and navigation behavior without changing runtime channel delivery.

flowchart LR
  A[Setup test inputs] --> B[Mocked prompts and catalog]
  B --> C[Channel setup flow]
  C --> D[Recorded mock calls]
  D --> E[Shared assertion guard]
  E --> F[Setup behavior assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -10. Total -10 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 8 18 -10
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 8 18 -10

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; tests +8/-18 (net -10) The entire diff is in a colocated test file and removes duplicated test-guard code without changing runtime behavior.

Technical review

Best possible solution:

Land the shared assertion helper usage as the single test-side implementation of the indexed mock-call invariant.

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

Not applicable: this PR refactors test assertions and does not report a runtime defect.

Is this the best way to solve the issue?

Yes. The existing package-owned helper has the same defined-value invariant and an exported narrow entrypoint, so replacing the duplicate local guards is the smallest maintainable cleanup.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is low-risk test cleanup with no production or user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes only test assertions; no user-facing or production behavior is changed and separate real-behavior proof is not applicable.

Label justifications:

  • P3: This is low-risk test cleanup with no production or user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR changes only test assertions; no user-facing or production behavior is changed and separate real-behavior proof is not applicable.

Evidence

What I checked:

  • Introduced test-only refactor: The verified introduced delta changes only the channel-setup test: it imports the shared guard, routes the generic first-argument helper through it, removes the duplicate array-returning helper, and preserves the three indexed assertions. (src/flows/channel-setup.test.ts:82, 007c7041ba3b)
  • Shared helper contract: The package-owned helper returns a defined value and throws for null or undefined; its narrow ./expect export is declared by the same workspace package. That matches the old guards for Vitest call-array entries while eliminating the duplicate implementation. (packages/normalization-core/src/expect.ts:2, 007c7041ba3b)
  • Test owner boundary: The local runChannelSetup test harness invokes setupChannels, whose production flow owns channel setup; the PR does not modify that runtime owner or its channel/plugin routing behavior. (src/flows/channel-setup.test.ts:242, 007c7041ba3b)
  • Current-main comparison: The current-main comparison contains the same one-file test-only refactor, showing that current main still carries the local mock-call implementations this PR consolidates. (src/flows/channel-setup.test.ts:82, 2074e04c2756)
  • Relevant checks: The supplied exact-head PR context reports successful changed-node, test-type, lint, dependency, source-contract, channel-contract, security-sensitive, and CI-gate checks. (007c7041ba3b)
  • Recent area history: Feature-history for the affected test file shows Peter Steinberger's recent merged channel-setup work, including the agent-ownership setup repair; this is routing context rather than an introduction claim for a particular line. (src/flows/channel-setup.test.ts:242, 1e7fc97a9b71)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete steipete self-assigned this Sep 3, 2026
@steipete
steipete merged commit d1b7a76 into main Sep 3, 2026
167 of 176 checks passed
@steipete
steipete deleted the codex/test-channel-setup-indexed-call-guards branch September 3, 2026 16:09
@steipete

steipete commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 3, 2026
* refs/remotes/origin/main:
  fix(plugins): reject unverifiable pinned npm installs (#136725)
  improve(ui): lift sidebar section headers on hover and mark online owners (#136985)
  test(cron): reuse isolated run suite hooks (#137341)
  test(channels): reuse shared indexed call guards (#137350)
  fix(ui): sidebar header controls read misaligned after the + button lost its border (#137317)
  fix(qa-channel): preserve conversation kind for implicit actions (#137343)
  fix: target the source checkout in Control UI repair commands (#137354)
  chore: reduce CI job count and database test overhead (#137352)
  fix(ios): preserve chat live edge across keyboard transitions (#136660)
  refactor(control-ui): consolidate mention inbox requests (#137375)
  fix(openai): preserve ChatGPT HTTP status for retry pacing (#137146)
  fix(mcp): hide policy-denied plugin tools from ACP sessions [AI] (#136546)
  test(queue): reuse shared deferred fixtures (#137338)
  fix(gateway): repair the Gateway E2E shard (browser suite project, skill resource argv, Codex diagnostic) (#137358)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 4, 2026
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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