Skip to content

Upgrade @objectstack/spec to v0.3.3#192

Merged
xuyushun441-sys merged 26 commits intomainfrom
copilot/update-objectstack-to-latest
Jan 25, 2026
Merged

Upgrade @objectstack/spec to v0.3.3#192
xuyushun441-sys merged 26 commits intomainfrom
copilot/update-objectstack-to-latest

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 25, 2026

Upgrades @objectstack/spec dependency from 0.3.1 to 0.3.3 and adapts to breaking changes in the new protocol specification.

Breaking Changes Addressed

Namespace reorganization:

  • System.DriverInterfaceDriver.DriverInterface
  • System.DriverOptionsDriver.DriverOptions
  • System.PluginDefinitionKernel.PluginDefinition

QueryAST schema modernization (aligns with Prisma/TypeORM conventions):

// Before (v0.3.1)
const ast = {
  object: 'users',
  filters: [['age', '>', 18]],
  sort: [['name', 'asc']],
  top: 10,
  skip: 0
};

// After (v0.3.3)
const ast = {
  object: 'users',
  where: { age: { $gt: 18 } },
  orderBy: [{ field: 'name', order: 'asc' }],
  limit: 10,
  offset: 0
};

Filter format:

  • Removed array-based FilterNode type
  • Now uses object-based FilterCondition natively
  • Simplified FilterTranslator (pass-through instead of conversion)
  • Updated MongoDB driver to handle both legacy array and new object formats

Files Modified

  • 12 package.json files: Dependency version bumps
  • 15 core files: QueryAST property mappings, filter translation
  • 9 driver files: Import namespace updates
  • 2 test files: QueryAST format updates

Compatibility

No changes to ObjectQL's public API. Drivers transparently convert between new QueryAST format and internal legacy formats.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fastdl.mongodb.org
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/objectql/objectql/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js ndor/bin/git bash /.bi�� \|pluginId spec@0.3.3/node_modules/@objectstack/spec/dist/kernel/context.zod.d.ts in/node (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/objectql/objectql/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js (dns block)
    • Triggering command: /usr/local/bin/node /usr/local/bin/node /home/REDACTED/work/objectql/objectql/node_modules/.pnpm/jest-worker@30.2.0/node_modules/jest-worker/build/processChild.js rgo/bin/git grep odules/jest-worker/build/processChild.js \|pluginId pm/@objectstack+spec@0.3.3/node_modules/@objectstack/spec/dist/data/object.zod.d.ts grep (dns block)
  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/objectql/objectql/apps/site/node_modules/.bin/../next/dist/bin/next build bash --no�� -r napi || node-gyp rebuild tack/spec/dist/kernel/plugin.zod.d.ts nfig/composer/vendor/bin/sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

objectstack升级到最新版并更新相关代码


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 25, 2026

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

Project Deployment Review Updated (UTC)
objectql-site Ready Ready Preview, Comment Jan 25, 2026 9:08am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 2 commits January 25, 2026 07:12
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
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] Upgrade objectstack to latest version and update related code Upgrade @objectstack/spec to v0.3.3 Jan 25, 2026
Copilot AI requested a review from hotlong January 25, 2026 07:23
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copilot AI and others added 6 commits January 25, 2026 07:28
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 3 commits January 25, 2026 07:49
@hotlong hotlong marked this pull request as ready for review January 25, 2026 07:59
Copilot AI review requested due to automatic review settings January 25, 2026 07:59
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copilot AI and others added 2 commits January 25, 2026 08:01
…k/spec v0.3.3

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
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

Upgrades @objectstack/spec to v0.3.3 across the monorepo and updates core + drivers to match the new namespace layout and modernized QueryAST shape (where/orderBy/limit/offset).

Changes:

  • Bumped @objectstack/spec from 0.3.10.3.3 (plus lockfile updates).
  • Updated core query compilation to emit the new QueryAST keys and simplified filter translation.
  • Updated driver imports/namespaces and executeQuery mappings to support the new QueryAST format; adjusted Mongo/FS tests to the new AST format.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks @objectstack/spec@0.3.3 (and related deps like zod).
packages/foundation/types/package.json Bumps peer/dev @objectstack/spec and adds zod dev dependency.
packages/foundation/platform-node/src/plugin.ts Updates plugin type import to Kernel.PluginDefinition.
packages/foundation/platform-node/package.json Bumps @objectstack/spec dependency.
packages/foundation/core/test/app.test.ts Updates plugin type reference to Kernel.PluginDefinition.
packages/foundation/core/src/repository.ts Removes legacy FilterNode type usage.
packages/foundation/core/src/query/query-builder.ts Maps UnifiedQuery → new QueryAST keys (where/orderBy/limit/offset).
packages/foundation/core/src/query/query-analyzer.ts Updates explain-plan QueryAST construction to new keys.
packages/foundation/core/src/query/filter-translator.ts Switches to pass-through translation returning FilterCondition.
packages/foundation/core/src/index.ts Updates exported driver spec types to Driver.* namespace.
packages/foundation/core/package.json Bumps @objectstack/spec dependency.
packages/drivers/sql/src/index.ts Updates spec namespaces + executeQuery mappings to new QueryAST keys.
packages/drivers/sql/package.json Bumps @objectstack/spec dependency.
packages/drivers/sdk/src/index.ts Updates spec namespaces to Driver.*.
packages/drivers/sdk/package.json Bumps @objectstack/spec dependency.
packages/drivers/redis/src/index.ts Updates spec namespaces, QueryAST key mappings, and adds FilterCondition→array conversion.
packages/drivers/redis/package.json Bumps @objectstack/spec dependency.
packages/drivers/mongo/test/index.test.ts Updates tests to new QueryAST keys (where/orderBy/limit/offset).
packages/drivers/mongo/src/index.ts Updates spec namespaces, supports object-based filters, and updates executeQuery mapping.
packages/drivers/mongo/package.json Bumps @objectstack/spec dependency.
packages/drivers/memory/src/index.ts Updates spec namespaces and executeQuery mapping to new QueryAST keys.
packages/drivers/memory/package.json Bumps @objectstack/spec dependency.
packages/drivers/localstorage/src/index.ts Updates spec namespaces, QueryAST key mappings, and adds FilterCondition→array conversion.
packages/drivers/localstorage/package.json Bumps @objectstack/spec dependency.
packages/drivers/fs/test/index.test.ts Updates tests to new QueryAST keys (where/orderBy/limit/offset).
packages/drivers/fs/src/index.ts Updates spec namespaces, QueryAST key mappings, and adds FilterCondition→array conversion.
packages/drivers/fs/package.json Bumps @objectstack/spec dependency.
packages/drivers/excel/src/index.ts Updates spec namespaces, QueryAST key mappings, and adds FilterCondition→array conversion.
packages/drivers/excel/package.json Bumps @objectstack/spec dependency.
examples/showcase/enterprise-erp/package.json Bumps @objectstack/spec dependency for the example app.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

if (!filters) {
return undefined;
}

Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

translate is now a raw pass-through cast. The codebase still produces legacy array filters (e.g. packages/foundation/core/src/query/query-service.ts:235 uses filters: [[...]]), which would end up as QueryAST.where = [...] and no longer match the FilterCondition schema. Please either convert legacy arrays to FilterCondition here, or reject arrays with an ObjectQLError and a clear migration message.

Suggested change
// Legacy safeguard: reject array-based filters (e.g. filters: [[...]]) explicitly.
// The new FilterCondition schema expects an object-based filter.
if (Array.isArray(filters)) {
throw new ObjectQLError({
code: 'VALIDATION_FAIL',
message:
'Legacy array-based filters (e.g. filters: [[...]]) are no longer supported. ' +
'Please migrate to the object-based FilterCondition format and remove array-style filters from query-service and callers.',
});
}

Copilot uses AI. Check for mistakes.
import { Data } from '@objectstack/spec';
type FilterNode = Data.FilterNode;
type FilterCondition = Data.FilterCondition;
import { ObjectQLError } from '@objectql/types';
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

ObjectQLError is imported but no longer used after simplifying FilterTranslator. Please remove the unused import (or use it for validation/error reporting if you decide to reject unsupported filter shapes).

Suggested change
import { ObjectQLError } from '@objectql/types';

Copilot uses AI. Check for mistakes.
Comment on lines 979 to +982
fields: ast.fields,
filters: this.convertFilterNodeToLegacy(ast.filters),
sort: ast.sort?.map(s => [s.field, s.order]),
limit: ast.top,
offset: ast.skip,
filters: this.convertFilterNodeToLegacy(ast.where),
sort: ast.orderBy?.map(s => [s.field, s.order]),
limit: ast.limit,
skip: ast.offset,
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

executeQuery passes ast.where straight into legacyQuery.filters, and convertFilterNodeToLegacy is now a no-op. For FilterCondition inputs like { age: { $gt: 18 } } or { $and: [...] }, applyFilters will treat them as plain objects and emit where('age', { $gt: 18 }) / where('$and', ...), which is incorrect SQL. Please either (a) implement a real FilterCondition -> legacy array conversion here (similar to other drivers), or (b) extend applyFilters to understand FilterCondition operators/logical keys.

