fix(core): polish batch — owner entityId, timezone, date validation, null content filter (#69)#103
Merged
Merged
Conversation
…null content filter (#69) - ScopedStack.create() omits entityId when the requester is the owner, matching Stack.create() — previously the owner writing through asEntity(ownerEntityId) produced a differently-shaped record than writing directly, contradicting the spec's "owner records carry no entityId" invariant. - timezone becomes optional passthrough app metadata end to end (ConfigContent, StackRecordAdapter, discovery, every adapter's init options) — no more defaulting to 'UTC', which claimed knowledge the stack was never actually given. - date-kind fields now validate against an ISO 8601 shape (regex + Date.parse sanity check) instead of bare Date.parse, which accepted engine-dependent non-ISO formats the error message already claimed to reject. - A content filter value of null now means "field absent or null" (IS NULL / missing-path semantics) instead of silently matching nothing, in both the shared SQL query builder and MemoryAdapter. Spec and tests updated to match.
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
Closes #69 — four small correctness/consistency fixes from the design-review backlog.
entityIdstamping viaScopedStack. The spec says owner-created records carry noentityId, butScopedStack.create()stamped it unconditionally — so the same owner writing throughasEntity(ownerEntityId)(any server path) produced records shaped differently from writing directly throughStack.create(). Fixed by omittingentityIdwhen the requester is the owner. Added a test pinning that a stranger's-owngrant still can't match an owner-authored record now that it carries noentityId(it can't, since the owner already bypasses grants entirely viacheckAccess's owner shortcut).timezonerequired at init, consumed by nothing. Made optional end to end —ConfigContent.timezone,StackRecordAdapter.timezone, the_config@1schema, every adapter's init options, and discovery'stimezonefield are nowstring | undefinedwith no default. PreviouslyreadStackConfig/APIAdapter.open()defaulted a missing value to'UTC', which asserts knowledge the stack was never actually given.datefields validated with bareDate.parse.Date.parseaccepts engine-dependent non-ISO formats ("March 1 2020", "3/1/2020") that the "Expected ISO 8601 date string" error message already claimed to reject. Now validated against an ISO 8601 shape (regex) withDate.parserunning afterward only as a calendar sanity check (e.g. rejects month 13).content: { x: null }filter silently matched nothing. SQL= NULLand JS===against a possibly-absent key are both never-true for a missing field, so a null content filter silently returned zero records — a caller writing "field absent" got an empty result with no signal. Fixed to mean "field absent or stored as null" (IS NULL/ missing-path semantics) in the shared SQL query builder (record-adapter-sqlite+record-adapter-sqljs) and inMemoryAdapter.Test plan
pnpm -r build— all packages buildpnpm -r typecheck— cleanpnpm -r lint— cleanpnpm -r test— full suite green across every packageasEntityentityId omission +-owngrant non-regression, timezone-undefined-by-default (adapter-api and core), ISO 8601 shape rejection of previously-accepted lenient formats, null-content-filter matching for both absent and explicit-null fields (sqlite, sqljs, and MemoryAdapter)docs/spec.mdupdated to document all four behavior changesGenerated by Claude Code