Skip to content

fix: resolve all CI build and test errors - #1007

Merged
hotlong merged 3 commits into
mainfrom
copilot/fix-ci-build-and-test-errors-yet-again
Mar 31, 2026
Merged

fix: resolve all CI build and test errors#1007
hotlong merged 3 commits into
mainfrom
copilot/fix-ci-build-and-test-errors-yet-again

Conversation

CopilotAI commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

CI was broken on main due to TypeScript build errors, adapter/test mismatches on discovery endpoints, and incorrect client feed routing.

ObjectQL build (TS2345)

SchemaRegistry.registerItem() calls in protocol.ts failed type checking when T inferred as unknown from getItem() return. Applied 'name' as any cast, consistent with existing pattern in engine.ts and metadata-facade.ts.

loadMetaFromDb object registration

registerItem('object', data) stores in the generic metadata map, but getItem('object', name) delegates to getObject() which reads from objectContributors. Objects registered via registerItem were invisible to lookups. Fixed by routing object-type records through registerObject():

if(record.type==='object'){SchemaRegistry.registerObject(dataasany,record.packageId||'sys_metadata');}else{SchemaRegistry.registerItem(record.type,data,'name'asany);}

Adapter discovery endpoints (hono, sveltekit, nuxt, nextjs, fastify)

All five adapters served discovery at ${prefix}/discovery but tests expect it at the prefix root (GET /api). Updated discovery route and .well-known/objectstack redirect to target prefix root.

Client feed routing

ObjectStackClient.feed methods called getRoute('feed')/api/v1/feed/..., but feed is a sub-resource of data. Changed to getRoute('data')/api/v1/data/{object}/{recordId}/feed, matching server-side routing.

@vercel

vercelBot commented Mar 31, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
objectstack-playReadyReadyPreview, CommentMar 31, 2026 7:07am
specReadyReadyPreview, CommentMar 31, 2026 7:07am

Request Review

- Fix TS2345 errors in objectql/protocol.ts: cast 'name' to 'any' in
SchemaRegistry.registerItem calls (lines 208, 222, 257, 269)
- Fix loadMetaFromDb to use registerObject for object types instead of
registerItem (fixes getItem/registerItem type mismatch for 'object')
- Fix discovery endpoint in hono, sveltekit, nuxt, nextjs, fastify
adapters: route discovery to prefix root instead of /discovery subpath
- Fix client feed namespace to use 'data' route instead of 'feed' route
(feed is a sub-resource of data: /api/data/{object}/{recordId}/feed)
Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/7eed517d-0606-4b0b-b9f5-3aa8e3ac5fe8
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/7eed517d-0606-4b0b-b9f5-3aa8e3ac5fe8
Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix all CI build and test errorsfix: resolve all CI build and test errorsMar 31, 2026
@hotlong
hotlong marked this pull request as ready for review March 31, 2026 07:08
CopilotAI review requested due to automatic review settings March 31, 2026 07:08
@hotlong
hotlong merged commit 8202582 into mainMar 31, 2026
4 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes CI failures caused by TypeScript build errors, adapter/test mismatches around discovery routing, incorrect client feed routing, and ObjectQL metadata hydration issues (notably around SchemaRegistry object registration semantics).

Changes:

  • Adjust SchemaRegistry.registerItem() calls in ObjectQL protocol to satisfy TypeScript when item type is inferred as unknown.
  • Move adapter discovery responses to the API prefix root (e.g. GET /api) and update .well-known/objectstack redirects accordingly.
  • Correct client feed routing to use the data route (/api/v1/data/{object}/{recordId}/...) instead of a standalone /feed route.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
packages/objectql/src/protocol.tsFix TS errors via keyField cast; adjust DB metadata hydration to route object records through registerObject()
packages/client/src/index.tsSwitch feed operations to use the data base route to match server routing
packages/adapters/sveltekit/src/index.tsServe discovery info at prefix root instead of /discovery
packages/adapters/nuxt/src/index.tsServe discovery at prefix root; update .well-known redirect target
packages/adapters/nextjs/src/index.tsServe discovery at prefix root; update .well-known redirect target
packages/adapters/hono/src/index.tsServe discovery at prefix root; update .well-known redirect target
packages/adapters/fastify/src/index.tsServe discovery at prefix root; update .well-known redirect target
CHANGELOG.mdDocument CI/build/test fixes under Unreleased/Fixed

Comment on lines 205 to 209
? JSON.parse(record.metadata)
: record.metadata;
// Hydrate back into registry
SchemaRegistry.registerItem(request.type, data, 'name');
SchemaRegistry.registerItem(request.type, data, 'name' as any);
return data;

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

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

The DB fallback hydration always uses SchemaRegistry.registerItem(...). For type === 'object', SchemaRegistry.getItem('object', ...) delegates to getObject() (objectContributors), so registering via registerItem won’t make future object lookups/listing work. Consider branching on record.type/request.type === 'object' and hydrating object records via SchemaRegistry.registerObject(...) (and pass namespace/package id from the sys_metadata row so FQNs and package scoping are preserved).

Copilot uses AI. Check for mistakes.
Comment on lines 253 to +257
item = typeof record.metadata === 'string'
? JSON.parse(record.metadata)
: record.metadata;
// Hydrate back into registry for next time
SchemaRegistry.registerItem(request.type, item, 'name');
SchemaRegistry.registerItem(request.type, item, 'name' as any);

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

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

Same as getMetaItems DB fallback: when request.type is 'object', hydrating via SchemaRegistry.registerItem(...) won’t populate the object registry used by getItem('object', ...)/getObject(). Align this path with loadMetaFromDb() by registering object-type records via SchemaRegistry.registerObject(...) instead, ideally using the sys_metadata row’s namespace and package id so FQN resolution remains correct.

Copilot uses AI. Check for mistakes.
Comment on lines +983 to +986
if (record.type === 'object') {
SchemaRegistry.registerObject(data as any, record.packageId || 'sys_metadata');
} else {
SchemaRegistry.registerItem(record.type, data, 'name' as any);

CopilotAIMar 31, 2026

Copy link

Choose a reason for hiding this comment

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

loadMetaFromDb() is reading record.packageId, but the persisted sys_metadata field is package_id (see SysMetadataObject). As written, this will almost always fall back to 'sys_metadata', losing package ownership. Also, SchemaRegistry.registerObject should likely receive the record’s namespace (or data.namespace) so objects are registered under the correct FQN rather than the short name. Consider using record.package_id ?? record.packageId and passing record.namespace (and for non-object types, pass the package id into registerItem(..., packageId) so listItems(type, packageId) works).

Suggested change
if(record.type==='object'){
SchemaRegistry.registerObject(dataasany,record.packageId||'sys_metadata');
}else{
SchemaRegistry.registerItem(record.type,data,'name'asany);
constpackageId=(recordasany).package_id??record.packageId??'sys_metadata';
constnamespace=(recordasany).namespace??(dataasany)?.namespace;
if(record.type==='object'){
SchemaRegistry.registerObject(dataasany,packageId,namespace);
}else{
SchemaRegistry.registerItem(record.type,data,'name'asany,packageId);

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

4 participants

@hotlong@xuyushun441-sys