fix(ecs): thread index declarations into the computed-factory db type#120
Merged
Conversation
FullDBForPlugin (the `db` type for computed factories) forwarded only Database
slots 1–7, so slot 9 (IX) fell back to its `{}` default and `db.indexes` was
empty inside computeds — they couldn't use any declared index. (Actions/systems
were unaffected; their db threads IX already.)
Forwards IX into slot 9, with `unknown` for slot 8 (CV) — Database's own
default for that slot — so a concrete computed-values type never constrains
computed-factory inference / breaks contravariance. At the call sites XP is
AmbientPlugin<XP, IP>, so both extends-base and imports-dep indexes flow in;
the plugin's own locally-declared indexes are threaded via the IX param too.
Adds regression guards in database.index.type-test.ts (own / extends / imports
indexes visible to computeds); verified they fail to compile without the fix.
Bump to 0.9.66.
Co-Authored-By: Claude Opus 4.8 <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.
Summary
db.indexeswas empty inside computed factories — computeds couldn't use any declared index.Databaseis 9 type params:The actions/systems
dbcorrectly threads slot 9 (IX). But the computed-factorydbisFullDBForPlugin<…>, which forwarded only slots 1–7 — soCV(8) andIX(9) fell to their defaults, leavingIX = {}anddb.indexesempty.Fix
Forward
IXinto slot 9 ofFullDBForPlugin, supplying a placeholder for slot 8:At the call sites
XPisAmbientPlugin<XP, IP>, soXP['indexes']resolves toextends-base andimports-dep indexes; theIXparam adds the plugin's own locally-declared indexes. This matches the actions/systemsdbexactly.Verification
tsc -bgreen; 210 index/plugin tests pass; lint clean.database.index.type-test.tsproving a computed factory sees its own, its extends-base, and its imports-dep indexes viadb.indexes. Confirmed they fail to compile without the fix (Property '<name>' does not exist on type '{}').Bump to 0.9.66.
🤖 Generated with Claude Code