Files
pad/internal/server/testdata
xarmian 7f342ef336 test(interchange): golden bundle fixture and a full export, import, export round-trip diff (TASK-3628) (#2125)
* test(interchange): a golden bundle round-trips through import and export, and every loss is listed (TASK-3628)

testdata/interchange/golden is a bundle laid out as files: collections with
schemas (select with terminal and abandoned options, number, date, relation),
an archived collection with a live item, a parent and children, tags, a pin,
versions, comments, links (one to a soft-deleted item), reminders (armed;
fired and acknowledged), a set-aside collaborative edit (content_state), the
onboard playbook with its builtin_origin, a convention, and an attachment
referenced from an item body.

TestInterchangeGolden_RoundTrip imports it through the HTTP bundle door,
exports it through the same door, keys every entity by a natural key, rewrites
every id (including pad-attachment refs and relation values) to that key, and
diffs. Each difference must match interchangeKnownLosses, which gives the
reason; an entry that matches nothing fails as stale. Two known losses today:
an attachment's created_at is re-stamped at import, and a link to a
soft-deleted item is exported but not imported.

PAD_UPDATE_INTERCHANGE_GOLDEN=1 regenerates the golden.

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

* test(interchange): pin coverage, exact loss counts, versions by position (TASK-3628, codex r1)

- The golden must carry each shape the round trip checks (22 named, from an
  archived collection to a link to a dropped item); a regeneration that loses
  one fails before it is written.
- Each known loss covers an exact number of differences, so a new loss at an
  allowed path fails.
- Versions are keyed by their position in the item's history: two can share a
  second and a body. The generator now writes real edit versions
  (ForceVersion; the throttle had folded the edits into none), one of them by
  an agent, and an item created by an agent.
- UUIDs match case-insensitively; regeneration is SQLite-only and swaps the
  new golden in only after it is complete.

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

* test(interchange): regeneration never leaves no golden on disk (TASK-3628, codex r2)

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

* test(interchange): say what the golden swap guarantees (TASK-3628, codex r3)

Claude-Session: https://claude.ai/code/session_01FAVXA5mJ5BNhKmv95jxQkQ
2026-10-13 16:11:27 -04:00
..