Skip to content

fix: neutralize author fences that desync the markdown reply skeleton (confirmation-pass-2) - #54

Merged
silversurfer562 merged 2 commits into
mainfrom
claude/suspicious-austin-a15697
Aug 20, 2026
Merged

fix: neutralize author fences that desync the markdown reply skeleton (confirmation-pass-2)#54
silversurfer562 merged 2 commits into
mainfrom
claude/suspicious-austin-a15697

Conversation

@silversurfer562

Copy link
Copy Markdown
Member

What

The LOUD sibling of the pass-2 silent-injection fix (#46). A literal triple-backtick fence in author-supplied field text (a label, help_text, or an option) opened a stray code fence in the rendered markdown form, so _FENCE_RE on ingestion no longer saw the trailing answers skeleton cleanly delimited — paste-back failed loudly with "fenced code block is not valid JSON" and a pile of named unparseable line problems.

Fix

  • _defuse_fences weaves a zero-width break through any run of 3+ backticks in every author/host line rendered by form_to_markdown and the problems_to_markdown re-ask. Inline `code` (runs under three) renders untouched.
  • _skeleton_block emits the skeleton's backticks as the JSON escape, which `json.loads` restores on ingestion — so a fence-bearing value that reaches the skeleton itself (a `default`/`recommended`/`suggested` option) can't close its own `json ` fence early, and exact option matching is unchanged.

Tests

Four regressions in TestConfirmationPass2 (fence-bearing option round-trip, fence in a skeleton default, fence in a re-asked field, and inline-backtick preservation). Full suite: 682 passed. Widget surface HTML-escapes and was already immune.

Source: confirmation-pass-2 needs-a-look ledger, 2026-08-20.

🤖 Generated with Claude Code

… (confirmation-pass-2)

The LOUD sibling of the pass-2 silent-injection fix (#46). A literal
triple-backtick fence in author-supplied field text — a label, help
text, or an OPTION — opened a stray code fence in the rendered form,
so `_FENCE_RE` on ingestion no longer saw the trailing `answers`
skeleton cleanly delimited and paste-back failed loudly ("fenced code
block is not valid JSON").

- `_defuse_fences` weaves a zero-width break through runs of 3+
  backticks in every author/host line rendered by `form_to_markdown`
  and the `problems_to_markdown` re-ask; inline `code` (runs under
  three) is untouched.
- `_skeleton_block` emits the skeleton's backticks as the ```
  JSON escape, which `json.loads` restores, so a fence-bearing value
  that reaches the skeleton (a default/recommended/suggested option)
  can't close its own ```json fence early, and exact matching holds.

Regression tests in TestConfirmationPass2; widget surface HTML-escapes
and was already immune.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@silversurfer562
silversurfer562 force-pushed the claude/suspicious-austin-a15697 branch from b7ce517 to a921e96 Compare August 20, 2026 13:16
# Conflicts:
#	src/attune_forms/markdown_surface.py
@silversurfer562
silversurfer562 merged commit 0155c20 into main Aug 20, 2026
7 checks passed
@silversurfer562
silversurfer562 deleted the claude/suspicious-austin-a15697 branch August 20, 2026 13:45
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.

1 participant