Skip to content

CU-1: regression test, Cursor write from a HOME holding .chock is judged in the workspace - #257

Merged
jothimani-rajendran merged 1 commit into
mainfrom
cu-1-home-chock-regression
Oct 11, 2026
Merged

jothimani-rajendran merged 1 commit into
mainfrom
cu-1-home-chock-regression

Conversation

@jothimani-rajendran

Copy link
Copy Markdown
Collaborator

What

CU-1 root cause. On the owner's Windows machine, the installed chock-witness Cursor plugin was built by an engine older than 9914aa7 ("fix(gate): take Cursor's repository root from workspace_roots", 2026-10-07). The owner's diagnostic shows that build has no workspace_root. Cursor sends preToolUse without cwd, so that build's repo_root_for fell back to the hook process's cwd. When the hook ran from C:\Users\jothi, the write became witness-repo-cursor/.github/workflows/witness.yml, which is outside .github/workflows/*, so it was allowed. Main has had the fix since 9914aa7.

This PR adds the regression test for that exact layout, so it can't come back:

  • HOME holds .chock/, and the repo sits beside it, with HEAD unborn or committed;
  • the hook runs from HOME;
  • the payload has no cwd, only workspace_roots (spelled /C:/… on Windows);
  • an unpinned write must be denied, and clean content allowed.

It also adds CPython 3.14.3, the interpreter the owner's hooks launch, to the windows-paths matrix.

Fails before, passes after (measured locally, Linux)

  • The engine at 9914aa7^ (pytest -o pythonpath="<9914aa7^ src> tools" … -k home_with_chock): AssertionError: assert 'allow' == 'deny', 2 failed.
  • Main (a2dd3de): 2 passed.
  • The Windows result is in this PR's windows-paths job.

Definition of done

  • ruff check and ruff format clean on the touched test file
  • actionlint clean; matrix change only; no new permissions or actions
  • CI green, including windows-paths on 3.12.0 / 3.12 / 3.13 / 3.14.3 / 3.14
  • Changelog fragment: none (test and CI only; the fix itself shipped in 9914aa7 with changelog.d/cursor-windows-workspace-root.md)

🤖 Generated with Claude Code


Generated by Claude Code

…workspace

Regression test for the CU-1 witness: the hook runs from HOME, which holds
.chock/, the repo sits beside it with HEAD unborn or committed, and the
payload has no cwd, only workspace_roots. Fails on the engine before
9914aa7 (allow), passes on main (deny). Adds CPython 3.14.3, the owner's
hook interpreter, to the Windows path matrix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jothi Mani Rajendran <250249270+jothimani-rajendran@users.noreply.github.com>
@jothimani-rajendran
jothimani-rajendran marked this pull request as ready for review October 11, 2026 18:52
@jothimani-rajendran
jothimani-rajendran merged commit 3f5af7e into main Oct 11, 2026
24 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