Skip to content

chore: address PR #414/#415 review feedback#417

Merged
zknpr merged 1 commit into
mainfrom
chore/review-fixes
May 30, 2026
Merged

chore: address PR #414/#415 review feedback#417
zknpr merged 1 commit into
mainfrom
chore/review-fixes

Conversation

@zknpr
Copy link
Copy Markdown
Owner

@zknpr zknpr commented May 30, 2026

Applies the valid findings from the CodeRabbit/Gemini reviews on #414 and #415 (implemented via Codex, verified locally).

#414 (CI / tests):

  • ci.yml: pin actions/checkout & actions/setup-node to commit SHAs + add least-privilege permissions: contents: read (supply-chain hardening)
  • workerFactory.test.ts: Object.defineProperty for readonly VS Code mock fields instead of as any (project convention)
  • native_worker_ddl_batch.ts: use the real bundle.establishConnection(...) API instead of a non-existent loadDatabase hidden by as any

#415 (Tailwind v4):

  • globals.css: fix self-referential @theme font vars (via --font-*-stack); move :root/.dark + base styles out of @layer utilities into the correct layers

Verified: extension build OK · tsc --noEmit 0 errors · npm test 311 pass · website next build compiles. (Skipped the cosmetic bg-(--ui-bg)bg-background suggestion — works as-is, large churn.)

🤖 Generated with Claude Code

- 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>
@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:37pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@zknpr, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 23 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1cdcb31c-3de8-4990-ac3b-d9432b52cd3e

📥 Commits

Reviewing files that changed from the base of the PR and between 04e8e34 and 2854aec.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • tests/benchmarks/native_worker_ddl_batch.ts
  • tests/unit/workerFactory.test.ts
  • website/app/globals.css
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/review-fixes

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.

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 updates the native worker DDL batch benchmark to use a unique local SQLite database file and ensures cleanup in a finally block. It also refactors how VS Code mocks are reset in unit tests using Object.defineProperty, and reorganizes global CSS variables and utilities in the website styling. Feedback on the changes highlights a potential race condition when deleting the database file before the worker process fully releases its lock, and warns about test pollution due to modifying shared VS Code mock singletons without restoring them in afterEach.

Comment on lines +62 to +65
} finally {
bundle.workerMethods[Symbol.dispose]();
await fs.rm(databasePath, { force: 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.

medium

There is a potential race condition when deleting the database file immediately after calling bundle.workerMethods[Symbol.dispose]().

The Symbol.dispose call triggers worker.stop(), which asynchronously kills the child process (this.process.kill()). Since process termination and file descriptor release by the OS are asynchronous, fs.rm might execute while the file is still locked by the terminating process (especially on Windows). This can cause the benchmark to fail with EBUSY or EPERM errors.

To make this robust, we can implement a simple retry loop with a small delay to ensure the file is successfully deleted once the lock is released.

    } finally {
        bundle.workerMethods[Symbol.dispose]();
        // Allow the worker process some time to release the file lock (especially on Windows)
        for (let i = 0; i < 5; i++) {
            try {
                await fs.rm(databasePath, { force: true });
                break;
            } catch (err) {
                if (i === 4) throw err;
                await new Promise(resolve => setTimeout(resolve, 100));
            }
        }
    }

Comment on lines +87 to +99
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
});
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

Modifying shared mock objects like mockVscode.workspace and mockVscode.Uri in beforeEach without restoring them in afterEach can lead to test pollution, causing other tests in the suite to fail or behave unpredictably.

Since mockVscode is imported from a shared mock module (./mocks/vscode), it is a singleton cached by Node's module system. Any mutations to it will persist across test files.

To prevent this, we should capture the original properties before modifying them and restore them in afterEach. Since afterEach is not in the diff, you can implement this by storing the original values and restoring them. For example:

  let originalFs: any;
  let originalJoinPath: any;

  beforeEach(() => {
    connectionFailed = false;
    workerTerminated = false;

    originalFs = mockVscode.workspace.fs;
    originalJoinPath = mockVscode.Uri.joinPath;

    // Reset VSCode mock behaviors
    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
    });
  });

  afterEach(() => {
    // Restore original mock behaviors
    if (originalFs) {
      Object.defineProperty(mockVscode.workspace, 'fs', {
        value: originalFs,
        writable: true,
        configurable: true
      });
    }
    if (originalJoinPath) {
      Object.defineProperty(mockVscode.Uri, 'joinPath', {
        value: originalJoinPath,
        writable: true,
        configurable: true
      });
    }
    // Restore the original require implementation to avoid leaking to other tests
    Module.prototype.require = originalRequire;
  });

@zknpr zknpr merged commit 0901f9c into main May 30, 2026
7 checks passed
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.

1 participant