Repository navigation
test(lint): ban process.cwd() / Path.cwd() outside canonical resolvers (closes #863) - #1173
Closed
bassilkhilo-ag2 wants to merge 1 commit into
Closed
bassilkhilo-ag2 wants to merge 1 commit into
bassilkhilo-ag2 wants to merge 1 commit into
Conversation
closes sonichi#863) 12 structural tests that fail-build when any src/*.py uses Path.cwd() / os.getcwd() outside workspace_default.py + util_paths.py, or any src/*.ts uses process.cwd() outside workspace_default.ts + util_paths.ts. Prevents re-introducing the workspace-vs-repo bug class that the 2026-05-18 audit (PRs sonichi#815-sonichi#859) closed across ~28 sites. Comment lines are stripped before checking so the existing "# old code used process.cwd()" annotations in inline-tools.ts / browser-tools.ts / cartesia-tts.ts don't false-positive. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
VasiliyRad
approved these changes
May 26, 2026
VasiliyRad
left a comment
Contributor
There was a problem hiding this comment.
12/12 passing, rule is well-scoped (src/.py and src/.ts only, correct allowlists), comment stripping works. Single-file PR with no unrelated changes. One minor gap: block comments (/* */) in TypeScript aren't stripped, but that's an unlikely false-positive path in practice. Clean.
VasiliyRad
approved these changes
May 26, 2026
VasiliyRad
left a comment
Contributor
There was a problem hiding this comment.
12/12 passing, rule is well-scoped (src/.py and src/.ts only, correct allowlists), comment stripping works. Single-file PR with no unrelated changes. One minor gap: block comments (/* */) in TypeScript aren't stripped, but that's an unlikely false-positive path in practice. Clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/*.pyusesPath.cwd()/os.getcwd()outsideworkspace_default.py+util_paths.py, or anysrc/*.tsusesprocess.cwd()outsideworkspace_default.ts+util_paths.ts// Old code used process.cwd() hereannotation lines ininline-tools.ts,browser-tools.ts,cartesia-tts.tsdon't false-positiveHow the test works
Any new
src/file that writes workspace data viaprocess.cwd()orPath.cwd()directly — instead of routing throughresolveWorkspace()/resolve_workspace()— will fail CI immediately.Test plan
python3 tests/cwd-lint.test.py— 12/12 passingsrc/(confirms the 2026-05-18 audit is still clean)