Skip to content

fix: batch parent saves during live array resets - #53

Merged
moimikey merged 1 commit into
mainfrom
michael/FEPLAT-5145-batch-parent-saves-livearray-reset
Sep 1, 2026
Merged

moimikey merged 1 commit into
mainfrom
michael/FEPLAT-5145-batch-parent-saves-livearray-reset

Conversation

@moimikey

@moimikey moimikey commented Sep 1, 2026

Copy link
Copy Markdown
Member

Overview

Item Value
PR #53
Goal Persist a live-array parent once per refetch reset instead of once per child-reference mutation. FEPLAT-5145
Risk profile Low; REMEDIATION. Internal persistence control only, with add-before-remove retention covered by regression tests.
Rollout order Merge this upstream remediation first; downstream Fetchium release and wallet adoption are TBD.

What Changed

Area Files Change Why
Entity references packages/fetchium/src/EntityInstance.ts Allow child-reference updates to skip immediate persistence. Prevent each reset item from serializing and writing the full parent.
Live arrays packages/fetchium/src/LiveCollection.ts Suppress intermediate saves while preserving add-before-remove ordering. The existing entity-apply boundary persists the completed parent once.
Regression coverage packages/fetchium/src/__tests__/live-array.test.ts Assert one parent save, stable shared-child identity, and retained reference count after refetch. Prove batching does not weaken reference safety.

Findings Addressed

Finding Status Resolution
Parent serialized and persisted once per added or removed reset item. Resolved Reset reference mutations defer persistence to the final entity-apply save.
Batching could evict a child present in both old and new arrays. Covered Add-before-remove ordering remains unchanged and the regression test verifies identity and reference count.

Validation

Command Result
npm run test:unit -w fetchium -- src/__tests__/live-array.test.ts RED: observed 5 parent saves instead of 1; GREEN: 18/18 tests passed.
npm run test:unit -w fetchium 1,172 passed; 2 skipped.
npm run check-types -w fetchium Passed.
npm run lint ESLint and Prettier checks passed.
npm run build -w fetchium Passed for types, development, and production builds.
npm test -w fetchium Browser-inclusive run unavailable locally: Chromium headless shell was missing, and two installation attempts hung after reaching 100% download. Unit tests were run separately and passed.

Merge Sequencing

Step PR
1 This upstream REMEDIATION PR; no upstream PR dependency.
2 Fetchium release and downstream wallet adoption: TBD.

Avoid serializing and persisting the full parent for each child reference update. Preserve add-before-remove retention and let the entity apply flow write the completed parent once.

Refs: FEPLAT-5145
@moimikey
moimikey marked this pull request as ready for review September 1, 2026 14:25
@moimikey
moimikey requested review from a team and pzuraq as code owners September 1, 2026 14:25
@moimikey
moimikey enabled auto-merge (squash) September 1, 2026 14:26
@moimikey
moimikey merged commit 73e1a88 into main Sep 1, 2026
1 check passed
@moimikey
moimikey deleted the michael/FEPLAT-5145-batch-parent-saves-livearray-reset branch September 1, 2026 14:29
@moimikey moimikey self-assigned this Sep 1, 2026
jimmy-phantom pushed a commit that referenced this pull request Sep 4, 2026
Covers everything merged to main since the last release (0.5.0) that
shipped without its own changeset:
- #53 batch parent saves during live array resets
- #54 clear entity graph on destroy()
- #55 reuse ParseContext in applyMutationEvent
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