Skip to content

refactor(googlechat): share approval card text escaping - #134643

Merged
vincentkoc merged 1 commit into
mainfrom
refactor-googlechat-approval-card-text
Sep 1, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor-googlechat-approval-card-text

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Google Chat pending and terminal approval cards independently implemented the same HTML text escaping rule. The duplicate policy could drift on replacement order, entity handling, quote handling, or truncation order and produce inconsistent approval-card text.

Why This Change Was Made

This consolidates the exact three-character Google Chat approval-card escaping contract in one private plugin helper. Both callers retain their existing local name and truncation boundary. Ordinary message Markdown formatting, shared HTML helpers, card composition, IDs, SDK surfaces, config, packages, and protocol behavior are unchanged.

User Impact

No intended visible behavior change. Pending and terminal approval cards continue escaping &, <, and > in that order, double-escaping existing entities, and leaving quotes and apostrophes unchanged.

Evidence

  • Production LOC: +5/-6 (net -1).
  • Tests: +8/-2.
  • Focused approval suites: 2 files, 16 tests passed.
  • Full Google Chat extension lane: 33 files, 355 tests passed.
  • Exact rendered text covered at both delivery boundaries:
    • input: <tag> & &amp; "double" 'single'
    • output: &lt;tag&gt; &amp; &amp;amp; "double" 'single'
  • In-memory mutation checks rejected all nine reviewed variants: replacement reordering, quote/apostrophe escaping, existing-entity preservation, either caller bypassing the helper, either caller moving escaping before truncation, ordinary Markdown helper reuse, and shared/core HTML helper reuse.
  • Structural checks confirm one escaping implementation, two owner-local imports, preserved truncation nesting, and no ordinary Markdown/shared HTML dependency.
  • pnpm check:changed passed conflict, max-lines, assertion-safety, changelog, doctor, extension boundary, duplicate coverage, dependency, formatting, doctor-contract, plugin-boundary, patch, and test-temp gates. It then stopped in the shared extension typecheck on eight unrelated existing Telegram dependency/type errors, including missing RichMessageButton from grammy/types; this PR changes only extensions/googlechat/**.
  • Clean Linux Testbox passed the full Google Chat extension lane (355/355) and complete pnpm check:changed: Blacksmith lease tbx_01m1dbd7g91mc1j65dh1hp0r34, workflow run 33461210429.
  • Exact pinned Codex autoreview: scoped clean, no accepted/actionable findings, correctness 0.99.
  • Test-audit authoring gate: assertions protect observable card payload bytes, target credible extraction regressions, extend existing pending-delivery/card-click boundaries, and add no test-only production seam.
  • Codex hard gate inspected directly: ../codex/codex-rs/cli/src/main.rs:220-245 and ../codex/codex-rs/cli/src/main.rs:2840-2870; unrelated to this plugin-local text contract.
  • Live overlap checked immediately before implementation:
  • Exact-head CI passed at 8f8d9ae57d1f11fc785d38341a4b20762d9cf733 in workflow run 33461699520; failed-job rerun recovered a transient ECONNRESET while downloading @matrix-org/[email protected], and aggregate openclaw/ci-gate job 99714357026 succeeded.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Sep 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: googlechat Channel integration: googlechat size: XS maintainer Maintainer-authored PR labels Sep 1, 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 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 10:19 PM ET / September 1, 2026, 02:19 UTC.

ClawSweeper review

What this changes

This PR replaces two identical Google Chat approval-card escaping functions with one private extension helper and asserts the rendered pending and resolved-card text.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This behavior-preserving refactor remains useful: current main and the latest release still duplicate the same escaping rule. No actionable patch defect was found; this member-authored PR with a protected maintainer label should proceed through ordinary review after exact-head CI finishes.

Priority: P3
Reviewed head: 8f8d9ae57d1f11fc785d38341a4b20762d9cf733

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused behavior-preserving refactor with boundary assertions and no actionable correctness or security defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this member-authored behavior-neutral refactor; its focused tests supplement review by exercising the pending send payload and resolved-card update payload.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this member-authored behavior-neutral refactor; its focused tests supplement review by exercising the pending send payload and resolved-card update payload.
Evidence reviewed 5 items Introduced helper preserves the existing contract: The added helper performs the same ordered ampersand, less-than, and greater-than replacements as both removed local functions.
Both production card boundaries use the helper: Pending command-card text escapes after its existing truncation, and terminal-card command text retains the same ordering before update delivery.
Boundary assertions cover pending and resolved cards: The pending-card test checks the send payload's command widget and the card-click test checks the terminal update payload's command widget for exact escaped output.
Findings None None.
Security None None.

How this fits together

Google Chat turns pending approvals and final decisions into card payloads. Command and metadata text are escaped before the plugin sends or updates those cards through the Google Chat API.

flowchart LR
  A[Approval command text] --> B[Pending card builder]
  A --> C[Resolved card builder]
  B --> D[Card text escaping]
  C --> D
  D --> E[Google Chat card payload]
  E --> F[Send or update message]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is incomplete, including a failing session-accessor check outside this PR's changed paths; a green exact-head merge gate is not yet established.
  • Complete next step (P2) - No repair lane is warranted: no concrete patch defect was found, and the protected member-authored PR needs normal exact-head CI and maintainer review.
Agent review details

Security

None.

PR surface

Source -3, Tests +6. Total +3 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 5 8 -3
Tests 2 8 2 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 13 10 +3

Review metrics

Metric Value Why it matters
Production versus test delta production +5/-8 (net -3); tests +8/-2 (net +6) Production code removes two duplicate implementations in favor of one private helper while tests add exact payload assertions at both existing boundaries.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep one private Google Chat card-text helper and land it once exact-head checks are green and ordinary maintainer review is complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep one private Google Chat card-text helper and land it once exact-head checks are green and ordinary maintainer review is complete.

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

Not applicable: this PR consolidates existing behavior rather than reporting a runtime defect; source inspection confirms the duplicate functions and their card-delivery paths.

Is this the best way to solve the issue?

Yes: a private extension-local helper is the narrowest maintainable way to prevent the two equivalent card builders from drifting while preserving their separate truncation boundaries.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a small Google Chat cleanup with no intended configuration, protocol, 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: The external-contributor proof gate does not apply to this member-authored behavior-neutral refactor; its focused tests supplement review by exercising the pending send payload and resolved-card update payload.

Evidence

What I checked:

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete exact-head CI and establish whether the session-accessor failure reproduces independently of this Google Chat-only patch.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-01T02:08:54.658Z sha 8f8d9ae :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review September 1, 2026 02:12
@vincentkoc
vincentkoc merged commit 765c0cd into main Sep 1, 2026
240 of 244 checks passed
@vincentkoc
vincentkoc deleted the refactor-googlechat-approval-card-text branch September 1, 2026 02:24
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: googlechat Channel integration: googlechat 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