fix(embed): match custom host colors before first paint - #134
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 8:41 PM ET / July 28, 2026, 00:41 UTC. ClawSweeper reviewWhat this changesThe PR adds a bounded, validated Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain This PR addresses a remaining first-paint gap in the host-theme work merged through #133: current main receives live custom palettes but the new URL snapshot is needed to render custom colors before the initial frame. The source, generated web assets, documentation, and browser scenario are aligned; no concrete patch defect was found. The contributor should attach inspectable, redacted real-browser proof before merge because the PR body describes the run but does not include an artifact reviewers can verify. Priority: P2 Review scores
Verification
How this fits togetherClickClack embeds accept initial appearance inputs through iframe URL parameters and then synchronize live palette changes through exact-origin parent messages. The pre-paint document script validates those inputs and sets CSS variables before the embedded discussion application initializes. flowchart LR
Host[Embedding host]
URL[Embed URL parameters]
Script[Pre-paint theme script]
Validate[Validate mode and tokens]
CSS[Document CSS variables]
UI[Embedded discussion UI]
Live[Exact-origin live updates]
Host --> URL --> Script --> Validate --> CSS --> UI
Host --> Live --> UI
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the bounded validation path after attaching a redacted browser recording or screenshots plus terminal/live output that visibly demonstrates the custom first-paint palette and malformed-token fallback in the real cross-origin embed. Do we have a high-confidence way to reproduce the issue? Yes from source, at medium confidence: an embed URL can select a mode before paint but, before this patch, cannot carry the custom token palette used by the later parent message. The PR describes a real cross-origin browser reproduction, but its runtime artifacts are not attached for independent verification. Is this the best way to solve the issue? Yes, with the stated validation boundary: applying an initial snapshot in the existing pre-paint URL path is narrower than changing account preferences or weakening the exact-origin live-message path. The two production HTML assets should continue to be generated and reviewed alongside the source template. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ebd327ac7333. LabelsLabel changes:
Label justifications:
EvidenceWhat 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
|
Inspectable real two-origin browser proofThe checked-in E2E starts the real production-built ClickClack Go server on The actual browser test asserts: Full-page light, dark, custom, and custom-first-paint screenshots were captured during this exact successful run. The production Go asset files committed in this PR are from the same passing build. @clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
Related: openclaw/openclaw#114795
Follow-up to #133
What Problem This Solves
A ClickClack sidebar could briefly render default colors before receiving the first custom host palette, even when the embedding application already knew the exact custom colors.
Why This Change Was Made
Allow the existing authenticated embed contract to carry a bounded JSON
themeTokenssnapshot alongsidethemeandhostOrigin. Validate every initial CSS color and each derived corner radius before applying the palette in the pre-paint document script. Ignore malformed snapshots while retaining the valid light or dark mode. Keep live exact-origin parent messaging and standalone account appearance unchanged.User Impact
Custom host backgrounds, panels, text, borders, accents, and corner radii match before the discussion first paints; malformed input cannot override or break account appearance.
Evidence
pnpm fmt:ts:check,pnpm lint,pnpm typecheck,pnpm --filter @clickclack/web typecheck, andpnpm build: passed.node --test apps/web/src/lib/embed-theme.test.ts apps/web/src/lib/realtime-bootstrap.test.ts apps/web/src/lib/realtime-queue.test.ts: 16 passed.CLICKCLACK_CAPTURE_UI_PROOF=1 pnpm exec playwright test tests/e2e/embed-theme.spec.ts --reporter=line: 1 passed (28.9s), against the actual Go application, real second HTTP origin, and production frame-ancestor policy.AI-assisted implementation and review.