Files
pad/internal/server/testdata/interchange
xarmian 87101002a2 fix(import): bundle import remaps attachment references in version history, and on a kept partial import (BUG-3655, BUG-3656) (#2156)
* fix(import): bundle import remaps attachment references in version history, and on a kept partial import (BUG-3655, BUG-3656)

BUG-3655: RemapAttachmentReferencesInWorkspace rewrote item content, fields
and comments but not item_versions, so restoring a version (a full snapshot,
or a reverse patch that re-inserts a reference) brought back the SOURCE
workspace's attachment id. Each live item's chain is now resolved against its
pre-remap body, every resolved body remapped, and the chain re-encoded
against the remapped bodies (full stays full; a patch is re-diffed, kept while
smaller). A chain that does not resolve keeps the newest-only rebase and is
logged. The BUG-3745 remap expectation changes with it: the newest version
now resolves with the new id.

BUG-3656: the final remap ran only on success, so a plain error after some
attachments were rehydrated (an oversized blob) kept a workspace whose
references named the source ids; and a remap failure was logged and the
import answered 201. One deferred door now remaps on every keep-path exit,
and a remap failure is a kept-partial error with its own marker category.

The interchange golden gains history that carries the reference below the
newest version (a full snapshot and an older reverse patch), with coverage
flags for both. Red without the store fix on the golden and both new tests;
red with the keep-path door or the error propagation mutated.

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS

* fix(store): a version patch that does not apply blinds only its own segment of the chain (BUG-3655, codex r1 Medium)

The remap skipped an item's whole history when one patch failed to apply, so
a full snapshot elsewhere in that chain kept the source id. A full row
restarts the walk, so rows below it are re-encoded as usual; rows without a
body have their patch text remapped as written (a same-length id swap keeps
the hunk counts). Red on the previous commit: the full snapshot, the
unresolvable patch and the rows below kept the source id.

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS

* fix(store): the version remap walks the chain exactly as the reader does (BUG-3655, codex r2 Medium)

ListItemVersionsResolvedPage skips a patch that fails to apply and resolves
the row below it against the same successor. The remap stopped resolving at
the failure instead, so that row's patch text was remapped raw, which misses
an id a character-level diff splits. It now walks the same way and re-diffs
every row the reader can resolve. The test asserts through the real resolver,
with a row below the failed patch whose patch does not carry the id whole: red
on both previous versions of the remap.

Claude-Session: https://claude.ai/code/session_01Q9WssCjFuHjSfLABoW4tmS
2026-10-14 08:05:34 -04:00
..