Repository navigation
fix: preserve private hook checks and diagnostics - #132403
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Land-ready proofThe maintainer explicitly approved the narrow Vitest dependency repair needed to resolve the earlier CI blocker. Reviewed source is now 7afd43b14d3e2d9758bc5eb08ac964280418bc94, after one conflict-free rebase required for native wrapper trust. Both focused commits remain, followed by the small CI fixture-reference repair. Hook/runtime bytes are unchanged from the reviewed candidates; in that rebase, the only range-diff change was lockfile importer ordering already present on main. The four hook repairs preserve BOM-prefixed path identity, suppress incomplete formatter captures, drain complete diagnostics in order, and normalize pathspec modes without losing the selected Git index/context. The approved exact-version Vitest patch makes built-in fork transports declare self-exit and joins actual exit before computing results, within the existing 60-second stop deadline. Custom transports that omit the declaration retain parent-owned termination; the existing 500 ms forced escalation is unchanged. Before/after evidence: 15 hook regressions failed before repair and all 68 hook tests passed afterward. Three native profile cases failed against upstream Vitest. Source review caught a custom-entrypoint compatibility regression in the first patch; that real custom case passed upstream, failed the first candidate, and passed after moving the self-exit declaration to the responding transport. The final clean Linux Node 24.19.0 run passed 12 shutdown cases plus 105 siblings, including the original 16-case cleanup matrix in order. Independent hook replay passed 116 fixtures and 214 actual Git commits with unchanged assertions. Fresh Codex P0–P2 source review found no actionable findings after the correction; review did not execute tests. An additional independent dependency replay did not complete because the review service blocked it after install preparation. It is not counted as a pass, was not retried, and its owned container was removed. The executed Linux tests, separate source review, and exact-head hosted CI are the accepted proof. The historical failed CI log cannot identify which demonstrated shutdown mechanism caused that incident. After the necessary rebase, the actual local integration command below passed 440 tests across eight files: node scripts/run-vitest.mjs test/scripts/vitest-fork-shutdown.test.ts test/scripts/run-vitest-state-cleanup.test.ts test/git-hooks-pre-commit.test.ts test/git-hooks-pre-commit-boundaries.test.ts test/scripts/run-vitest-profile.test.ts test/scripts/vitest-runner-task-updates.test.ts test/scripts/check-package-patches.test.ts test/scripts/test-projects.test.tsRun 33267247220 then caught an undeclared static fixture dependency in Knip. The test now uses the adjacent regression's module-URL reference pattern; both real unused-file scans passed with zero entries, all 12 shutdown cases passed again, and the changed-file gate passed. Separate fresh P0–P2 source review found no actionable finding in that two-line repair. No ignore list, baseline, fixture, or assertion changed. node --import ./scripts/tsx.mjs scripts/check-deadcode-unused-files.mts
node scripts/run-vitest.mjs test/scripts/vitest-fork-shutdown.test.ts
node scripts/check-changed.mjs -- test/scripts/vitest-fork-shutdown.test.tsExact-head hosted CI is complete and green: run 33267691622, attempt 1 for Hook tooling is net +32 lines, with +4 routing lines and +255 tests/shared-fixture lines. The Vitest patch's semantic delta is +44/-17 (net +27, including five declaration lines); patch headers and unchanged anchors are excluded. Its additional routing/policy is +10, isolated ownership +1, tests/support +428, with exact patch registration, generated lock metadata and four documentation lines. These lines express the path/output and shutdown ownership contracts; no timeout increase, pool override, artifact retry, weakened assertion, new product setting or application-runtime change was added. The temporary patch has a documented upstream-removal condition. ClawSweeper's fresh review found no introduced P0–P2 defect. Its rank-up requests were direct installed-dependency inspection and green exact-head CI. I personally inspected Vitest 4.1.11's Native review artifacts are validated. The merge must use |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 2:10 PM ET / 18:10 UTC. ClawSweeper reviewWhat this changesThe PR hardens the opt-in local pre-commit content guard and adds a temporary Vitest patch so forked test workers can finish shutdown cleanup before Vitest reports the run result. Merge readinessNo introduced P0–P2 correctness defect was found, but this maintainer-labeled PR should remain open until exact-head CI completes and the temporary Vitest patch is independently checked against its installed dependency source. Priority: P2 Review scores
Verification
How this fits togetherThe local Git hook scans staged files for privately configured literals before and after formatting. Vitest runs OpenClaw test projects and must wait for forked workers to finish cleanup before test results and native profiles are finalized. flowchart LR
A[Staged files] --> B[Content guard]
B --> C[Formatter and restaging]
C --> D[Final staged scan]
E[Test project] --> F[Vitest fork worker]
F --> G[Shutdown and profile cleanup]
G --> H[Test result reporting]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +684, Docs +4, Config +1, Other +154. Total +843 across 16 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Verify the patch against the installed Vitest 4.1.11 source/types and complete green exact-head CI, then retain the focused regressions until an upstream Vitest release removes the temporary patch. Do we have a high-confidence way to reproduce the issue? Yes for the hook defects: current source and the new real-Git integration cases define concrete failing paths. The Vitest path is source-reproducible, but this read-only checkout lacks the installed dependency required to independently replay it. Is this the best way to solve the issue? Unclear for the dependency portion: the local-hook repair is at its owner boundary, but direct inspection of Vitest 4.1.11 source/types is still needed before calling the package patch the best solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8e4eb78fa20b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
9f27e95 to
1c0789c
Compare
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin, a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
|
@clawsweeper re-review The maintainer-approved Vitest shutdown repair is now included at |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* fix: preserve private hook checks and diagnostics * fix(test): join graceful Vitest fork shutdown * test: expose Vitest shutdown fixture dependency
Additional instructions
This is a maintainer-owned branch; repository maintainers can update it. The maintainer explicitly approved the narrowly scoped Vitest dependency patch described below to repair the CI blocker discovered while validating this change.
Follow-up to the private-rule commit guard.
What Problem This Solves
Fixes four independently reproduced boundary defects in the local commit guard: a valid filename beginning with U+FEFF can make the scanner inspect a different path; an incomplete formatter capture can expose a private-value fragment; failed piped output can lose its actionable tail and final failure line; and supported Git glob/icase modes can cause configured clean commits to fail.
The first exact-head CI run also exposed missing CPU-profile output in the existing forked test-runner cleanup test. Investigation reproduced two Vitest shutdown defects: forced termination can interrupt exit cleanup/profile writes, and the first SIGTERM can race natural shutdown after Node retires its JavaScript signal handler. The historical CI log does not identify which mechanism occurred in that run; the new deterministic regressions prove both repaired mechanisms independently.
Why This Change Was Made
Repair the owning hook boundaries rather than add exceptions: preserve Git path data separately from UTF-8 rule-file decoding, isolate internal literal-path operations while retaining the effective Git index/context, reject incomplete formatter captures before replay, and let complete diagnostics drain before a nonzero exit. The approved private-file setting and overlap redaction remain unchanged.
The approved temporary
[email protected]patch repairs worker completion at the dependency owner. Built-in fork transports declarewillExitwhen sending their stopped response and exit explicitly after delivery. The parent joins actual exit within the existing 60-second stop deadline, before computing the run result. Custom entrypoints that do not declare self-exit retain their existing parent-owned stop protocol; explicit custom opt-in and vmForks are covered. Timeout and abnormal-exit paths still fail visibly and terminate/join the worker. The existing 500 ms forced escalation is unchanged.No OpenClaw setup refactor, new user configuration, dependency version bump, capture-limit increase, timeout increase, forced thread pool, or artifact retry is included. The patch is generated/registered through pnpm, with an exact-version policy exception and a documented removal condition. Its zero-context insertion hunks use unchanged-line replacement anchors; standard Git and the installed pnpm result were verified byte-identical to the reviewed package. The existing
@vitest/runnerpatch remains unchanged.User Impact
Configured commits correctly inspect BOM-prefixed paths, including content introduced through formatting/restaging, and work with supported Git pathspec modes. Incomplete captures are withheld rather than partially echoed; complete formatter failures retain useful diagnostics and exit status, including when the optional content guard is unconfigured.
The safeguard remains local and opt-in. No private rules are checked in and no tracked file is exempt. Unchanged history, symlink targets, submodule contents, and explicit hook bypass remain outside its scope.
For development tooling, completed forked profiling runs retain their native CPU/heap artifacts, and teardown failures cannot be reported as successful test runs. OpenClaw's application runtime is unchanged.
Evidence
Landing integration: a necessary, conflict-free native-wrapper trust rebase preserved the reviewed hook and Vitest runtime bytes. The rebased focused run passed 440 tests across eight files. CI then identified the shutdown fixture as unused because its process-spawn reference was not visible to Knip; the test now uses the same static module-URL reference as the adjacent Vitest runner regression. Both Knip unused-file scans passed with zero entries, all 12 shutdown cases passed again, the changed-file gate passed, and a fresh P0–P2 Codex review found no actionable issue in this two-line repair. No fixture, dependency behavior, assertion, ignore list, or baseline changed.
Focused behavior commands:
The hook repair adds net +32 hook-tooling lines, +4 test-routing lines, and net +255 tests/shared-fixture lines. The additional dependency patch's semantic delta is +44/-17 (net +27), including five declaration lines; patch headers and unchanged replacement anchors are not counted as production code. It adds 10 tooling routing/policy lines, one explicit tooling-test ownership entry, and 428 regression/test-support lines, plus exact registration, generated lock metadata, and four README lines. Growth supplies distinct ownership and completion contracts, not new options or duplicate implementations.
The formatter's
check-ignorecall retains its required native literal-mode exception and./prefix. Existing index context, overlap redaction, forced-stop budgets, and private-file scope are preserved. Linux proof used arm64 Node 24.19.0, not the original x64 hosted runner's load state; Windows runtime proof is left to hosted CI. Fresh exact-head CI must be green before native preparation and merge. The initial failed run and investigation remain documented in the PR discussion; no gate is bypassed.AI-assisted implementation and review.