Skip to content

fix(hooks): read paths literally in every jev-lint child process - #173

Merged
furedea merged 2 commits into
mainfrom
fix/159-literal-pathspecs
Nov 12, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/159-literal-pathspecs

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

概要

モデル判定の子プロセス(op と jev-lint)の環境に GIT_LITERAL_PATHSPECS=1 を固定値として足します.

背景と確認結果

Issue #159 の最初の受け入れ条件を,インストール済みの jev-lint 0.7.0 のソースで確かめました(詳細は Issue のコメント).

  • review の位置引数は,changedFilesUnder(diff.js)で変更ファイル一覧との文字列比較にだけ使われ,git には渡りません.
  • git へ渡る引数は diff と ls-files の固定の形だけで,利用者のパスを含みません.

そのため,今の版では select が検査したファイルと違うファイルが読まれる経路はありません.将来の版が pathspec を使い始めても,記号を含むファイル名が検査と違う範囲に広がらないよう,環境変数を固定値として足しました(ENVIRONMENT_ALLOWLIST の方針と同じく,呼び出し側の値は引き継ぎません).

変更

  • model_rules_run.py:FIXED_ENVIRONMENT を足し,_environment で全ての子プロセスに渡す.
  • テスト:呼び出し側が GIT_LITERAL_PATHSPECS=0 を持っていても,全ての jev-lint 実行で 1 になることを確かめる.環境変数の許可リストのテストには,固定値の名前を足した.

検証

  • uv run pytest tests/hooks:3718 passed,1 skipped(テストは先に書き,修正前に失敗することを確認)

Closes #159

🤖 Generated with Claude Code

jev-lint 0.7.0 does not pass positional paths to git as pathspecs, so
select and the files git reads cannot diverge today. Fix
GIT_LITERAL_PATHSPECS=1 in the child environment so a later jev-lint
version cannot start interpreting :(glob) or * in a file name.

Closes #159

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T19:13:07.451076Z d7d36a7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Review summary

No findings.

  • _environment now adds FIXED_ENVIRONMENT after the allowlisted variables, so a caller's GIT_LITERAL_PATHSPECS can't override it. It sits before PATH and extra, which don't overlap with it. Every child process gets it, including the op call that also receives the token.
  • The new test sets GIT_LITERAL_PATHSPECS=0 in the caller and checks that every jev-lint run sees 1. The allowlist test was updated to accept the fixed name. Together they cover the changed behavior.
  • One thing to keep in mind, not a blocker: GIT_LITERAL_PATHSPECS=1 also turns off glob and magic pathspecs (such as *.py and :(exclude)) in any fixed git arguments a future jev-lint release adds. That would make them match nothing without any error. This doesn't affect jev-lint 0.7.0, going by the source analysis in fix(hooks): model-rule file selection checks paths as files but jev-lint may read them as pathspecs #159. I couldn't check the installed jev-lint source in this review environment.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdd8e179c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agents/hooks/lib/model_rules_run.py Resolved
@furedea

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary: I found no blocking issues. FIXED_ENVIRONMENT is merged after the allowlist and before extra, so a caller's GIT_LITERAL_PATHSPECS can't override it. The only places that use _environment are the op/jev-lint children (the hook's own git call in model_rules_files.py gets its environment elsewhere, so this change doesn't touch it). The new test checks the override for every jev-lint run, and the allowlist test now includes the fixed name. One thing to keep in mind: if a future jev-lint uses magic pathspecs internally (for example :(exclude) or globs), this variable will turn them into literal paths. Re-check that when you upgrade jev-lint. No inline findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: d7d36a748e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@furedea
furedea merged commit 0d2c683 into main Nov 12, 2026
25 checks passed
@furedea
furedea deleted the fix/159-literal-pathspecs branch November 12, 2026 03:27
furedea pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.2](v0.1.1...v0.1.2)
(2026-11-12)


### Features

* **hooks:** add Go and Rust model rules with eval fixtures
([#158](#158))
([9731488](9731488))
* **hooks:** show model-rule timing and skip rule fixtures
([#157](#157))
([d0c32ae](d0c32ae))
* **hooks:** show the model rules as one result line with cost
([#170](#170))
([41b9033](41b9033))


### Bug Fixes

* **hooks:** allow a jq filter after read-only GraphQL queries
([#180](#180))
([cfb80d8](cfb80d8))
* **hooks:** keep model-rule eval fixtures out of Stop test verification
([#160](#160))
([a4f1c6c](a4f1c6c))
* **hooks:** read paths literally in every jev-lint child process
([#173](#173))
([0d2c683](0d2c683))
* **hooks:** remove model-rule false positives with principles and eval
fixtures ([#163](#163))
([b07fc4e](b07fc4e))
* **hooks:** report one count per runner in the Stop test lines
([#177](#177))
([0f36b82](0f36b82))
* **hooks:** take the model-rule cached count from the dry-run plan
([#167](#167))
([c87fdfd](c87fdfd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
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.

fix(hooks): model-rule file selection checks paths as files but jev-lint may read them as pathspecs

1 participant