Skip to content

refactor(core): move projected Session reads into Store - #46075

Merged
kitlangton merged 2 commits into
v2from
session-store-reads
Aug 29, 2026
Merged

refactor(core): move projected Session reads into Store#46075
kitlangton merged 2 commits into
v2from
session-store-reads

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Why

Session's public service still implements collection SQL and pagination even
though SessionStore already owns projected Session and message reads. That mixes
storage details with public policy, such as rejecting an unknown Session before
looking up a message cursor.

What Changes

Move the existing list and message queries into SessionStore. Session keeps the
public result wrapper and the existence check; callers see the same behavior.

Call Preserved contract
Session.list() { data }, newest updated Session first, no implicit Core limit
List anchors Exclusive (time_updated, id) boundary; previous pages retain requested order
Session.messages({ sessionID }) Newest durable message sequence first, no implicit Core limit
Message cursors Missing or foreign cursor returns [] for an existing Session
Unknown Session Session.messages fails with NotFoundError, even with a missing cursor
Malformed message row Collection reads retain typed MessageDecodeError

Session re-exports the same ListInput schema now defined by SessionStore. The
Store depends on canonical Schema contracts, not on the public Session service.

Scope

Only projected list/message reads and their regression coverage. Fork and move
keep their existing Database access. This follows #46019 and does not depend on
the separate standalone skill-activation cleanup.

Verification

Initial validation at bc922b8ac5:

# packages/core
bun typecheck
bun run test test/session-store.test.ts test/session-projector.test.ts test/shared-schema.test.ts test/session-create.test.ts test/session-message-update.test.ts
bun run test

# packages/sdk
bun typecheck
OPENCODE_DISABLE_MODELS_FETCH=true bun run ../core/script/test.ts

# packages/server
bun typecheck
bun run ../core/script/test.ts

Focused Core: 67 passed, 0 failed across five files. Full Core: 3,977 passed,
40 skipped, 0 failed
across 226 files. SDK: 26 passed, 0 failed. Server:
45 passed, 3 skipped, 0 failed. All three package typechecks passed.
All 33 pre-push typecheck tasks passed at bc922b8ac5.

Three simplify passes reviewed the complete diff for reuse, quality, and
efficiency and found no actionable changes. Formatting, both Effect AST scans,
and diff checks passed. Oxlint reported zero errors and eight warnings on
unchanged code.

After integrating v2 at 171947787c, including the confirmed test-race fix in
#46083, the focused Core suite again passed 67/67 and all 33 pre-push
typecheck tasks
passed at b76c23d6dd. The refactor diff is byte-identical to
the reviewed version; only its base changed. The diff-viewer suite also passed
91/91 on this integration:

# packages/tui
bun run test test/cli/tui/diff-viewer.test.tsx

@kitlangton
kitlangton merged commit 8ba434b into v2 Aug 29, 2026
10 checks passed
@kitlangton
kitlangton deleted the session-store-reads branch August 29, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant