Skip to content

fix(tooling): lock routine React Doctor and Knip execution - #30183

Merged
nwparker merged 1 commit into
mainfrom
nwparker/deps-locked-audit-tools
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/deps-locked-audit-tools

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​94 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​91
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2902 $\color{#cf222e}{\Huge{\mathbf{−}}}$​41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2861

ELI5

Running React Doctor or Knip currently downloads supporting packages that are outside our reviewed lockfile. The same commands now install and execute a separately locked copy of each tool.

What Changed

  • Add a private audit-tools workspace with the existing React Doctor 0.9.14 and Knip 5.88.1 versions, exact dependency resolutions and integrity hashes.
  • Route routine audits and the changed-line check through a frozen, script-free install, then invoke the local JavaScript entry points through Orca's process runner. Keep the existing audit options and changed-line filtering.
  • Run real-tool smoke checks in PR preflight: source analysis, changed-line filtering, failing findings, and stale-lock rejection. Tool-only manifest, lock and policy changes select that check.

Why

Pinning only the package passed to pnpm dlx leaves its supporting packages unresolved until execution. A separate workspace makes that entire tree reviewable without adding it to application installs or release bundles. It retains the three-day release delay, disables install scripts, and adds no dependency overrides.

Linked Issue

Maintainer-requested supply-chain follow-up; no separate issue.

Visual Proof

N/A — development tooling only; no application UI or interaction changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

On macOS, with background launch enabled:

  • Frozen root install and internal package build.
  • 99 focused unit tests across the runner, changed-line check, PR routing, preflight and aggregate gate.
  • Real React Doctor and Knip smoke checks, including rejecting a changed manifest with the original lockfile.
  • Actual root changed-line React Doctor invocation, changed-code quality gate, Oxlint, process-host import gate and formatting checks.

Linux CI runs the real-tool smoke in PR preflight. Windows execution uses the existing process-host shim handling and direct Node entry points; it was not executed locally. Application build/typecheck are unchanged and covered by the normal PR workflow.

Review

The runner checks the frozen install on every invocation; it does not fall back to fetching a different executable. Failed installs and tool failures remain nonzero. The application dependency graph and its lockfile are unchanged.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

The isolated dependency audit reports the existing Knip → fast-glob → micromatch → braces 3.0.3 advisory GHSA-vfj7-8cjw-p6xm. There is no published fixed version. This PR records that previously downloaded dependency rather than adding an override or changing the tool version.

No runtime, SSH, mobile or wire behavior changes.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The pull request adds a separate workspace with pinned React Doctor and Knip dependencies. A local runner installs the tools with a frozen lockfile and runs audit commands. Existing audit scripts and the changed-line React Doctor check now use that runner. A smoke script checks tool versions and behavior in a temporary Git fixture. Static-analysis preflight runs the smoke script.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 6ffa4

This change moves React Doctor and Knip audits onto a locked, script-free local install. One small gap remains: the new smoke check does not clear inherited Git repository variables. If those variables are set, its Git commands could act on the wrong repository. Normal CI does not set them. The change is mergeable, with that small fix as a follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (5 skipped: 5 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: locking React Doctor and Knip execution.
Description check Passed The description covers the required sections, explains the change and rationale, documents testing, and addresses compatibility and security considerations. The Linked Issue section notes that this is…
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.
Full details: Description check

Explanation

The description covers the required sections, explains the change and rationale, documents testing, and addresses compatibility and security considerations. The Linked Issue section notes that this is a maintainer-requested follow-up without a separate issue, which is consistent with the template's maintainer exception.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f9f66760-f3fd-4aae-8ad0-e6b317a8177c
📥 Commits

Reviewing files that changed from the base of the PR and between 68808db and 6ffa4e1.

⛔ Files ignored due to path filters: 1
  • config/audit-tools/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing: 11
  • .github/workflows/pr.yml
  • config/audit-tools/README.md
  • config/audit-tools/package.json
  • config/audit-tools/pnpm-workspace.yaml
  • config/scripts/check-react-doctor-changed.mjs
  • config/scripts/check-react-doctor-changed.test.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/run-audit-tool.mjs
  • config/scripts/run-audit-tool.test.mjs
  • config/scripts/verify-locked-audit-tools.mjs
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +16 to +17
function command(program, args, expectedCode = 0) {
const result = runProcessSync({ program, args, cwd: fixture, timeoutMs: 60_000 })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Isolate the fixture’s Git environment.

If a caller sets GIT_DIR or GIT_WORK_TREE, Git can use that repository instead of fixture despite cwd: fixture. The smoke can then fail or run its configuration and index commands against the wrong repository. Remove Git repository-location variables from the environment passed to Git commands.

Based on learnings, Git subprocesses targeting a specific cwd must strip repository-location variables, including GIT_DIR, GIT_WORK_TREE, and GIT_INDEX_FILE.

Source: Learnings

@nwparker
nwparker merged commit a42049f into main Oct 18, 2026
45 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