Skip to content

test(shared): add unit tests for human-readable list formatting - #98605

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
dwc1997:fix/human-list-tests
Jul 1, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
dwc1997:fix/human-list-tests

Conversation

@dwc1997

@dwc1997 dwc1997 commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The formatHumanList function formats arrays into human-readable disjunctions ("a, b, or c"). Without tests, the multi-branch formatting logic could silently regress.

Why This Change Was Made

Add unit tests covering empty, single, two-element, three-element, and four-element arrays.

User Impact

Human-readable list formatting now has comprehensive test coverage.

Evidence

Direct behavior probe with real function calls:

$ node --import tsx -e "import('./src/shared/human-list.js').then(({formatHumanList})=>console.log(JSON.stringify([{i:['apple','banana'],r:formatHumanList(['apple','banana']),e:'apple or banana'},{i:['a','b','c'],r:formatHumanList(['a','b','c']),e:'a, b, or c'}])))"
[{"i":["apple","banana"],"r":"apple or banana","e":"apple or banana"},{"i":["a","b","c"],"r":"a, b, or c","e":"a, b, or c"}]

Targeted test:

$ node scripts/run-vitest.mjs run src/shared/human-list.test.ts

Test Files  1 passed (1)
     Tests  5 passed (5)
  Duration  364ms

Formatting:

$ npx oxfmt --check src/shared/human-list.ts src/shared/human-list.test.ts
Checking formatting...

All matched files use the correct format.
Finished in 69ms on 2 files using 8 threads.

Whitespace:

$ git diff --check

@dwc1997
dwc1997 force-pushed the fix/human-list-tests branch from 95201dd to 82e2e95 Compare July 1, 2026 11:59
@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 9:12 AM ET / 13:12 UTC.

Summary
The PR adds Vitest coverage for formatHumanList covering empty, one-, two-, three-, and four-element lists.

PR surface: Tests +25. Total +25 across 1 file.

Reproducibility: not applicable. This PR adds regression coverage for an existing helper rather than reporting broken runtime behavior. The current behavior is source-checkable in src/shared/human-list.ts and directly probed in the PR body.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Rerun or clear the failing broad CI shard before merge if it remains required.

Risk before merge

  • [P1] Required CI currently has checks-node-compact-small-whole-2 failing; the failure should be rerun, fixed, or waived by maintainers before merge, but it does not point to this test-only diff.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused helper test once required CI is green or the unrelated broad shard is cleared by maintainers.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer review with the required CI result handled by the normal merge gate.

Security
Cleared: The diff adds only a unit test file and introduces no dependency, workflow, secret, package, install, or runtime execution surface.

Review details

Best possible solution:

Land the focused helper test once required CI is green or the unrelated broad shard is cleared by maintainers.

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

Not applicable; this PR adds regression coverage for an existing helper rather than reporting broken runtime behavior. The current behavior is source-checkable in src/shared/human-list.ts and directly probed in the PR body.

Is this the best way to solve the issue?

Yes; colocated Vitest assertions are the narrowest maintainable way to cover the helper's branches while leaving runtime behavior unchanged.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P3: This is low-risk test coverage for an existing shared helper with no runtime, config, migration, dependency, or user-data change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal output for a direct formatHumanList probe and the targeted Vitest file, and the live Real behavior proof check passed for the current head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal output for a direct formatHumanList probe and the targeted Vitest file, and the live Real behavior proof check passed for the current head.
Evidence reviewed

PR surface:

Tests +25. Total +25 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 25 0 +25
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 25 0 +25

What I checked:

Likely related people:

  • github-actions[bot]: git blame attributes the current helper and direct caller lines to commit 9ed03df44d812ccb14b2e69897be7e3209b65770. (role: introduced current helper; confidence: medium; commits: 9ed03df44d81; files: src/shared/human-list.ts, src/infra/approval-native-route-notice.ts, src/infra/exec-approval-reply.ts)
  • steipete: git log shows the latest current-main touch to src/scripts/test-projects.test.ts as fix: restore tooling CI after transcript test addition, relevant to the one failing broad CI shard. (role: recent tooling CI contributor; confidence: medium; commits: e7c689f41048; files: src/scripts/test-projects.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 1, 2026
@vincentkoc
vincentkoc merged commit f936c6b into openclaw:main Jul 1, 2026
95 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 2, 2026
Squashed from PR openclaw#98605 after updating branch with current main and passing CI.
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. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants