Skip to content

fix: resolve CI build failures - type conflicts and strict TypeScript errors#362

Merged
hotlong merged 3 commits intomainfrom
copilot/fix-ci-build-and-test
Feb 10, 2026
Merged

fix: resolve CI build failures - type conflicts and strict TypeScript errors#362
hotlong merged 3 commits intomainfrom
copilot/fix-ci-build-and-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 10, 2026

CI build failed due to TypeScript compilation errors: method signature conflict in RemoteDriver, incorrect internal type import, and missing type parameters across the codebase.

Changes

RemoteDriver method signature conflict

  • Renamed execute()executeCustomEndpoint() to avoid collision with optional Driver.execute(command, parameters, options)
  • The original method was for custom HTTP endpoint calls, not command execution
  • Breaking change for SDK users

Type import correction

  • _StateMachineConfigStateMachineConfig in plugin-workflow (internal naming leaked to public API)

TypeScript strict type assertions

  • Added generic parameters to metadata.get<T>(), registry.getEntry<T>(), metadata.list<T>()
  • Introduced ValidationApi interface for validation context type safety
  • Introduced PermissionRow interface for database storage layer
  • Added explicit casts: getKernel() as ObjectKernel, rows as unknown as PermissionRow

Affected packages: sdk, plugin-workflow, plugin-validator, plugin-security, core, platform-node, cli

Example

Before:

const obj = this.metadata.get('object', name); // Type: {} 
await driver.execute('/api/custom', payload);  // Conflicts with Driver.execute

After:

const obj = this.metadata.get<ObjectConfig>('object', name); // Type: ObjectConfig
await driver.executeCustomEndpoint('/api/custom', payload);  // Clear intent

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: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/objectql/objectql/node_modules/.bin/../vitest/vitest.mjs run conntrack --ctstate INVALID,NEW -j DROP tsc corepack (dns block)
  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/objectql/objectql/apps/site/node_modules/.bin/../next/dist/bin/next build (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/objectql/objectql/apps/site/node_modules/.bin/../next/dist/bin/next build bash pescript/bin/tsc (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/objectql/objectql/apps/site/node_modules/.bin/../next/dist/bin/next build sh e_mo�� tsc (dns block)

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

Original prompt

引用: https://github.com/objectstack-ai/objectql/actions/runs/21837576040/job/63012962963#step:9:1

fix all ci build and test


💡 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 10, 2026

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

Project Deployment Actions Updated (UTC)
objectql Canceled Canceled Feb 10, 2026 0:51am

Request Review

Copilot AI and others added 2 commits February 10, 2026 00:35
… imports, and TypeScript strict type issues

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] Fix all CI build and test issues fix: resolve CI build failures - type conflicts and strict TypeScript errors Feb 10, 2026
Copilot AI requested a review from hotlong February 10, 2026 00:42
@hotlong hotlong marked this pull request as ready for review February 10, 2026 00:46
Copilot AI review requested due to automatic review settings February 10, 2026 00:46
@hotlong hotlong merged commit b9b7a27 into main Feb 10, 2026
2 of 3 checks passed
@hotlong hotlong deleted the copilot/fix-ci-build-and-test branch February 10, 2026 00:47
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 TypeScript build failures across the monorepo by resolving SDK driver method signature conflicts, correcting leaked internal type imports, and tightening metadata/registry typing via generics and targeted casts.

Changes:

  • Renames RemoteDriver.execute()executeCustomEndpoint() to avoid clashing with Driver.execute(command, parameters, options).
  • Replaces internal _StateMachineConfig import with public StateMachineConfig in workflow plugin code/tests.
  • Adds explicit generics for metadata.get/list and registry.getEntry call sites; introduces small local interfaces to satisfy strict TS.

Reviewed changes

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

Show a summary per file
File Description
packages/tools/cli/src/commands/repl.ts Adds generic typing to metadata.list() for object name enumeration in REPL.
packages/foundation/plugin-workflow/src/types.ts Updates workflow types import to StateMachineConfig.
packages/foundation/plugin-workflow/tests/workflow-plugin.spec.ts Updates test type import to StateMachineConfig.
packages/foundation/plugin-validator/src/validator.ts Adds minimal ValidationApi and uses casts to satisfy strict TS in uniqueness/state-machine validation.
packages/foundation/plugin-security/src/storage-database.ts Introduces PermissionRow and casts driver result rows for typed access; improves delete/update ID guards.
packages/foundation/platform-node/src/loader.ts Adds generic typing to registry.getEntry() call sites.
packages/foundation/core/src/repository.ts Casts getKernel() return to ObjectKernel (IObjectQL returns unknown).
packages/foundation/core/src/query/query-service.ts Adds metadata.get<ObjectConfig>() generic for schema access.
packages/foundation/core/src/query/query-analyzer.ts Adds metadata.get<ObjectConfig>() generic for schema access.
packages/drivers/sdk/test/remote-driver.test.ts Updates tests to call executeCustomEndpoint().
packages/drivers/sdk/src/index.ts Renames custom endpoint execution method to executeCustomEndpoint().
Comments suppressed due to low confidence (1)

packages/drivers/sdk/src/index.ts:564

  • This rename introduces a breaking API change for SDK consumers. To keep backward compatibility while still satisfying the optional Driver.execute(command, parameters, options) signature, consider adding a deprecated execute(command, parameters, options) wrapper with the Driver-compatible signature that forwards string endpoints to executeCustomEndpoint (and throws a clear error for unsupported command execution).
    async executeCustomEndpoint(endpoint?: string, payload?: any, _options?: any): Promise<any> {
        return this.retryWithBackoff(async () => {
            const targetEndpoint = endpoint 
                ? this.buildEndpoint(endpoint)
                : this.buildEndpoint(this.executePath);

Comment on lines +14 to 15
import type { StateMachineConfig } from '@objectql/types';

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

StateMachineConfig is imported but never used in this file. Please remove the unused type import (or use it in a public type) to avoid unused-import lint/TS warnings.

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

Copilot uses AI. Check for mistakes.
import { describe, it, expect, beforeEach } from 'vitest';
import { WorkflowPlugin } from '../src/workflow-plugin';
import type { _StateMachineConfig } from '@objectql/types';
import type { StateMachineConfig } from '@objectql/types';
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

StateMachineConfig is imported but not referenced anywhere in this test. Please remove the unused type import to keep the test file warning-free under strict/lint settings.

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

Copilot uses AI. Check for mistakes.
Comment on lines 373 to 376
// Check if transition is allowed
const transitions = rule.transitions?.[oldState];
const transitions = rule.transitions?.[oldState as string];
if (!transitions) {
return {
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Casting oldState to string to index rule.transitions can mask invalid record data (e.g., non-string/undefined values) and can lead to looking up the 'undefined' key. Consider explicitly validating oldState/newState are strings (or coercing via String(...) with a clear error path) before reading transitions so invalid state values fail deterministically.

Copilot uses AI. Check for mistakes.
Comment on lines +394 to 395
const isAllowed = allowedNext.includes(newState as string);

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

allowedNext.includes(newState as string) will happily accept non-string state values after the cast. It would be safer to ensure newState is a string (and return a validation failure if it isn’t) rather than forcing the type.

Suggested change
const isAllowed = allowedNext.includes(newState as string);
// Ensure the new state is a string before checking allowed transitions
if (typeof newState !== 'string') {
return {
rule: rule.name,
valid: false,
message: this.formatMessage(rule.message, { old_status: oldState, new_status: newState }),
error_code: rule.error_code,
severity: rule.severity || 'error',
fields: [rule.field],
};
}
const isAllowed = allowedNext.includes(newState);

Copilot uses AI. Check for mistakes.
Comment on lines 488 to 491
try {
// Query database to count existing records with same field values
const count = await context.api.count(objectName, filters);
const count = await (context.api as ValidationApi).count(objectName, filters);

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

context.api is unknown and is cast to ValidationApi without checking that count actually exists. If a caller provides an API object without count, this will throw a runtime TypeError and be reported as a failed uniqueness check. Consider narrowing with a runtime check like typeof (context.api as any).count === 'function' (and returning a clear error) before calling.

Copilot uses AI. Check for mistakes.
const rows = await driver.find(this.tableName, {});
// Create a shallow copy to avoid issues when deleting during iteration
const items = Array.isArray(rows) ? [...rows] : [];
const items = Array.isArray(rows) ? rows as unknown as PermissionRow[] : [];
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

The comment says we create a shallow copy before deleting during iteration, but the code no longer copies (items is just rows cast). Either restore the shallow copy (e.g., via spread) or update/remove the comment; keeping a copy can matter if a driver returns a mutable array that changes as deletes happen.

Suggested change
const items = Array.isArray(rows) ? rows as unknown as PermissionRow[] : [];
const items = Array.isArray(rows) ? [...(rows as unknown as PermissionRow[])] : [];

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