test(diffs): add viewerState, toolbar toggle, shadow root, and hydrateProps tests (fixes #83915)#92873
Conversation
…eProps tests Add comprehensive test coverage for viewer-client.ts: - viewerState initialization: theme/diffStyle/overflow seeding from firstPayload options, default values, preloadHighlighter language merging - toolbar button toggles: layout (unified/split) and theme (light/dark) toggle state, multiple cards sync - ensureShadowRoot: attachment from template, skip when no template, skip when already attached - getHydrateProps branching: fileDiff vs oldFile/newFile payload shapes Refs openclaw#83915
|
Codex review: needs maintainer review before merge. Reviewed June 19, 2026, 12:16 AM ET / 04:16 UTC. Summary PR surface: Tests +289. Total +289 across 1 file. Reproducibility: yes. for the test-gap claim: current main and v2026.6.8 have only icon-safety and hydration-error viewer-client suites, while PR head adds the missing suites. I did not run tests in this read-only review; the PR body and live CI provide terminal validation evidence. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land this focused test coverage for #83915 after exact-head gates stay green, while keeping stale-controller lifecycle work in #83917. Do we have a high-confidence way to reproduce the issue? Yes for the test-gap claim: current main and v2026.6.8 have only icon-safety and hydration-error viewer-client suites, while PR head adds the missing suites. I did not run tests in this read-only review; the PR body and live CI provide terminal validation evidence. Is this the best way to solve the issue? Yes: colocated jsdom tests are the narrowest maintainable solution for this coverage gap. The separate production lifecycle cleanup remains tracked by #83917 and does not need to be folded into this test-only PR. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 78f948f76836. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +289. Total +289 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
Use name/contents instead of fileName/content to match the actual FileContents interface from @pierre/diffs.
|
/clownfish automerge |
|
Clownfish is on the reef for this PR. 🐠 I tagged A maintainer can call |
|
🦞✅ Source: Why human review is needed: What the maintainer can do as a next step: I added |
|
@clawsweeper approve Maintainer approval after a live re-check: this is a clean, mergeable, test-only change to |
|
🦞✅ Approver: What merged:
Automerge notes:
The automerge loop is complete. Automerge progress:
|
…eProps tests (fixes openclaw#83915) (openclaw#92873) Summary: - Merged test(diffs): add viewerState, toolbar toggle, shadow root, and hydrateProps tests (fixes openclaw#83915) after ClawSweeper review. Automerge notes: - PR branch already contained follow-up commit before automerge: test(diffs): use real FileContents shape in hydrateProps fixtures Validation: - ClawSweeper review passed for head a09ee50. - Required merge gates passed before the squash merge. Prepared head SHA: a09ee50 Review: openclaw#92873 (comment) Co-authored-by: liuhao1024 <sunsky.lau@gmail.com> Approved-by: vincentkoc
…eProps tests (fixes openclaw#83915) (openclaw#92873) Summary: - Merged test(diffs): add viewerState, toolbar toggle, shadow root, and hydrateProps tests (fixes openclaw#83915) after ClawSweeper review. Automerge notes: - PR branch already contained follow-up commit before automerge: test(diffs): use real FileContents shape in hydrateProps fixtures Validation: - ClawSweeper review passed for head a09ee50. - Required merge gates passed before the squash merge. Prepared head SHA: a09ee50 Review: openclaw#92873 (comment) Co-authored-by: liuhao1024 <sunsky.lau@gmail.com> Approved-by: vincentkoc
What
Add comprehensive test coverage for
extensions/diffs/src/viewer-client.ts(361 lines, previously only bundle-content grep coverage). Covers four untested code paths:firstPayload.options, default values when payload uses defaults, andpreloadHighlighterlanguage merging across multiple cards<template>, skip when no template present, skip when already attachedfileDiffvsoldFile/newFilepayload shape dispatchWhy
viewer-client.tsowns the entire client-side diff viewer: payload parsing, shadow-root attachment, toolbar construction, theme/layout toggle state, and multi-card synchronization. The only prior test coverage was a bundle-content grep inconfig.test.tschecking for three minified style string literals (line 383-394).How
renderCard()helper with optionalpayloadOverrideparameter for custom payload injectiondescribeblocks using the existing@pierre/diffstest setupvi.hoisted()test patternFixes #83915
Real behavior proof
Behavior addressed: Test coverage for viewer-client.ts initialization, toolbar toggles, shadow root attachment, and hydrateProps branching
Environment tested: macOS 26.4.1, Node.js, OpenClaw upstream/main (66880a5)
Steps run after the patch:
extensions/diffs/src/viewer-client.test.tsEvidence after fix:
@pierre/diffslibrary (mocked). Visual rendering of toolbar toggles.