Skip to content

feat(store)!: named readers mounts (#944) and a step grid with an origin (#945) - #966

Merged
jimhoyd merged 6 commits into
mainfrom
claude/store-readers-grid-944
Sep 29, 2026
Merged

jimhoyd merged 6 commits into
mainfrom
claude/store-readers-grid-944

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #944
Fixes #945

#944: several readers mounts per collection

readers is now a map of named mounts (at most 8):

readers:
  directory: {mount: /api/directory, properties: [name]}           # every signed-in principal: id and name
  audit: {mount: /api/audit, members: treasurers, showOwner: true}  # treasurers: whole records and owners
  • Each entry keeps today's rules: members?, properties? and showOwner?. A mount with neither members nor properties is still refused.
  • Each mount keeps its own projection guarantees: its own gate (checked first), its sort and filter rules (listed properties only on a projection), may (hidden-from transitions left out) and ETag (a hash of the projection on a projected mount, the record's own ETag on a whole-record mount).
  • Activation refuses two readers that share a mount. Every readers diagnostic names the mount (readers audit: ...).
  • OpenAPI describes each readers mount as its own path. A projected or showOwner mount gets its own Store<Collection><Name>ReaderRecord and ...ReaderList. A plain members-gated mount reuses Store<Collection>Record.
  • There is no back-compat: the single-object form is gone. Updated uses:
    • test fixtures;
    • both private-requests proofs;
    • the docs, README, SECURITY and llms;
    • the plan-feature test.
  • The normalized declaration always carries readers (empty when none), so every collection's declaration fingerprint changes once. As with any declaration change, the first activation of this release wins the fence (Supported multi-process serving on one host: auth SQLite pragmas, database rate limit, declaration fence, setup refusal, multi-process harness (#902 item 4) #927).

#945: intervals.origin

  • origin (with step only) sets where the grid counts from:

    • an RFC 3339 date-time with Z or a fixed ±hh:mm offset, for date-time bounds;
    • an integer, for integer bounds.

    The default stays the epoch, or 0.

  • Example: origin: 1970-01-01T00:00:00+05:30 puts step: PT1H on the local hour at UTC+05:30. With P1D it is local midnight there.

  • The origin is stored as its residue modulo the step, and a bound is on the grid when its own residue matches. This keeps the check exact for any safe integer, including bounds before the origin.

  • A 422 names the declared origin, for example must be a whole multiple of PT1H from 1970-01-01T00:00:00+05:30. The OpenAPI 422 says the same.

  • Activation refuses:

    • an origin without step;
    • an impossible date (30 February, hour 24);
    • an offset of 24:00 or more;
    • sub-millisecond precision;
    • the wrong kind for the bounds.

Why "Fixes #945" without IANA time zones. No IANA time zones, and no daylight saving. docs/STORE.md ("A grid with an origin") explains why:

  • Zone rules would put tz data in the write path. Two processes on one database could then disagree, depending on the tz database each loaded.
  • A local grid has no exact answer in a daylight-saving gap or overlap.

The remaining gap is narrow. For a grid of an hour or less, a whole-hour daylight-saving change does not move it (UTC+09:30 and UTC+10:30 both put PT1H at :30 past). Only daily or longer grids in zones that change their offset shift for part of the year. No trial has needed that, so I'm closing the issue. Reopen it with the YAML if one does.

Evidence

  • New packages/store/test/readers-grid.test.ts covers:
    • two mounts on one collection: their gates, views, sort, may and ETags;
    • activation refusals;
    • OpenAPI paths and schemas per mount;
    • fingerprint coverage: key order does not matter, while renaming or removing a mount changes the fingerprint;
    • origin grids at UTC+05:30 (hourly and daily);
    • an integer grid from 5, including below the origin;
    • exactness at -Number.MAX_SAFE_INTEGER;
    • refusals, and the fingerprint and OpenAPI for an origin.
  • Existing tests were migrated to the map form.
  • npm run verify and npm run test:package both pass locally (macOS, Node 26), after merging origin/main (Fixtures: hermetic test databases and seeds; assert one JSON property; resolved captures in failures #930).
  • Store package budgets were raised to 147 KiB packed and 557 KiB unpacked. Measured: 146370 packed / 566386 unpacked bytes, plus 800 bytes for Node 24 and about 3 KiB of headroom.
  • Every write is still in BEGIN IMMEDIATE: no write path changed, only the interval rule and the read-only readers dispatch.

Limitations: local runs only on macOS; the CI matrix covers Windows and Linux. Not an independent security review.

🤖 Generated with Claude Code

jimhoyd and others added 2 commits September 29, 2026 14:59
…gin (#945)

readers is a map of named mounts, each with its own members, showOwner and
properties, so one collection serves a projected directory and a members-gated
whole-record view side by side. Each mount keeps its own gate, projection,
query rules, may and ETag; OpenAPI describes each as its own path with its own
reader schemas. The single-object form is removed.

intervals.origin sets where the step grid counts from: a date-time with Z or
a fixed offset for date-time bounds, an integer for integer bounds. The check
compares residues modulo the step, so it stays exact; no time-zone rules or
daylight saving are followed, and the docs say why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…grid-944

# Conflicts:
#	packages/store/CHANGELOG.md
#	scripts/package-audit.ts
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 20:11
jimhoyd and others added 4 commits September 29, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant