fix: resolve CI build failures - type conflicts and strict TypeScript errors#362
fix: resolve CI build failures - type conflicts and strict TypeScript errors#362
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… 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>
There was a problem hiding this comment.
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 withDriver.execute(command, parameters, options). - Replaces internal
_StateMachineConfigimport with publicStateMachineConfigin workflow plugin code/tests. - Adds explicit generics for
metadata.get/listandregistry.getEntrycall 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 deprecatedexecute(command, parameters, options)wrapper with the Driver-compatible signature that forwards string endpoints toexecuteCustomEndpoint(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);
| import type { StateMachineConfig } from '@objectql/types'; | ||
|
|
There was a problem hiding this comment.
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.
| import type { StateMachineConfig } from '@objectql/types'; |
| 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'; |
There was a problem hiding this comment.
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.
| import type { StateMachineConfig } from '@objectql/types'; |
| // Check if transition is allowed | ||
| const transitions = rule.transitions?.[oldState]; | ||
| const transitions = rule.transitions?.[oldState as string]; | ||
| if (!transitions) { | ||
| return { |
There was a problem hiding this comment.
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.
| const isAllowed = allowedNext.includes(newState as string); | ||
|
|
There was a problem hiding this comment.
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.
| 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); |
| 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); | ||
|
|
There was a problem hiding this comment.
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.
| 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[] : []; |
There was a problem hiding this comment.
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.
| const items = Array.isArray(rows) ? rows as unknown as PermissionRow[] : []; | |
| const items = Array.isArray(rows) ? [...(rows as unknown as PermissionRow[])] : []; |
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
execute()→executeCustomEndpoint()to avoid collision with optionalDriver.execute(command, parameters, options)Type import correction
_StateMachineConfig→StateMachineConfigin plugin-workflow (internal naming leaked to public API)TypeScript strict type assertions
metadata.get<T>(),registry.getEntry<T>(),metadata.list<T>()ValidationApiinterface for validation context type safetyPermissionRowinterface for database storage layergetKernel() as ObjectKernel, rowsas unknown as PermissionRowAffected packages: sdk, plugin-workflow, plugin-validator, plugin-security, core, platform-node, cli
Example
Before:
After:
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/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/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)/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)/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
💡 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.