Skip to content

fix: align all packages with @objectstack/spec v2.0.1 protocol#358

Merged
hotlong merged 3 commits intomainfrom
copilot/update-packages-according-spec
Feb 9, 2026
Merged

fix: align all packages with @objectstack/spec v2.0.1 protocol#358
hotlong merged 3 commits intomainfrom
copilot/update-packages-according-spec

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 9, 2026

Audit of all packages against @objectstack/spec v2.0.1 revealed several protocol violations in types, drivers, and tests.

IsolationLevel — wrong casing, missing value

Spec mandates snake_case (read_uncommitted, read_committed, repeatable_read) and includes snapshot. We had kebab-case and no snapshot.

// Before
export type IsolationLevel = 'read-uncommitted' | 'read-committed' | 'repeatable-read' | 'serializable';

// After
export type IsolationLevel = 'read_uncommitted' | 'read_committed' | 'repeatable_read' | 'serializable' | 'snapshot';

DriverCapabilities — extra properties violate spec

Spec sets additionalProperties: false. mutationLog and changeTracking were on the base interface, which would fail schema validation. Moved to a new RuntimeDriverCapabilities extension interface. Removed from pg-wasm and sqlite-wasm driver capability declarations.

FieldType — redundant union members

'location' and 'vector' are now in the spec's FieldType enum. Removed the duplicate entries from the runtime extension union.

Driver interface — missing spec methods

Added methods required by DriverInterfaceSchema: upsert, findStream, getPoolStats, syncSchema, dropTable, explain, commit, rollback. Deprecated commitTransaction/rollbackTransaction (removal in v5.0).

Driver updates

  • pg-wasm: isolation levels → snake_case, removed non-spec capabilities
  • sqlite-wasm: removed non-spec capabilities
  • pg-wasm tests: updated assertions to match snake_case

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectql Canceled Canceled Feb 9, 2026 1:11pm

Request Review

Copilot AI and others added 2 commits February 9, 2026 13:00
- Fix IsolationLevel to use snake_case per spec (read_uncommitted, read_committed, repeatable_read) and add missing 'snapshot'
- Move mutationLog/changeTracking to RuntimeDriverCapabilities (not in spec's DriverCapabilitiesSchema which has additionalProperties: false)
- Remove redundant 'location' and 'vector' from FieldType extension (now in spec's FieldType enum)
- Add spec-aligned Driver methods: commit, rollback, upsert, findStream, getPoolStats, syncSchema, dropTable, explain
- Mark commitTransaction/rollbackTransaction as deprecated in favor of spec-aligned commit/rollback
- Update pg-wasm driver isolation levels to snake_case
- Remove mutationLog/changeTracking from pg-wasm and sqlite-wasm drivers
- Update pg-wasm tests for snake_case isolation levels

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update software packages per latest @objectstack/spec requirements fix: align all packages with @objectstack/spec v2.0.1 protocol Feb 9, 2026
Copilot AI requested a review from hotlong February 9, 2026 13:05
@hotlong hotlong marked this pull request as ready for review February 9, 2026 13:12
Copilot AI review requested due to automatic review settings February 9, 2026 13:12
@hotlong hotlong merged commit 44c7e6b into main Feb 9, 2026
3 checks passed
@hotlong hotlong deleted the copilot/update-packages-according-spec branch February 9, 2026 13:12
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

Aligns the monorepo’s runtime/type surfaces with the @objectstack/spec v2.0.1 protocol, mainly by correcting protocol enums/unions and ensuring driver capability declarations don’t violate spec schema constraints.

Changes:

  • Updated IsolationLevel to snake_case and added snapshot; introduced RuntimeDriverCapabilities to keep sync-only flags out of spec-aligned DriverCapabilities.
  • Removed redundant runtime FieldType union members now covered by the spec.
  • Updated WASM drivers/tests to use the spec-aligned isolation level strings and removed non-spec capability flags from their declarations.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/foundation/types/src/field.ts Removes redundant runtime FieldType members now included in the protocol enum.
packages/foundation/types/src/driver.ts Aligns isolation levels; splits spec vs runtime-only capabilities; adds spec-surface driver methods.
packages/drivers/sqlite-wasm/src/index.ts Removes non-spec capability flags from the driver’s supports declaration.
packages/drivers/pg-wasm/src/index.ts Converts isolation level strings to snake_case; removes non-spec capability flags.
packages/drivers/pg-wasm/test/index.test.ts Updates isolation-level assertions to match snake_case strings.
Comments suppressed due to low confidence (2)

packages/drivers/pg-wasm/src/index.ts:9

  • Unused import ObjectQLError.
import { Driver, DriverCapabilities, ObjectQLError } from '@objectql/types';

packages/drivers/sqlite-wasm/src/index.ts:9

  • Unused import ObjectQLError.
import { Driver, DriverCapabilities, ObjectQLError } from '@objectql/types';

Comment on lines +271 to +276
* @param query - The structured QueryAST.
* @param options - Driver options.
* @returns AsyncIterable/ReadableStream of records.
*/
findStream?(objectName: string, query: any, options?: any): AsyncIterable<any> | any;

Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

findStream is documented as returning an AsyncIterable/ReadableStream, but the current return type AsyncIterable<any> | any collapses to any (because of the | any) and loses all type information. Consider removing | any and modeling the intended stream types explicitly (and typing query as QueryAST if that's the required input).

Copilot uses AI. Check for mistakes.
Comment on lines 98 to 103
it('should support all isolation levels', () => {
expect(driver.supports.isolationLevels).toContain('read-uncommitted');
expect(driver.supports.isolationLevels).toContain('read-committed');
expect(driver.supports.isolationLevels).toContain('repeatable-read');
expect(driver.supports.isolationLevels).toContain('read_uncommitted');
expect(driver.supports.isolationLevels).toContain('read_committed');
expect(driver.supports.isolationLevels).toContain('repeatable_read');
expect(driver.supports.isolationLevels).toContain('serializable');
});
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Test name says "support all isolation levels", but the assertions only cover 4 values and omit snapshot (which is now part of the IsolationLevel union). Either include snapshot in the driver capability + assertions, or rename the test to avoid claiming full coverage.

Copilot uses AI. Check for mistakes.
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.

3 participants