Skip to content

fix(#1422): persist image asset bytes with insert-image/replace-image-src - #441

Merged
davidwkeith merged 1 commit into
mainfrom
claude/anglesite-issue-1422-image-asset-persist
Aug 12, 2026
Merged

fix(#1422): persist image asset bytes with insert-image/replace-image-src#441
davidwkeith merged 1 commit into
mainfrom
claude/anglesite-issue-1422-image-asset-persist

Conversation

@davidwkeith

Copy link
Copy Markdown
Contributor

Summary

  • processImageDrop writes the optimized primary WebP + responsive variants under public/images/, but apply-edit-dispatcher.mjs's onApplied call for insert-image/replace-image-src only ever passed {file, range} for the patched .astro source — the asset bytes never made it into the anglesite/edits commit.
  • Reuses the multi-file {files: [...]} onApplied shape extract-component already established: the commit now lists the source file plus every asset processImageDrop wrote. server/index-tools.mjs's onApplied wiring already branches on files generically, so no wiring change was needed there beyond a doc comment.
  • Adds regression tests for both replace-image-src and insert-image asserting the actual git commit tree carries the asset files, not just the in-memory files array.

Paired PR check

Test plan

  • npm test (full vitest suite, 157 files / 3157 tests) passes.
  • New tests assert git ls-tree -r on the resulting commit contains both the source .astro patch and the optimized WebP assets.
  • Paired app PR (insert-image applies in guest but never persists to host Source/ Anglesite#1422) extends scripts/run-container-probe.sh with an insert-image gate exercising this end-to-end once this PR is tagged and vendored.

Scope note

This addresses only the second of #1422's two defects (confirmed by inspection: missing asset bytes in the commit). The first defect — why the guest's apply_edit reply can come back with a nil commit for insert-image in the first place — is unconfirmed and needs a real-hardware repro with guest debug-pane capture; not attempted here.

🤖 Generated with Claude Code

…-src

processImageDrop writes the optimized primary WebP + responsive variants
under public/images/, but apply-edit-dispatcher.mjs's onApplied call only
ever passed {file, range} for the patched .astro source — the asset bytes
never made it into the anglesite/edits commit (or, for container-backed
runtimes, the host repo it gets persisted onto). A "successful" image edit
left the host with a source patch pointing at images that don't exist.

Reuse the multi-file {files: [...]} onApplied shape extract-component
already established, listing the source file plus every asset
processImageDrop wrote, so recordEdit commits them all onto one commit.
server/index-tools.mjs's onApplied wiring already branches on `files`
generically, so no wiring change was needed there beyond the doc comment.

Part of Anglesite/Anglesite#1422 (paired PR — the app PR consuming this
release is tracked separately). Does not address that issue's other,
unconfirmed defect: why the guest reply's commit can come back nil for
insert-image in the first place.
davidwkeith added a commit to Anglesite/Anglesite that referenced this pull request Aug 12, 2026
The #81 smoke matrix's image-drop row has had no non-GUI substitute — a
human found it silently failing (guest apply succeeds, nothing persists to
host Source/, matching #718/#1066's shape but for insert-image) with no
repeatable way to re-check it besides another manual drag-and-drop.

Add an `insert-image` subcommand to anglesite-container-probe, alongside
the existing `apply-edit` case-8 gate: boots a real LocalContainerSiteRuntime,
drives an actual insert-image edit through MCPApplyEditRouter wired exactly
like production, and asserts the reply's commit is non-nil AND that the host
public/images/ asset the patched <img>'s src references actually exists —
the assertion apply-edit has no equivalent of, since text edits have no
associated binary asset.

This gate can't pass yet: it needs the paired sidecar fix
(Anglesite/anglesite-skills#441) tagged and vendored into this app's
container image first. Scaffolding only, per #1422's scope — the issue's
other, unconfirmed defect (why the guest reply's commit can come back nil
for insert-image) needs a real-hardware repro with guest debug-pane capture,
not attempted here.
@davidwkeith
davidwkeith merged commit 97bca51 into main Aug 12, 2026
4 checks passed
@davidwkeith
davidwkeith deleted the claude/anglesite-issue-1422-image-asset-persist branch August 12, 2026 21:37
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