Skip to content

test(shared): add unit tests for message content block visitor#99545

Open
whiteyzy wants to merge 1 commit into
openclaw:mainfrom
whiteyzy:test/shared-message-content-blocks
Open

test(shared): add unit tests for message content block visitor#99545
whiteyzy wants to merge 1 commit into
openclaw:mainfrom
whiteyzy:test/shared-message-content-blocks

Conversation

@whiteyzy

@whiteyzy whiteyzy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The visitObjectContentBlocks utility in src/shared/message-content-blocks.ts has no dedicated unit tests, leaving the content-block traversal logic unverified against regressions.

Why This Change Was Made

Adds comprehensive unit test coverage for the message content block visitor, covering:

  • null / undefined message (no-op)
  • Non-object messages (string, number — no-op)
  • Object without a content property
  • Content that is not an array
  • Normal traversal visiting each object block
  • Skipping non-object entries (strings, null, numbers) within the content array
  • Empty content array
  • Void return value

User Impact

  • Purely additive: one new test file, no production code changes
  • No risk of breaking existing behavior

Evidence

$ npx vitest run src/shared/message-content-blocks.test.ts --reporter=verbose

 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when message is null
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when message is undefined
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when message is a string
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when message is a number
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when message has no content property
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > does not visit when content is not an array
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > visits each object block in the content array
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > skips non-object entries in the content array
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > returns undefined (void)
 ✓ |shared-core| src/shared/message-content-blocks.test.ts > visitObjectContentBlocks > handles empty content array

 Test Files  1 passed (1)
      Tests  10 passed (10)

@clawsweeper

clawsweeper Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close this external, test-only PR as stalled and unproven: it has had no new head commit since July 3, 2026, and the dated proof request has remained unresolved for more than 14 days. The added tests are coherent, but copied unit-test output is supplemental validation rather than the required after-change behavior proof.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

Preserve the useful test scenarios as a fresh, current-main-based contribution only if the contributor can provide redacted after-change validation acceptable to the repository’s proof gate.

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

Not applicable: this PR proposes regression coverage rather than reporting a currently failing user-visible behavior.

Is this the best way to solve the issue?

Unclear: the focused cases appear aligned with the stated helper contract, but the branch remains below the external-PR proof gate and is stale rather than a ready landing candidate.

Security review:

Security review cleared: The diff adds only local unit-test code and introduces no dependency, permissions, workflow, credential, or supply-chain change.

AGENTS.md: found and applied where relevant.

What I checked:

  • Focused test-only diff: The branch adds only src/shared/message-content-blocks.test.ts; the shown cases match the visitor’s stated no-op and traversal contract, with no production, dependency, workflow, or configuration changes. (src/shared/message-content-blocks.test.ts:1, af149e174e47)
  • Proof ask expired: The PR received the status: 📣 needs proof label on July 3, 2026, and the prior completed ClawSweeper review explicitly recorded that copied unit-test output was not real behavior proof. No replacement proof is present in the supplied current PR body or discussion. (af149e174e47)
  • Idle external contribution: The sole head commit is af149e174e47058edf6251f1b942e911cdf11915 from July 3, 2026; by July 18, 2026 the contributor had more than the required 14-day proof window, while the only visible later activity is automation labeling/commenting. (af149e174e47)
  • Related PR is distinct: The cross-referenced merged PR fix(agents): prevent malformed HTML entities from breaking tool calls #99564 fixes surrogate HTML-entity handling in tool-call arguments; it does not implement or supersede these shared-helper tests. (b6127ef0d81e)

Likely related people:

  • unresolved: The supplied review context identifies the shared-helper path but does not include a reliable feature-history attribution; the contributor is intentionally not treated as an owner solely for opening this test PR. (role: shared-helper history owner; confidence: low; files: src/shared/message-content-blocks.ts, src/shared/message-content-blocks.test.ts)

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

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 3, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant