Skip to content

ci: add PR build/typecheck/test workflow + fix latent type errors#414

Merged
zknpr merged 1 commit into
mainfrom
chore/ci-typecheck
May 30, 2026
Merged

ci: add PR build/typecheck/test workflow + fix latent type errors#414
zknpr merged 1 commit into
mainfrom
chore/ci-typecheck

Conversation

@zknpr
Copy link
Copy Markdown
Owner

@zknpr zknpr commented May 30, 2026

What

Adds the first PR-triggered CI (.github/workflows/ci.yml): build → tsc --noEmitnpm test on PRs to main and pushes to main. Previously the only workflow (release.yml) ran only on version tags, so type errors that tsx strips at runtime slipped in unnoticed.

To make the typecheck gate green, this also fixes the 30 pre-existing type errors:

  • Product: src/hostBridge.ts — the updateCellBatch SAVEPOINT fallback's 'updateCellBatch' in dbOps guard narrowed dbOps so the executeQuery calls failed to typecheck. Switched to a non-narrowing typeof … === 'function' check; runtime behavior unchanged.
  • Tests/benchmarks (27): type-only fixes — mock casts, optional params, valid ModificationType values. No assertion or logic changes.

Verification

  • npx tsc --noEmit -p tsconfig.json0 errors
  • npm test311 passing, 0 failing
  • This PR's own CI run exercises the new workflow end-to-end.

🤖 Generated with Claude Code

Summary by CodeRabbit

Chores

  • Added GitHub Actions CI workflow to automatically build, type-check, and run unit tests on push to main and pull requests.

Review Change Stack

The repo had no PR CI (release.yml runs only on version tags), so type
errors that tsx ignores at runtime slipped in. This adds
.github/workflows/ci.yml (node build + `tsc --noEmit -p tsconfig.json` +
npm test, on PRs to main and pushes to main) and fixes the 30 pre-existing
type errors so the typecheck gate is green:

- src/hostBridge.ts: the updateCellBatch SAVEPOINT fallback used
  `'updateCellBatch' in dbOps`, which narrowed dbOps so `executeQuery`
  failed to typecheck. Switched to a non-narrowing
  `typeof dbOps.updateCellBatch === 'function'` check (runtime behavior
  unchanged; DatabaseOperations declares executeQuery/updateCell/updateCellBatch).
- 27 test/benchmark type-only fixes (mock casts, optional params, valid
  ModificationType values) — no assertion or logic changes.

tsc --noEmit: 0 errors. npm test: 311 passing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 30, 2026

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

Project Deployment Actions Updated (UTC)
sq-lite-explorer Ready Ready Preview, Comment May 30, 2026 8:01pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

This pull request introduces CI workflow automation, tightens production type-checking in HostBridge, and applies TypeScript type casts across test suites to resolve compatibility issues. It also updates test data in the modification tracker to use cell_update instead of row_update.

Changes

TypeScript Type Safety and CI Automation

Layer / File(s) Summary
CI workflow automation
.github/workflows/ci.yml
Adds a GitHub Actions workflow that runs on PRs and pushes to main, setting up Node.js 22, installing dependencies, building via npm ci, type-checking with tsc, and executing unit tests with concurrency management.
HostBridge backend capability check
src/hostBridge.ts, tests/unit/hostBridge.test.ts
Changes HostBridge.updateCellBatch to use strict function-type guard (typeof dbOps.updateCellBatch === 'function') instead of property-existence check, and applies as any type casts in related unit test setup to override ensureDatabaseInitialized and capture mock arguments.
Test suite TypeScript type adjustments
tests/benchmarks/native_worker_ddl_batch.ts, tests/performance/index_drop_benchmark.ts, tests/performance/native_undo_redo_benchmark.ts, tests/unit/main.test.ts, tests/unit/sqlite-db.test.ts, tests/unit/tableExporter.test.ts, tests/unit/virtualFileSystem.test.ts, tests/unit/webviewMessageHandler.test.ts, tests/unit/workerFactory.test.ts
Applies as any type casts to mock assignments, mock function access, and variable type annotations across benchmarks and unit tests to resolve TypeScript type compatibility issues in database initialization, VS Code mock setup, mock call inspection, and message handler variable typing.
Modification tracker test data
tests/unit/modification_tracker_api.test.ts
Updates recorded modification types from row_update to cell_update in three test scenarios: clearing the future stack after undo, rolling back to checkpoint, and evicting oldest entries when exceeding max capacity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • zknpr/SQLite-Explorer#108: Updates batch update handling in the underlying updateCellBatch implementation, which directly relates to the stricter capability check added in this PR's HostBridge.updateCellBatch.

Poem

🐰 A workflow begins, tests take flight,
Type guards grow stronger, types made right,
as any whispers through the test suite,
Cell updates bloom where rows once grew,
CI watches, all builds stay true.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: adding a CI workflow and fixing type errors to enable TypeScript checking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/ci-typecheck

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread .github/workflows/ci.yml
Comment on lines +17 to +37
name: Build, typecheck & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Install dependencies
run: npm ci

- name: Build extension, worker & WASM
run: node scripts/build.mjs

- name: Typecheck (src + tests)
run: npx tsc --noEmit -p tsconfig.json

- name: Unit tests
run: npm test
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors type checks and introduces various type assertions (mostly casting to any) across test files and src/hostBridge.ts to resolve TypeScript compilation issues. While these changes fix compiler errors, the feedback highlights several opportunities to maintain strict type safety instead of resorting to any casts. Key recommendations include using the correct establishConnection API to prevent a runtime error in benchmarks, satisfying interfaces with default properties, and using specific VS Code types or TypeScript utility types for safer assertions.

async function runBenchmark() {
const bundle = await createNativeDatabaseConnection(vscode.Uri.file(process.cwd()));
const loadResult = await bundle.loadDatabase({ buffer: new Uint8Array() });
const loadResult = await (bundle as any).loadDatabase({ buffer: new Uint8Array() });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The createNativeDatabaseConnection function returns a connection bundle that uses establishConnection rather than loadDatabase. Calling loadDatabase here will result in a runtime TypeError because the method does not exist on the native worker bundle.

Instead of casting to any and calling loadDatabase, use establishConnection with an in-memory database URI to match the correct API.

Suggested change
const loadResult = await (bundle as any).loadDatabase({ buffer: new Uint8Array() });
const loadResult = await bundle.establishConnection(vscode.Uri.file(':memory:'), 'bench_db');

try {
const wasmBinary = fs.readFileSync(path.resolve(__dirname, '../../node_modules/sql.js/dist/sql-wasm.wasm'));
const engineResult = await createDatabaseEngine({ wasmBinary });
const engineResult = await createDatabaseEngine({ wasmBinary } as any);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of casting the configuration object to any, you can satisfy the DatabaseInitConfig interface by providing the required content and maxSize properties with safe default values. This preserves type safety and avoids bypassing compiler checks.

Suggested change
const engineResult = await createDatabaseEngine({ wasmBinary } as any);
const engineResult = await createDatabaseEngine({ wasmBinary, content: null, maxSize: 0 });

Comment on lines +51 to +54
await databaseOps.undoModification(mod as any);

// 2. Redo (Drops columns again)
await databaseOps.redoModification(mod);
await databaseOps.redoModification(mod as any);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The mod object is missing the required description property of the ModificationEntry interface, which is why the compiler complained.

Instead of casting mod as any, you can spread mod and supply a dummy description to make it a fully valid ModificationEntry in a type-safe manner.

Suggested change
await databaseOps.undoModification(mod as any);
// 2. Redo (Drops columns again)
await databaseOps.redoModification(mod);
await databaseOps.redoModification(mod as any);
await databaseOps.undoModification({ ...mod, description: 'Undo column drop' });
// 2. Redo (Drops columns again)
await databaseOps.redoModification({ ...mod, description: 'Redo column drop' });


assert.strictEqual(showSaveDialogMock.mock.callCount(), 1);
const args = showSaveDialogMock.mock.calls[0].arguments[0];
const args = showSaveDialogMock.mock.calls[0].arguments[0] as any;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of casting args to any, you can cast it to vscode.SaveDialogOptions which is the actual type expected by showSaveDialog. This preserves type safety and auto-completion.

Suggested change
const args = showSaveDialogMock.mock.calls[0].arguments[0] as any;
const args = showSaveDialogMock.mock.calls[0].arguments[0] as vscode.SaveDialogOptions;

Comment thread tests/unit/main.test.ts

assert.strictEqual(configUpdateMock.mock.calls.length, 1);
const callArgs = configUpdateMock.mock.calls[0].arguments;
const callArgs = configUpdateMock.mock.calls[0].arguments as any[];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of casting callArgs to any[], you can cast it to a more specific tuple type like [string, Record<string, any>] which matches the signature of workspace.getConfiguration().update. This keeps the test type-safe.

Suggested change
const callArgs = configUpdateMock.mock.calls[0].arguments as any[];
const callArgs = configUpdateMock.mock.calls[0].arguments as [string, Record<string, any>];

} as unknown as Database;

const engine = new WasmDatabaseEngine(mockDb, 5000);
const engine = new WasmDatabaseEngine(mockDb as any, 5000);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Instead of casting mockDb to any, you can dynamically extract the correct type of the first parameter of the WasmDatabaseEngine constructor using Parameters<typeof WasmDatabaseEngine>[0]. This avoids using any and maintains strict type safety.

Suggested change
const engine = new WasmDatabaseEngine(mockDb as any, 5000);
const engine = new WasmDatabaseEngine(mockDb as unknown as Parameters<typeof WasmDatabaseEngine>[0], 5000);

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 20: Replace the floating tag references to GitHub Actions with pinned
commit SHAs: locate the "uses: actions/checkout@v4" entry (and the other similar
"uses:" entry around line 22) and replace the `@v4` tag with the corresponding
full commit SHA for that action's v4 release; include a trailing comment noting
the human-readable version (e.g., v4) for future reference, and ensure both
occurrences are updated so the workflow pins to immutable commit hashes rather
than floating tags.
- Around line 1-14: The workflow "name: CI" currently relies on the default
GITHUB_TOKEN permissions; add an explicit top-level permissions block to grant
least privilege for the checkout operation (e.g., set GITHUB_TOKEN permissions
to at most contents: read) so the job only has repository read access; update
the YAML near the top-level (in the same document that contains "name: CI" and
"on:") to include the permissions mapping rather than using defaults.

In `@tests/unit/workerFactory.test.ts`:
- Around line 87-91: Replace the direct assignment and casts to readonly VS Code
API fields by defining properties via Object.defineProperty: instead of
assigning mockVscode.workspace.fs = { ... } as any, call
Object.defineProperty(mockVscode, 'workspace', { value: { fs: { readFile: async
() => new Uint8Array(), stat: async () => ({ size: 0 }) } }, writable: true,
configurable: true }) or define just the 'fs' property on mockVscode.workspace
similarly so that mockVscode.workspace.fs is writable/configurable; likewise
replace (mockVscode.Uri as any).joinPath = () => ({ scheme: 'file', fsPath:
'/test/path/assets/sqlite3.wasm' }) with Object.defineProperty(mockVscode.Uri,
'joinPath', { value: () => ({ scheme: 'file', fsPath:
'/test/path/assets/sqlite3.wasm' }), writable: true, configurable: true }) to
avoid using as any and follow readonly API testing conventions while keeping
functions names mockVscode.workspace.fs and mockVscode.Uri.joinPath as the
targets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0c7d09bd-75a6-48a0-b368-55b78c3ebea7

📥 Commits

Reviewing files that changed from the base of the PR and between c89b5a4 and ac96c77.

📒 Files selected for processing (13)
  • .github/workflows/ci.yml
  • src/hostBridge.ts
  • tests/benchmarks/native_worker_ddl_batch.ts
  • tests/performance/index_drop_benchmark.ts
  • tests/performance/native_undo_redo_benchmark.ts
  • tests/unit/hostBridge.test.ts
  • tests/unit/main.test.ts
  • tests/unit/modification_tracker_api.test.ts
  • tests/unit/sqlite-db.test.ts
  • tests/unit/tableExporter.test.ts
  • tests/unit/virtualFileSystem.test.ts
  • tests/unit/webviewMessageHandler.test.ts
  • tests/unit/workerFactory.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build, typecheck & test
🧰 Additional context used
📓 Path-based instructions (4)
tests/unit/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

tests/unit/*.test.ts: Use Object.defineProperty(obj, prop, { value, writable: true, configurable: true }) for setting readonly VS Code API fields like vscode.env.uiKind in unit tests
Import tests/unit/vscode_mock_setup.ts at the beginning of unit test files to ensure VS Code mocks are initialized before running tests

Files:

  • tests/unit/modification_tracker_api.test.ts
  • tests/unit/webviewMessageHandler.test.ts
  • tests/unit/virtualFileSystem.test.ts
  • tests/unit/sqlite-db.test.ts
  • tests/unit/hostBridge.test.ts
  • tests/unit/workerFactory.test.ts
  • tests/unit/tableExporter.test.ts
  • tests/unit/main.test.ts
src/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

src/**/*.ts: Use prepared statements with ? placeholders for all query parameter values to prevent SQL injection
Always use escapeIdentifier() function for table and column names in SQL queries to prevent identifier-based SQL injection
Use validateSqlType() for all user-provided SQL types in DDL statements to prevent type-based SQL injection
Validate PRAGMA string values with the regex /^[a-zA-Z0-9_-]+$/ whitelist and check numeric PRAGMA values with Number.isFinite()
Use escapeLikePattern() for user input in LIKE queries with the ESCAPE '\\' clause to prevent LIKE wildcard injection
Use zero-copy transfer for large binary data (ArrayBuffers) in RPC communication by wrapping with the Transfer wrapper
Use SAVEPOINT/RELEASE/ROLLBACK TO instead of BEGIN TRANSACTION in updateCellBatch to safely handle nested transactions
Use the safeRollback(context) helper when handling transaction errors to log failures instead of throwing, preventing secondary rollback errors
Check for SQLite json_patch() availability at engine construction time and use it in UPDATE statements when available, falling back to JS-side applyMergePatch() when unavailable
Use getNodeFs() from sqlite-db.ts to safely require the Node.js fs module, which returns undefined in browser environments
Check import.meta.env.VSCODE_BROWSER_EXT to conditionally handle environment-specific code paths for browser vs Node.js platforms
Use the Core RPC protocol defined in src/core/rpc.ts for all Worker communication and when the Extension invokes Webview methods
Use buildMethodProxy() from src/core/rpc.ts to create proxy objects that automatically serialize RPC calls to workers or the webview
Record database modifications in ModificationTracker via recordModification() before committing changes to track undo/redo history
Write all executed SQL (both read and write operations) to the 'SQLite Explorer' output channel via GlobalOutputChannel?.appendLine() for debugging...

Files:

  • src/hostBridge.ts
{src/**/*.ts,core/ui/modules/*.js}

📄 CodeRabbit inference engine (CLAUDE.md)

Serialize Uint8Array using the marker format { __type: 'Uint8Array', base64: '...' } with exactly 2 keys to prevent collisions with user data

Files:

  • src/hostBridge.ts
{src/hostBridge.ts,core/ui/modules/settings.js}

📄 CodeRabbit inference engine (CLAUDE.md)

Provide a UI to configure SQLite PRAGMAs via hostBridge.setPragma() to allow users to modify settings like WAL mode and Foreign Keys directly

Files:

  • src/hostBridge.ts
🪛 GitHub Check: CodeQL
.github/workflows/ci.yml

[warning] 17-37: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

🪛 zizmor (1.25.2)
.github/workflows/ci.yml

[warning] 20-20: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 1-38: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[error] 20-20: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🔇 Additional comments (11)
src/hostBridge.ts (1)

400-400: LGTM!

tests/unit/hostBridge.test.ts (1)

29-29: LGTM!

Also applies to: 138-138, 165-165

tests/unit/main.test.ts (1)

55-55: LGTM!

Also applies to: 173-173

tests/unit/sqlite-db.test.ts (1)

247-247: LGTM!

tests/unit/tableExporter.test.ts (1)

303-303: LGTM!

tests/unit/virtualFileSystem.test.ts (1)

241-241: LGTM!

Also applies to: 256-256

tests/unit/webviewMessageHandler.test.ts (1)

10-10: LGTM!

Also applies to: 48-48, 74-74

tests/benchmarks/native_worker_ddl_batch.ts (1)

8-8: LGTM!

tests/performance/index_drop_benchmark.ts (1)

37-37: LGTM!

tests/performance/native_undo_redo_benchmark.ts (1)

51-54: LGTM!

tests/unit/modification_tracker_api.test.ts (1)

38-38: LGTM!

Also applies to: 70-70, 100-100

Comment thread .github/workflows/ci.yml
Comment on lines +1 to +14
name: CI

# Runs on every PR to main and on pushes to main, so type errors and test
# failures are caught before merge (release.yml only runs on version tags).
on:
pull_request:
branches: [main]
push:
branches: [main]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit permissions block to follow least privilege.

The workflow inherits default GITHUB_TOKEN permissions, which are overly broad. This workflow only needs read access to check out the repository.

🔒 Proposed fix to add minimal permissions
 name: CI
 
+permissions:
+  contents: read
+
 # Runs on every PR to main and on pushes to main, so type errors and test
 # failures are caught before merge (release.yml only runs on version tags).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: CI
# Runs on every PR to main and on pushes to main, so type errors and test
# failures are caught before merge (release.yml only runs on version tags).
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
name: CI
permissions:
contents: read
# Runs on every PR to main and on pushes to main, so type errors and test
# failures are caught before merge (release.yml only runs on version tags).
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 1-38: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml around lines 1 - 14, The workflow "name: CI"
currently relies on the default GITHUB_TOKEN permissions; add an explicit
top-level permissions block to grant least privilege for the checkout operation
(e.g., set GITHUB_TOKEN permissions to at most contents: read) so the job only
has repository read access; update the YAML near the top-level (in the same
document that contains "name: CI" and "on:") to include the permissions mapping
rather than using defaults.

Comment thread .github/workflows/ci.yml
name: Build, typecheck & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Pin actions to commit hashes per security policy.

The workflow uses version tags (@v4) instead of commit hashes. Static analysis flags this as required by policy to prevent supply chain attacks if the action repositories are compromised.

🔒 Guidance for pinning to commit hashes

Replace version tags with full commit SHA hashes. For example:

-      - uses: actions/checkout@v4
+      - uses: actions/checkout@<commit-sha>  # v4.x.x
 
-      - uses: actions/setup-node@v4
+      - uses: actions/setup-node@<commit-sha>  # v4.x.x

Look up the latest commit hashes for the v4 releases of these actions in their respective repositories, and add a comment with the version number for future reference.

Also applies to: 22-22

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 20-20: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 20-20: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 20, Replace the floating tag references to
GitHub Actions with pinned commit SHAs: locate the "uses: actions/checkout@v4"
entry (and the other similar "uses:" entry around line 22) and replace the `@v4`
tag with the corresponding full commit SHA for that action's v4 release; include
a trailing comment noting the human-readable version (e.g., v4) for future
reference, and ensure both occurrences are updated so the workflow pins to
immutable commit hashes rather than floating tags.

Comment on lines 87 to +91
mockVscode.workspace.fs = {
readFile: async () => new Uint8Array(),
stat: async () => ({ size: 0 })
};
mockVscode.Uri.joinPath = () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' });
} as any;
(mockVscode.Uri as any).joinPath = () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider using Object.defineProperty for readonly VS Code API fields.

The coding guidelines recommend using Object.defineProperty(obj, prop, { value, writable: true, configurable: true }) for setting readonly VS Code API fields in unit tests, rather than as any casts. This provides better consistency and clarity when working with readonly properties like workspace.fs.

As per coding guidelines, "Use Object.defineProperty(obj, prop, { value, writable: true, configurable: true }) for setting readonly VS Code API fields like vscode.env.uiKind in unit tests".

♻️ Proposed refactor using Object.defineProperty
-    mockVscode.workspace.fs = {
-      readFile: async () => new Uint8Array(),
-      stat: async () => ({ size: 0 })
-    } as any;
-    (mockVscode.Uri as any).joinPath = () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' });
+    Object.defineProperty(mockVscode.workspace, 'fs', {
+      value: {
+        readFile: async () => new Uint8Array(),
+        stat: async () => ({ size: 0 })
+      },
+      writable: true,
+      configurable: true
+    });
+    Object.defineProperty(mockVscode.Uri, 'joinPath', {
+      value: () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' }),
+      writable: true,
+      configurable: true
+    });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
mockVscode.workspace.fs = {
readFile: async () => new Uint8Array(),
stat: async () => ({ size: 0 })
};
mockVscode.Uri.joinPath = () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' });
} as any;
(mockVscode.Uri as any).joinPath = () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' });
Object.defineProperty(mockVscode.workspace, 'fs', {
value: {
readFile: async () => new Uint8Array(),
stat: async () => ({ size: 0 })
},
writable: true,
configurable: true
});
Object.defineProperty(mockVscode.Uri, 'joinPath', {
value: () => ({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' }),
writable: true,
configurable: true
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/workerFactory.test.ts` around lines 87 - 91, Replace the direct
assignment and casts to readonly VS Code API fields by defining properties via
Object.defineProperty: instead of assigning mockVscode.workspace.fs = { ... } as
any, call Object.defineProperty(mockVscode, 'workspace', { value: { fs: {
readFile: async () => new Uint8Array(), stat: async () => ({ size: 0 }) } },
writable: true, configurable: true }) or define just the 'fs' property on
mockVscode.workspace similarly so that mockVscode.workspace.fs is
writable/configurable; likewise replace (mockVscode.Uri as any).joinPath = () =>
({ scheme: 'file', fsPath: '/test/path/assets/sqlite3.wasm' }) with
Object.defineProperty(mockVscode.Uri, 'joinPath', { value: () => ({ scheme:
'file', fsPath: '/test/path/assets/sqlite3.wasm' }), writable: true,
configurable: true }) to avoid using as any and follow readonly API testing
conventions while keeping functions names mockVscode.workspace.fs and
mockVscode.Uri.joinPath as the targets.

@zknpr zknpr merged commit ef114b7 into main May 30, 2026
7 checks passed
zknpr added a commit that referenced this pull request May 30, 2026
- ci.yml: pin actions/checkout & actions/setup-node to commit SHAs and add a
  least-privilege `permissions: contents: read` block (CodeRabbit / SEAL).
- workerFactory.test.ts: use Object.defineProperty for readonly VS Code mock
  fields instead of `as any` (the project's documented convention).
- native_worker_ddl_batch.ts: use the real `bundle.establishConnection(...)`
  API (the benchmark called a non-existent `loadDatabase` masked by `as any`).
- globals.css: fix the self-referential `@theme` font variables (via
  `--font-*-stack`) and move `:root`/`.dark` + base styles out of
  `@layer utilities` into the correct layers (Gemini).

Verified: extension build OK; `tsc --noEmit` 0 errors; `npm test` 311 pass;
website `next build` compiles.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants