Skip to content

fix: resolve CI test failures in spec and objectql packages#1145

Merged
hotlong merged 1 commit intomainfrom
claude/fix-ci-test-errors
Apr 14, 2026
Merged

fix: resolve CI test failures in spec and objectql packages#1145
hotlong merged 1 commit intomainfrom
claude/fix-ci-test-errors

Conversation

@Claude
Copy link
Copy Markdown
Contributor

@Claude Claude AI commented Apr 14, 2026

CI tests failed in @objectstack/spec and @objectstack/objectql packages due to validation changes and missing registry methods.

Changes

packages/spec/src/stack.test.ts

  • Updated test to check individual manifest properties instead of deep equality, accounting for defaultDatasource: "default" being added during validation

packages/objectql/src/engine.ts

  • Use object's FQN (object?.name) when calling SchemaRegistry.getObjectOwner() instead of objectName, which may be a short name

packages/objectql/src/engine.test.ts

  • Added missing getObjectOwner() method to SchemaRegistry vitest mock with proper contributor tracking

packages/objectql/src/datasource-mapping.test.ts

  • Renamed SchemaRegistry.clear()reset()
  • Renamed engine.create()insert() (correct API method)
// Before: getObjectOwner called with potentially short name
const owner = SchemaRegistry.getObjectOwner(objectName);

// After: use FQN from resolved object
const fqn = object?.name || objectName;
const owner = SchemaRegistry.getObjectOwner(fqn);

- Fix spec test: update test expectation to account for defaultDatasource being added during validation
- Fix objectql SchemaRegistry mock: add missing getObjectOwner method to test mock
- Fix objectql engine: use object FQN when calling getObjectOwner to ensure correct ownership lookup
- Fix objectql datasource-mapping tests: rename SchemaRegistry.clear() to reset() and engine.create() to insert()

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/ecd04cb1-085f-40cc-be05-b236c08a82eb

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

vercel bot commented Apr 14, 2026

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

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 14, 2026 1:26pm
spec Ready Ready Preview, Comment Apr 14, 2026 1:26pm

Request Review

@github-actions github-actions bot added documentation Improvements or additions to documentation tests size/s labels Apr 14, 2026
@hotlong hotlong marked this pull request as ready for review April 14, 2026 13:26
Copilot AI review requested due to automatic review settings April 14, 2026 13:26
@hotlong hotlong merged commit 72d34af into main Apr 14, 2026
12 of 13 checks passed
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

Fixes CI failures in @objectstack/spec and @objectstack/objectql by aligning tests/mocks/docs with recent validation + registry behavior, and by correcting ownership lookup to use fully-qualified object names.

Changes:

  • Updated defineStack() test expectations to avoid failing on validator-added manifest defaults.
  • Fixed ObjectQL driver resolution to call SchemaRegistry.getObjectOwner() with the resolved object’s registry key (FQN) rather than a potentially-short name.
  • Updated ObjectQL tests/mocks to include getObjectOwner(), use SchemaRegistry.reset(), and call the correct CRUD API (insert()).

Reviewed changes

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

Show a summary per file
File Description
packages/spec/src/stack.test.ts Makes the strict-mode defineStack() test resilient to validator-applied defaults.
packages/objectql/src/engine.ts Uses resolved object name (FQN) for ownership-based manifest datasource lookup.
packages/objectql/src/engine.test.ts Extends the SchemaRegistry mock to support getObjectOwner() and resets contributor state.
packages/objectql/src/datasource-mapping.test.ts Updates tests to use SchemaRegistry.reset() and the engine’s insert() API.
content/docs/references/kernel/manifest.mdx Updates generated manifest reference docs to include defaultDatasource.
content/docs/references/api/auth-endpoints.mdx Updates generated auth endpoint reference docs (expanded sections + usage snippet).
Comments suppressed due to low confidence (1)

content/docs/references/api/auth-endpoints.mdx:32

  • The TypeScript usage snippet appears to import schema values that aren’t actually exported under these names. In packages/spec/src/api/auth-endpoints.zod.ts, the runtime Zod schemas are AuthEndpointSchema, AuthFeaturesConfigSchema, etc., while AuthEndpoint, AuthFeaturesConfig, etc. are type-only exports. As written, AuthEndpoint.parse(...) and the value import list will not typecheck/compile; update the snippet (or the docs generator) to import the *Schema values for .parse() and only import the inferred types as type if needed.
import { AuthEndpoint, AuthFeaturesConfig, AuthProviderInfo, EmailPasswordConfigPublic, GetAuthConfigResponse } from '@objectstack/spec/api';
import type { AuthEndpoint, AuthFeaturesConfig, AuthProviderInfo, EmailPasswordConfigPublic, GetAuthConfigResponse } from '@objectstack/spec/api';

// Validate data
const result = AuthEndpoint.parse(data);
</details>

Comment on lines +433 to +438
// Validation may add defaults like defaultDatasource
expect(result.manifest).toBeDefined();
expect(result.manifest.id).toBe(baseManifest.id);
expect(result.manifest.name).toBe(baseManifest.name);
expect(result.manifest.version).toBe(baseManifest.version);
expect(result.manifest.type).toBe(baseManifest.type);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This test no longer asserts the key behavior that changed (the defaulting of manifest.defaultDatasource). Since ManifestSchema sets defaultDatasource via .default('default'), it would be better to explicitly expect result.manifest.defaultDatasource to be 'default' (and optionally keep a stronger structural assertion like toMatchObject(config) for the rest) so the test still guards against unintended validation transforms.

Suggested change
// Validation may add defaults like defaultDatasource
expect(result.manifest).toBeDefined();
expect(result.manifest.id).toBe(baseManifest.id);
expect(result.manifest.name).toBe(baseManifest.name);
expect(result.manifest.version).toBe(baseManifest.version);
expect(result.manifest.type).toBe(baseManifest.type);
// Validation preserves the provided structure while applying schema defaults
expect(result).toMatchObject(config);
expect(result.manifest).toBeDefined();
expect(result.manifest.defaultDatasource).toBe('default');

Copilot uses AI. Check for mistakes.
Comment on lines 62 to 66
);

// Test that it uses memory driver
const result = await engine.create('account', { name: 'Test Account' });
const result = await engine.insert('account', { name: 'Test Account' });
expect(result).toBeDefined();
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

These datasource-mapping tests don’t currently verify which driver was selected (both mock drivers return the same shape), so the assertions will pass even if routing is broken. Consider asserting on memoryDriver.create/tursoDriver.create call counts (and ensure the registered object definition includes whatever fields the routing logic matches on, e.g. namespace, so the namespace rule can actually trigger).

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

documentation Improvements or additions to documentation size/s tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants