Skip to content

PROD-2346: write local container cache on create/update/adopt#196

Merged
5PK merged 2 commits into
mainfrom
PROD-2346-container-cache-write
Jul 24, 2026
Merged

PROD-2346: write local container cache on create/update/adopt#196
5PK merged 2 commits into
mainfrom
PROD-2346-container-cache-write

Conversation

@5PK

@5PK 5PK commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • container-pusher.ts wrote the source→target mapping row after a successful container create, update, or PROD-2307 referenceName-adopt, but never wrote the corresponding local containers/{id}.json disk cache that ContainerMapper.getMappedEntity reads from.
  • That gap let a same-run sync (new container + content pushed into it in the same run) hit a false-positive PROD-2309 "container ... no longer exists on the target — it may have been deleted since the last sync" error, since the guard has no way to distinguish "just created this run, not cached yet" from "genuinely deleted since last sync". Self-healed on the next run, but flipped the exit code non-zero for a container that was never actually missing.
  • Added a cacheTargetContainer(targetGuid, container) helper (mirrors download-containers.ts's cache-write shape) and call it after all three success paths: create, update, and the PROD-2307 adopt-by-referenceName branch, which has the identical gap.
  • saveContainer() returns the full Container type (same shape as getContainerByID()), so the create/update response itself is sufficient to write the cache — no extra API round-trip needed.

Test plan

  • Added 3 new tests to container-pusher.test.ts asserting the cache file is written to disk after create, update, and adopt-by-referenceName
  • Full src/lib/pushers + src/lib/mappers suite passes (21 suites, 421 tests)

🤖 Generated with Claude Code

5PK added 2 commits July 23, 2026 21:42
container-pusher.ts wrote the mapping row after a successful create,
update, or PROD-2307 referenceName-adopt, but never the local
containers/{id}.json cache file that ContainerMapper.getMappedEntity
reads from disk. That left a same-run gap: a container created and
then pushed content into in the same sync would have its content
rejected with the PROD-2309 "container no longer exists" guard, since
the guard can't tell "just created, not cached yet" apart from
"genuinely deleted since last sync".
@5PK
5PK merged commit 5bce883 into main Jul 24, 2026
3 checks passed
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.

2 participants