Copilot uses AI. Check for mistakes.
Comment on lines +726 to +732
case '$regex': op = 'like'; break;
default: op = '=';
}
result.push([field, op, operandValue]);
}
} else {
// Handle simple equality: { field: value }
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

convertFilterConditionToArray appends multiple [field, op, value] conditions without inserting 'and' separators. In this driver, matchesFilters only combines conditions using the explicit operator tokens, so inputs like { a: 1, b: 2 } or { age: { $gt: 1, $lt: 10 } } can end up evaluating only the first condition. Please interleave 'and' between generated conditions by default. Also, $regex is mapped to 'like', but evaluateCondition doesn’t handle 'like' in this driver—either map to 'contains' or add 'like' support.

Suggested change
case '$regex': op = 'like'; break;
default: op = '=';
}
result.push([field, op, operandValue]);
}
} else {
// Handle simple equality: { field: value }
case '$regex': op = 'contains'; break;
default: op = '=';
}
// Interleave 'and' between multiple conditions by default
if (result.length > 0) {
const lastToken = result[result.length - 1];
if (typeof lastToken !== 'string' || (lastToken !== 'and' && lastToken !== 'or')) {
result.push('and');
}
}
result.push([field, op, operandValue]);
}
} else {
// Handle simple equality: { field: value }
if (result.length > 0) {
const lastToken = result[result.length - 1];
if (typeof lastToken !== 'string' || (lastToken !== 'and' && lastToken !== 'or')) {
result.push('and');
}
}

Copilot uses AI. Check for mistakes.
filters: ast.where, // FilterCondition is already MongoDB-compatible
sort: ast.orderBy?.map((s: SortNode) => [s.field, s.order]),
limit: ast.limit,
offset: ast.offset,
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

In executeQuery, the legacy query object uses offset: ast.offset, but the driver’s find() pagination logic reads normalizedQuery.skip (and normalizeQuery doesn’t map offset -> skip). As a result, QueryAST.offset will be ignored for MemoryDriver queries. Please change this mapping to skip: ast.offset (or update normalizeQuery to alias offset to skip).

Suggested change
offset: ast.offset,
skip: ast.offset,

Copilot uses AI. Check for mistakes.
Comment on lines 169 to +172
object: objectName,
filters: query.filters as any, // FilterCondition is compatible with FilterNode
sort: query.sort as any, // Will be converted to SortNode[] format
top: query.limit, // Changed from limit to top (QueryAST uses 'top')
skip: query.skip,
where: query.filters as any, // FilterCondition format
orderBy: query.sort as any, // Will be converted to SortNode[] format
limit: query.limit,
offset: query.skip,
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

QueryAnalyzer.explain assigns orderBy: query.sort as any, but UnifiedQuery.sort is [field, order][] while QueryAST.orderBy expects { field, order }[]. This produces an invalid/misleading ast in the returned plan/profile. Prefer reusing QueryBuilder.build(...) (or mapping query.sort the same way as QueryBuilder) so the analyzed AST matches what would actually be executed.

Copilot uses AI. Check for mistakes.
Comment on lines +788 to +792
result.push([field, op, operandValue]);
}
} else {
// Handle simple equality: { field: value }
result.push([key, '=', value]);
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

convertFilterConditionToArray appends multiple conditions into result without inserting 'and' separators (e.g., { a: 1, b: 2 } or { age: { $gt: 1, $lt: 10 } }). matchesFilters only combines conditions using explicit operator tokens, so extra conditions can be ignored. Please interleave 'and' between generated conditions by default.

Copilot uses AI. Check for mistakes.
Comment on lines +822 to +826
result.push([field, op, operandValue]);
}
} else {
// Handle simple equality: { field: value }
result.push([key, '=', value]);
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

convertFilterConditionToArray pushes multiple conditions into result without inserting 'and' separators (e.g., multiple fields in the same object, or multiple operators on one field). matchesFilters only combines conditions using explicit operator tokens, so extra conditions beyond the first can be ignored. Please interleave 'and' between generated conditions by default when building result.

Copilot uses AI. Check for mistakes.
Comment on lines +1098 to +1102
case '$regex': op = 'like'; break;
default: op = '=';
}
result.push([field, op, operandValue]);
}
Copy link

Copilot AI Jan 25, 2026

Choose a reason for hiding this comment

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

convertFilterConditionToArray appends multiple [field, op, value] entries without inserting 'and' separators (for multiple fields or multiple operators on the same field). Since matchesFilters combines conditions only via explicit operator tokens, the additional conditions may be skipped. Please interleave 'and' between generated conditions by default.

Copilot uses AI. Check for mistakes.
Copilot AI and others added 2 commits January 25, 2026 08:13
Update test files to use correct QueryAST property names:
- where (instead of filters)
- orderBy (instead of sort)
- limit (instead of top)
- offset (instead of skip)

Also update filter syntax to MongoDB-style format:
- { age: { $gt: 25 } } instead of { type: 'comparison', ... }
- { $and: [...] } instead of { type: 'and', children: [...] }

Fixed in:
- packages/drivers/excel/test/index.test.ts
- packages/drivers/localstorage/test/index.test.ts

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copilot AI and others added 4 commits January 25, 2026 08:29
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

Copilot AI and others added 4 commits January 25, 2026 08:54
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ No Changeset Found

This PR does not include a changeset file.
If this PR includes user-facing changes, please add a changeset by running:

pnpm changeset

@xuyushun441-sys xuyushun441-sys merged commit d4d19f2 into main Jan 25, 2026
3 of 4 checks passed
@xuyushun441-sys xuyushun441-sys deleted the copilot/update-objectstack-to-latest branch January 25, 2026 09:09
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.

4 participants