Skip to content

Upstream sync: post-v1.0.0-beta.4 round 2 (#1299, #1315) + schema 1.0.49#108

Merged
krukow merged 2 commits into
mainfrom
upstream-sync/post-v1.0.0-beta.4-round-2
May 20, 2026
Merged

Upstream sync: post-v1.0.0-beta.4 round 2 (#1299, #1315) + schema 1.0.49#108
krukow merged 2 commits into
mainfrom
upstream-sync/post-v1.0.0-beta.4-round-2

Conversation

@krukow
Copy link
Copy Markdown
Collaborator

@krukow krukow commented May 20, 2026

Ports the SessionFs SQLite support from upstream PR #1299, updates examples/permission_bash.clj per upstream PR #1315, and bumps the pinned schema version from 1.0.49-1 to 1.0.49.

Changes

SessionFs SQLite support (upstream PR #1299)

  • New optional :sqlite {:query :exists} sub-provider for the provider-style createSessionFsHandler factory. Low-level handlers expose flat :sqlite-query / :sqlite-exists keys; the adapter bridges between them.
  • Clients advertise support via :capabilities {:sqlite true} under :session-fs; the value is forwarded on sessionFs.setProvider and validated at session creation (throws when capabilities.sqlite is declared but the provider lacks :sqlite).
  • queryType is coerced from the wire string to an idiomatic keyword (#{:exec :query :run}) before reaching the handler.
  • SQL bind-parameter map keys (e.g. $userId) bypass kebab-case conversion via an escape hatch in protocol/normalize-incoming.
  • Result row column-name keys (e.g. :user_id, :created_at) round-trip verbatim on the outgoing wire path via a new preserve-outgoing-opaque-fields escape hatch in protocol.clj, matching upstream Node.js semantics. (Found via multi-model code review.)
  • SQLite handler exceptions propagate as JSON-RPC errors, matching upstream Node behavior.

Schema 1.0.49

  • .copilot-schema-version advanced from 1.0.49-1 to 1.0.49
  • Additive only: new named enum types, format annotations, and the new sqlite RPC methods
  • Regenerated event_specs.clj reflects the new enums (upstream PRs #1305, #1307, #1327, #1333)

Examples

  • Updated examples/permission_bash.clj from deprecated :approved to current :approve-once (upstream PR #1315)

Validation

Check Result
bb test ✅ 269 tests / 1275 assertions, 0 failures
bb validate-docs ✅ 13 files, 0 warnings
./run-all-examples.sh ✅ all examples completed
E2E ⚠️ 2 pre-existing failures unrelated to this PR — local CLI 1.0.51-2 drift from pinned schema 1.0.49

Multi-model code review

Parallel reviews via Claude Opus 4.7 and GPT-5.5 both independently identified a HIGH severity bug:

# Finding Source Severity Decision
1 Outgoing SQL row column names mangled by recursive kebab→camelCase Opus + GPT HIGH Fixedpreserve-outgoing-opaque-fields escape hatch + regression test
2 capabilities.sqlite validation only checks :sqlite-query GPT MEDIUM Dismissedsession-fs-provider? already validates both arities; mirrors upstream client.ts:466
3 Channel-returned exceptions in await-session-fs-result GPT MEDIUM Out of scope — pre-existing, applies to all FS handlers
4 Unused ::sqlite-rows/::sqlite-columns used wrong seq? predicate Opus LOW Fixed — changed to (s/coll-of …)

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Ports the SessionFs SQLite support (upstream PR #1299) and bumps the
pinned schema version from 1.0.49-1 to 1.0.49.

### SessionFs SQLite (upstream PR #1299)

- New optional `:sqlite {:query :exists}` sub-provider for the
  provider-style `createSessionFsHandler` factory. Low-level handlers
  expose flat `:sqlite-query` / `:sqlite-exists` keys; the adapter
  bridges between them.
- Clients advertise support via `:capabilities {:sqlite true}` under
  `:session-fs`; the value is forwarded on `sessionFs.setProvider` and
  validated at session creation (throws when capabilities.sqlite is
  declared but the provider lacks :sqlite).
- `queryType` is coerced from the wire string to an idiomatic
  keyword (`#{:exec :query :run}`) before reaching the handler.
- SQL bind-parameter map keys (e.g. `$userId`) bypass kebab-case
  conversion via a new escape hatch in `protocol/normalize-incoming`.
- Result row column-name keys (e.g. `:user_id`, `:created_at`)
  round-trip verbatim on the outgoing wire path via a new
  `preserve-outgoing-opaque-fields` escape hatch in `protocol/`,
  matching upstream Node.js semantics where provider rows are forwarded
  untouched. (review feedback)
- SQLite handler exceptions propagate as JSON-RPC errors (not wrapped
  as SessionFsError result maps), matching upstream Node behavior.

### Schema 1.0.49

- `.copilot-schema-version` advanced from `1.0.49-1` to `1.0.49`
- Additive only: new named enum types, format annotations, and the
  new sessionFs.sqliteQuery / sessionFs.sqliteExists RPC methods
- Regenerated event_specs.clj reflects the new enums
- (upstream PRs #1305, #1307, #1327, #1333)

### Other

- Updated `examples/permission_bash.clj` from deprecated `:approved`
  to current `:approve-once` (carried from upstream PR #1315)
- Added integration tests covering the SQLite adapter, RPC dispatch,
  capability forwarding, validation throw, opaque param keys, and
  the new snake_case column-name round-trip regression test

### Validation

- bb test: 269 tests / 1275 assertions pass
- bb validate-docs: 0 warnings
- ./run-all-examples.sh: all examples pass
- E2E: 2 pre-existing failures (test-e2e-connection ping timestamp,
  test-e2e-blob-attachment timeout) due to local CLI 1.0.51-2 drift
  from the pinned 1.0.49 schema; unrelated to these changes

### Multi-model code review

Parallel reviews via Claude Opus 4.7 and GPT-5.5 both flagged the same
HIGH severity bug: outgoing SQL row column names were being mangled by
recursive kebab→camelCase conversion (`util/clj->wire`). Fixed by
adding `preserve-outgoing-opaque-fields` in protocol.clj, mirroring the
existing incoming escape hatch for bind params. Regression test added.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 12:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports upstream SessionFs SQLite support (PR #1299), updates an example per upstream (PR #1315), and bumps pinned Copilot schema assets to 1.0.49 to keep the Clojure SDK wire layer aligned with upstream.

Changes:

  • Add SessionFs SQLite RPC support (sessionFs.sqliteQuery, sessionFs.sqliteExists) including capability advertisement and handler/provider adaptation.
  • Add protocol escape hatches to preserve opaque SQL bind-parameter keys on incoming requests and preserve row column keys on outgoing sqlite results.
  • Bump pinned schema version to 1.0.49 and regenerate generated event specs; update permission_bash example and changelog/docs accordingly.
Show a summary per file
File Description
test/github/copilot_sdk/mock_server.clj Mock server now responds to sessionFs.setProvider for new capability forwarding tests.
test/github/copilot_sdk/integration_test.clj Adds integration tests covering sqlite adapter behavior, RPC dispatch, capability forwarding, and opaque key preservation.
src/github/copilot_sdk/specs.clj Extends specs with session-fs capabilities, optional sqlite handler keys, and sqlite query type/result shapes.
src/github/copilot_sdk/session.clj Implements sqlite adapter wiring, queryType coercion, and capability validation on handler installation.
src/github/copilot_sdk/protocol.clj Adds incoming/outgoing opaque-field preservation for sqlite bind params and result row keys.
src/github/copilot_sdk/generated/event_specs.clj Regenerated specs from updated schemas (enum tightening, etc.).
src/github/copilot_sdk/client.clj Routes new sqlite RPC methods and forwards :session-fs.capabilities on sessionFs.setProvider.
schemas/session-events.schema.json Upstream schema refresh (formats/enums/refs) as part of 1.0.49 bump.
schemas/api.schema.json Upstream API schema refresh adding sqlite RPCs and related type refactors as part of 1.0.49 bump.
schemas/README.md Updates pinned schema version text to 1.0.49.
.copilot-schema-version Bumps pinned schema version to 1.0.49.
examples/permission_bash.clj Updates permission decision kind to :approve-once.
doc/reference/API.md Documents optional sqlite support for SessionFs providers/handlers.
CHANGELOG.md Adds Unreleased entries for sqlite support + schema bump + example fix.

Copilot's findings

  • Files reviewed: 13/14 changed files
  • Comments generated: 2

Comment thread src/github/copilot_sdk/session.clj Outdated
Comment thread doc/reference/API.md Outdated
@krukow krukow marked this pull request as ready for review May 20, 2026 16:23
- session.clj: capabilities.sqlite validation now requires BOTH :sqlite-query
  and :sqlite-exists (previously only :sqlite-query). A low-level handler
  declaring only :sqlite-query would have passed validation but failed at
  runtime with an opaque "Unknown sessionFs method" error when
  sessionFs.sqliteExists arrived. The throw now reports which handler
  keys are missing.
- doc/reference/API.md: clarify that the low-level handler map requires
  the 10 core FS operations and the two :sqlite-* keys are optional
  (only required when :capabilities {:sqlite true} is advertised).
- integration_test.clj: regression test that create-session throws when
  capabilities.sqlite=true and the low-level handler has :sqlite-query
  but not :sqlite-exists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@krukow krukow merged commit 07af9e0 into main May 20, 2026
2 checks passed
@krukow krukow deleted the upstream-sync/post-v1.0.0-beta.4-round-2 branch May 20, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants