Fix combined-facets plugin action inference; add BlobRef namespace - #172
Merged
Conversation
…type tests
Failure B: a computed factory declared alongside actions in one
Database.Plugin.create collapsed action inference to ToActionFunctions<{}>.
The computed-factory db type referenced this call's own AD (inferred from the
sibling actions property), making AD un-inferable. Drop local AD from the
computed db (base actions only), matching the action factory db and property
order. Zero as casts.
Also: additive namespaced BlobRef (BlobRef.schema / BlobRef.is) mirroring
BlobHandle/BlobMeta, plus red/green type tests for both plugin failures and a
BlobRef namespace proof.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Two plugin type-inference fixes plus a
BlobRefergonomics addition, each backed by compile-time type tests. All additive/non-breaking. Version bumped 0.9.98 → 0.9.99.1. Fix: combined-facets action inference collapse
Database.Plugin.create({ components, computed, actions })in a single call collapseddb.actionstoToActionFunctions<{}>(TS2339 on every action), forcing consumers to split every plugin into one-facet-per-createlayers.Root cause: in
create-plugin.ts, the computed-factorydbbuilt itsactionsslot from the localADtype param (inferred from the siblingactionsproperty). ReferencingADin thecomputedcontextual type made it un-inferable whenever a computed shared the call, so it fell back to{}. The action-factorydbalready excluded localAD— that asymmetry was the bug. It's also a forward reference (actions are declared after computed in the enforced order; a computed reading a same-call action never actually worked).Fix: drop local
ADfrom both computed-dbsites (XP['actions'] & IP['actions']only). Noascasts.Red test:
combined-facets-action-inference.type-test.ts— positiveAssert<Equal>,@ts-expect-errornegatives, a layered-create control, and semantics guards (a computed CAN read a base action; a same-create sibling action is correctly absent). Confirmed genuinely red without the fix, green with it, across TS 5.8.3 / 6.0.2 / tsgo 7.0.2.2. Regression guard: services thread to the computed-factory boundary
computed-factory-services.type-test.tspins thatdb.services.Xis correctly typed inside a computed factory (already true viaFullDBForPlugin; this locks it against regression, and documents that a consumer manufacturingunknownvia a hand-typed param is unnecessary).3.
BlobRefnamespaceMerged a namespaced
BlobRef(export namespace BlobRef { schema = BlobRefSchema; is = isBlobRef }) mirroringBlobHandle, re-exported fromcache/index.ts. Consumers can writeBlobRef.schema/BlobRef.isinstead of the standalone symbols. StandaloneBlobRefSchema/isBlobRefkept. An ECS component storing a BlobRef should use{ ...Nullable(BlobRef.schema), default: null }(no cast) — proven inblob-ref-namespace.type-test.ts.Verification
packages/datatypecheck (build-assembly + tsc -b): clean. Lint: clean.assembly.test.tsneeds the WASM build, unrelated).data-lit,data-lit-todo,data-lit-tictactoe,data-lit-space-rock-game,data-persistence,data-sync) rebuild clean.🤖 Generated with Claude Code