Skip to content

claude-code-chat-browser: dual-path Python/JS parity + malformed-input oracle tests #137

Description

@clean6378-max-it

Sprint Item

#8 of 8 — Medium severity — no blockers (Thursday PR 1 of 1)

Block Relations

Blocked by — (independent of #6#7 concurrency chain and cursor-browser #1–#5)
Blocks
Repo/day Can start Thursday regardless of Wed status

Calendar Day

Thursday, July 23, 2026 (PR 1 of 1)

Planned Effort

5 story points (Medium) — sprint item #8

Problem

Two gaps let defects pass silently today:

  1. Render parity is structural, not behavioral. Parity is asserted by checking dispatch keys are in sync (from the Week 3 scaffold work), but nothing feeds an actual adversarial payload through both renderers to confirm they behave identically. A tool whose Python md-exporter and JS renderer diverge on an XSS payload passes.
  2. Malformed-input fuzz only asserts "never raises unhandled." A truncated line, a broken parentUuid chain, NUL bytes, or a tool_result with no matching tool_use can degrade to a silent empty without any test noticing the difference between "empty because degraded" and "empty because real."

(This closes the "extension surfaces multiply faster than contracts" and silent-degradation dynamics from the lib-review §5.1.)

Goal

One PR adding a golden-parity test (one adversarial tool_result escaped identically by the Python and JS paths) and oracle-bearing malformed-input tests (each producing a specific, distinguishable degraded result — not a silent empty).

Scope

Part A — golden-parity test

  • Feed one adversarial tool_result through the Python md-exporter (utils/tool_dispatch.py / md export path) and the JS renderer (static/js/render/).
  • Assert both escape identically (same neutralization of the payload).
  • Drive the real dispatch and JS registry paths, not reimplementations.

Part B — malformed-input oracle tests

Each of the following must produce a specific, distinguishable degraded result (asserted against a real oracle, not "does not throw"):

  • truncated final line
  • broken parentUuid chain
  • NUL bytes
  • tool_result with no matching tool_use

Part C — oracle discipline

  • Assert the real observable outcome (test-review C3/C8/C9), never merely that parsing did not raise.

Out of scope

Acceptance Criteria

  • A golden-parity test feeds one adversarial tool_result through the Python md-exporter and the JS renderer and asserts both escape identically.
  • Malformed-input tests (truncated final line, broken parentUuid chain, NUL bytes, tool_result with no matching tool_use) each produce a specific, distinguishable degraded result, not a silent empty.
  • Assertions check the real oracle, not "does not throw."
  • CI green (pytest + vitest); PR approved by at least 1 reviewer.

Verification

cd C:\Users\Jasen\CppAliance\claude-code-chat-browser
.\.venv\Scripts\Activate.ps1
pytest -q
npm test
  • Negative control: make the two renderers diverge on the adversarial payload → the golden-parity test fails.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions