Repository navigation
feat(store): interval length and step, members-gated create, projected readers (#929) - #943
Merged
Merged
Conversation
…d readers (#929) - intervals.length fixes every slot's length and intervals.step puts both bounds on a grid (ISO 8601 durations for date-time bounds, counted from the epoch in UTC; positive integers for integer bounds). A write that breaks either is 422 invalid_record on every path; activation refuses stored records that break it and a length that is not a multiple of step. - create: {members} admits only a membership collection's principals to create: 401 without a principal, 403 membership_required as the first statement of the write transaction (before the body, the Idempotency-Key or any record), on HTTP, StoreExports and host transactions. - readers.properties makes a readers mount a projection: id and the listed properties only, sort and filters on those only, may limited to transitions over shown properties, and an ETag of the projection so a hidden balance moving is not observable. With properties, members is optional: a directory for finding a transfer recipient's record id without exposing any balance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
enabled auto-merge (squash)
September 29, 2026 18:20
This was referenced Sep 29, 2026
…d store CHANGELOG entry Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jimhoyd
added a commit
that referenced
this pull request
Sep 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Sep 29, 2026
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.
Fixes #929
The three store requests from the scheduling/credits agent trial (#902 item 6), all declarative, no application code.
1. Fixed-length, aligned slots:
intervals.lengthandintervals.steplength:endmust be exactlystart + length.step: both bounds must be whole multiples ofstep, counted from 1970-01-01T00:00:00Z (soPT1H= on the hour, UTC). Alone,stepgives "a whole number of slots"; with both, activation requireslengthto be a multiple ofstep.PT1H,PT30M,P1DT12H; no years, months or fractions).integerbounds take a positive integer.numberbounds take neither, because a fraction has no exact multiple.intervalIssuesrule, so it runs on every write path: create, PUT, PATCH, transitions, StoreExports and host transactions. It answers422 invalid_recordwith keywordintervals, and the message names the declaration, never the submitted value (must be exactly PT1H after start,must be a whole multiple of PT1H from 1970-01-01T00:00:00Z). Activation refuses stored records that break it.oneOfduration pattern / positive integer) and in the OpenAPI422. The authoring surface gainslength/duration/hour/alignedgoals, soplan-featurefor "one-hour slots" finds it.2. Members-gated create:
create: {members: <membership collection>}admit()gate that transitions and transfers use.POST <mount>answers401 principal_requiredwhen there is no principal (a shared collection included). Otherwise it answers403 membership_required, and that check is the first statement of the write transaction, after the fence. It runs before the body is judged, before the retainedIdempotency-Keyis read and before any record is counted. So a non-member gets the same 403 whatever the body, and a removed member's retry is refused rather than replayed.createInchecks the gate too, so StoreExports and host transactions pass it with the principal they are given.readOnlyone, and refuses amembersthat doesn't name a membership collection. OpenAPI lists the401/403on the create operation.3. Finding a transfer recipient without exposing balances:
readers.propertiesDesign. A projection on the existing readers mount. I chose it over a new "directory" mount type, or transfers addressed by owner or handle, for two reasons: it reuses one read path, gate and set of query rules, and it keeps transfers addressed by record id, so a transfer never resolves an owner inside its transaction. What makes the balance actually private:
id, the listed properties and (withshowOwner)_owner.createdAtandupdatedAtare dropped too, because they reveal activity.400 invalid_query, even if the collection declares it sortable or filterable, becausesort=-balancewould rank every wallet.may: lists only transitions whosefromnames only shown properties. Afromon a hidden property would disclose its value.etagsentries are a hash of the projection, not the record's own ETag. The record's ETag moves on every write, including a transfer, and would tell every reader when a hidden balance moved. The docs state it is not usable asIf-Match.properties,membersbecomes optional. The route's principal is still required (401). That is what makes it a directory every signed-in user can search. A readers declaration with neithermembersnorpropertiesis refused, so an ungated mount must list what it shows.Documented as disclosed: the listed values,
total, and which ids exist. Limitation: one readers mount per collection, so a collection can't have both a full reviewer view and a directory.Constraints kept
BEGIN IMMEDIATEtransaction, and the gate runs inside it.ReadersSpec.membersis now optional.NormalizedSpec.readersisNormalizedReaders, andCollection.create's third argument is the caller's principal (it was already the principal on owned collections).CreateSpecis exported.Docs and artifacts
docs/STORE.md (membership section, intervals, transfers, ordering, OpenAPI, the not-covered table), docs/FRAMEWORK.md (the trial gaps are marked fixed), the store README, SECURITY, CHANGELOG and llms.txt, the root llms.txt and the regenerated llms-full.txt, store
urlcode.json,artifacts/store-schema/schemas/config.json, EXTENSION-REFERENCE, and theauthoring.tssurfaces.Package budgets were raised. Store: 141531 packed / 548781 unpacked on Node 26, budgets 142 / 540 KiB. Core: 1010336 / 3979515, budgets 991 / 3891 KiB. Both leave +800 bytes for Node 24 and about 3 KiB of headroom.
Evidence
packages/store/test/trial-929.test.ts(8 tests) covers:mayfiltering, an ETag that is stable across a transfer and changes on rename, 401 and 405, the gated projection withshowOwner, and the OpenAPI projection.npm run verifygreen (core 1226 tests, store 194), andnpm run test:packagegreen.Not verified: CI's Node 24 package sizes (estimated at +800 bytes) and Windows. CI passing is not a security review.
🤖 Generated with Claude Code