Skip to content

feat(harness): str_replace L2 TEAL/EMBER side bands - #692

Merged
btipling merged 2 commits into
mainfrom
plan/str-replace-side-bg
Aug 19, 2026
Merged

feat(harness): str_replace L2 TEAL/EMBER side bands#692
btipling merged 2 commits into
mainfrom
plan/str-replace-side-bg

Conversation

@btipling

Copy link
Copy Markdown
Owner

Summary

Implements #691 (source #687).

Successful str_replace L2 no longer dumps the whole audit block as one teal_text mono slab. Wasm paints:

  • status line (chrome, teal_text)
  • old on ember_surface / ember_text
  • new on teal_surface / teal_text

-old_string / +new_string stay on the payload (emit + 20/6 preview) and are stripped from paint. Empty new still mounts a one-mono-line TEAL strip. Other tools keep the single-block path.

No protocol bump. No TS emit/preview change.

Files

  • native/harness/src/rich/toolrun.zigsplitStrReplaceDetail (line-exact sentinels, slices into detail, no alloc) + 8 unit tests
  • native/harness/src/ui/toolrun.zigpaintToolRun L2 side bands; id_extra +4..+8; min height = fontMono().lineHeight()
  • docs/harness-limits.md — Tool-run L2 row: payload vs paint

Verification

Gate Result
tsc --noEmit green
vitest run --changed no TS test delta (this PR is Zig + docs). Incidental wasm-int 9 fails here are missing harness.wasm in this sandbox — not this diff
zig build test-rich / test-rich-invariants / harness -Doptimize=Debug CI only — no zig in this agent workspace
build-harness required check after push
Caps existing STR_REPLACE_DIFF_SIDE_MAX_BYTES = 4096 and 20/6 windows unchanged
Cloud ops N/A
Living docs in this PR

Expected vitest pass count: unchanged (0 new TS tests). New coverage is the 8 Zig splitter cases on build-harness / test-rich.

Test plan (operator, after Preview wasm)

  • Expand a successful str_replace L2 → two bands, no visible sentinels
  • Delete (new_string empty) → old band + visible empty TEAL strip
  • exec / read_file L2 still one teal_text block
  • ~390 px readable, no horizontal gutter
  • Refresh: restored str_replace L2 still splits

Fixes #691
Refs #687

Paint successful str_replace L2 as stacked EMBER (old) / TEAL (new)
surface bands. Splitter is a pure line-exact parse of the existing
preview payload; emit and preview are unchanged.

Fixes #691
Refs #687
@btipling btipling self-assigned this Aug 19, 2026
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
invincible Ignored Ignored Aug 19, 2026 7:54pm

Request Review

Copy link
Copy Markdown
Owner Author

Implement-plan for #691.

  • splitStrReplaceDetail (line-exact sentinels, no alloc) + 8 test-rich cases
  • paintToolRun L2: EMBER old / TEAL new bands; empty new keeps one mono-line strip
  • docs/harness-limits.md distinguishes payload sentinels vs paint
  • tsc --noEmit green; no TS emit/preview change
  • Zig compile + test-rich are the build-harness job (no zig in this workspace)

Not merged. Suggested next: adversarial-review.

@btipling btipling left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review — PR #692

Verdict: PASS WITH NOTES
Repo: btipling/invincible
Scope: mainplan/str-replace-side-bg @ 53abb6f · 3 files · str_replace L2 EMBER/TEAL side bands (Wasm paint only)
Lenses run: L1, L3, L5, L6, L8, L9 (skip L2: no trust-boundary / emit / redact change. skip L4: no workflow edit; build-harness already ran zig build test-rich + wasm. skip L7: no deploy bind)
AGENTS.md read: yes · docs/feature-divide.md yes (paint stays in-canvas; no DOM chat)

Findings

No surviving Blocker / Major after self-refutation. Splitter traces match appendStrReplaceDiff + buildStrReplacePreview (line-exact sentinels, escaped -old_string / +new_string is content, … (N more lines) is content, ERROR / one-sentinel → null → existing single-block path). id_extra +4..+8 stay inside the 1024-wide item namespace and are mutually exclusive with the fallback +4 body. Palette uses ember_surface/ember_text and teal_surface/teal_text (not ember_accent). No protocol bump.

Sev Lens Finding Break scenario Refutation attempt Confidence
Nit L8 native/harness/src/ui/toolrun.zig still documents “up to 5 widget slots” and +4 detail body (~177–179). Paint now mounts +5 old box, +6 old tl, +7 new box, +8 new tl. Next L2 widget added at +5 by following the comment collides with the old band (expander state / hit-target mix). 1024-wide stride still has room; a reader 20 lines down sees the new extras. Fails as documentation of the locked collision rule — plan-review #691 called unique extras a Minor for a reason. high

Residual risk

Attack did not breach a runtime path with current evidence.

  • Goal 2 (empty new → visible TEAL strip) rests on dvui honoring min_size_content.h = fontMono().lineHeight() on a box whose child textLayout received no glyphs (mixed_text.addTextMixed returns at len==0). 2 px pad alone was already rejected as insufficient. Splitter tests lock new.len==0; they do not paint. Operator checklist in the PR body is still unchecked.
  • teal_surface (#0a1215) on transcript teal_bg is a small delta — empty strip can look like a hairline rather than a band at some displays.
  • Fail-soft: malformed / host-fallback str_replace detail without both sentinels still paints one teal_text slab (headers visible). Correct, but a clipped preview that lost +new_string degrades silently.
  • No 390 px wrap / no-h-gutter proof in CI.

Merge guidance

PASS WITH NOTES — safe to merge from this attack after the operator smoke (expand success, delete strip, exec/read_file still one block). The Nit is optional (+0..+8 in the slot comment).

zig → harness.wasm is green (test-rich includes src/rich/toolrun.zig). Do not treat this as --approve.

What was not attacked

Live Preview paint, restored-session L2 after refresh, Copy of the still-sentinel payload, dvui testing-backend layout of the empty new box, full vitest (N/A — no TS).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plan: str_replace L2 — TEAL/EMBER side backgrounds (harness paint)

1 participant