Conversation
- Add scripts/precommit-tests.mjs (test:staged): vitest related on staged files only, co-located sibling tests, project filtering, narrow force-full for vitest infra/deps (drop blanket src/shared|preload full suite). - Path-gate flatpak/DB/IPC/reticulum catalog/sidecar checks and pnpm audit; run ESLint on staged JS/TS with --cache; keep full typecheck. - Document that PR CI (tests.yaml) still runs the full suite with coverage.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pre-commit hook now centralizes staged-file matching, runs staged ESLint and staged Vitest planning, and gates checks by changed paths. Release validation adds environment and policy scanners, requires workflow linters, and enforces the full Vitest suite. Documentation and tests describe and verify both flows. ChangesStaged pre-commit validation
Release validation gates
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant Developer
participant PreCommit as pre-commit hook
participant ESLint
participant Vitest as precommit-tests.mjs
Developer->>PreCommit: Create commit with staged files
PreCommit->>ESLint: Check staged JS/TS files
PreCommit->>Vitest: Pass staged file list
Vitest->>Vitest: Plan skip, related, or full execution
Vitest-->>PreCommit: Return test status
PreCommit-->>Developer: Accept or reject commit
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
- Always run full Vitest via `pnpm run test:run` (never staged/related/changed). - Add scanners that pre-commit may path-gate (electron-security, i18n, XSS, etc.). - Require actionlint and yamllint instead of soft-skipping when missing. - Contract-test release.sh and document the release vs pre-commit gate.
There was a problem hiding this comment.
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 @.githooks/pre-commit:
- Around line 101-103: Update the ESLint batching command in the pre-commit hook
to preserve staged filenames containing spaces, quotes, and backslashes, and
prevent option-like filenames from being parsed as flags; use a null-delimited
or otherwise filename-safe input mechanism while retaining batching and the
existing ESLint failure handling. Add regression coverage for a staged pathname
containing spaces, ensuring the behavior works across Linux, macOS, and Windows.
In `@docs/ci-cd.md`:
- Line 237: Update the CI/CD checks bullet to state that the path-gated sidecar
stub check requires cargo to be available on PATH when sidecar paths are staged,
while preserving the existing check and locale conditions.
In `@scripts/precommit-tests.mjs`:
- Around line 187-194: Update runVitestArgv and its runRelatedTests call path to
avoid shell interpretation when passing staged filenames, using a shell-free
Vitest launcher while preserving argument boundaries on Windows. Add
Windows-focused coverage for staged paths containing spaces and command
metacharacters such as &, |, and %, verifying they are passed as literal
arguments.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 85c98a88-8256-4402-b26c-cd4d794940e5
📒 Files selected for processing (8)
.githooks/pre-commit.gitignoreAGENTS.mddocs/ci-cd.mddocs/development-environment.mdpackage.jsonscripts/precommit-tests.mjsscripts/precommit-tests.test.mjs
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@scripts/release.test.mjs`:
- Around line 12-33: Update the REQUIRED_PNPM_CHECKS array to include the
existing check:environment script, ensuring the release contract requires it
alongside the other check:* scanners and prevents release.sh from omitting it.
- Around line 44-46: Update the test identified by the “runs pnpm run test:run
for the full Vitest suite” case to assert the executable invocation in
scripts/release.sh rather than matching arbitrary comment or echo text. Anchor
the regex to the command’s execution context so removing the actual pnpm run
test:run call causes the test to fail.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 95738494-354b-4bb3-876e-979cbd3ca4fb
📒 Files selected for processing (6)
AGENTS.mddocs/ci-cd.mddocs/development-environment.mddocs/release-process.mdscripts/release.shscripts/release.test.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
- AGENTS.md
- Batch staged ESLint with safe argv/`--` instead of xargs (spaces/option-like paths). - Spawn Vitest via `node vitest.mjs` with `shell: false` so Windows metacharacters stay literal. - Require `check:environment` in release pre-flight; tighten release.test invocation match. - Document cargo PATH prerequisite for path-gated sidecar stub checks.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@scripts/pre-commit.eslint-batch.test.mjs`:
- Around line 13-16: Strengthen the test around the hook’s ESLint invocations so
every invocation uses the safe `-- "$@"` argument boundary and no xargs-based
batching remains, regardless of spacing or options. Update the assertions in the
`it('batches eslint with -- so spaced/option-like paths stay literal', ...)`
test to inspect all matching invocations rather than accepting a single safe
match.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b784e00f-6635-4415-940a-46107db3eb8d
📒 Files selected for processing (8)
.githooks/pre-commitdocs/ci-cd.mddocs/release-process.mdscripts/pre-commit.eslint-batch.test.mjsscripts/precommit-tests.mjsscripts/precommit-tests.test.mjsscripts/release.shscripts/release.test.mjs
🚧 Files skipped from review as they are similar to previous changes (6)
- scripts/release.test.mjs
- scripts/precommit-tests.test.mjs
- scripts/release.sh
- .githooks/pre-commit
- docs/ci-cd.md
- docs/release-process.md
Require all `pnpm exec eslint` lines to end with `-- "$@"` and reject any xargs-based eslint batching, so a second unsafe invocation cannot slip through.
|



Summary
scripts/precommit-tests.mjs(pnpm run test:staged), including co-located sibling tests and project scoping.check:*scripts (flatpak, DB migrations, IPC, Reticulum modes/hubs/sidecar) and run ESLint only on staged JS/TS with cache; keep full typecheck and security scanners always on.tests.yamlstill runs the full suite with coverage.Test plan
src/mainsource change and confirm related Vitest runs (main project) instead of the full suitepackage.jsonorpnpm-lock.yamland confirm pre-commit forces a full Vitest runpnpm exec vitest run scripts/precommit-tests.test.mjsand confirm planner unit tests passtests.yamlstill runs the full suite on the PRSummary by CodeRabbit
test:stagedto run Vitest for staged changes with an optimized skip/full/related strategy..eslintcacheto Git ignore.