Repository navigation
fix(ecs): index inserted rows by stored values so defaultFactory columns are indexed - #216
Merged
Merged
Conversation
…payload An index keyed or ordered by a defaultFactory component missed rows whose insert omitted it: the archetype minted the value but the index was fed the raw payload. applyInsert now reads the stored row, like applyUpdate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An index whose
keyororder.byreads adefaultFactorycomponent did not contain rows whose insert omitted that component. The archetype minted and stored the value, butdecorateArchetypeForIndexespassed the raw insert payload toindexRegistry.applyInsert, so the row was filed without it (and dropped fromfind()until a later update re-read the stored row).Fix
applyInsert(entity, archetype)now reads the stored row (the same readerapplyUpdateuses) instead of taking the payload. The read is skipped when no index applies to the archetype, so un-indexed inserts cost nothing extra.Tests
Red/green in
default-factory.test.ts: an index ordered by a mintedguid, and one keyed by it, both include the minted row right after insert. Both fail before the fix and pass after it. Full monorepopnpm run test/typecheck/lintpass.Version bumped to 0.10.28.
🤖 Generated with Claude Code