Repository navigation
docs(hooks): document session modules and privatize internal helpers - #131
Merged
Merged
Conversation
Prepare session_store, session_gate, herdr_ownership and provider_adapter for ruff D (google) and N. Names used only inside their own module become private; the rest get docstrings that state the contract. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no findings (P0: 0, P1: 0, P2: 0, P3: 0) This PR renames module-local helpers to private names and adds docstrings across 4 files under What I checked:
No new tests are needed, since nothing changes at runtime. 🤖 Generated with Claude Code |
furedea
approved these changes
Nov 10, 2026
furedea
added a commit
that referenced
this pull request
Nov 10, 2026
## 概要 ruff の D (pydocstyle, google),DOC,N (pep8-naming) を有効化する最終 PR (#74 stage 1B の持ち越し分).設定は template-python / dotfiles と同じ形にした.先行 lane (#130, #131, #132, #133) の修正は既にマージ済みで,この PR は残りの違反を直したうえで設定を有効化する. `ruff check .` は有効化後の設定で 0 件.ブランチは 1 コミットで,lefthook の全フックを除外なしで通過している. Refs #74 ## 設定 (pyproject.toml) - `select` に `D`,`DOC`,`N` を `W` と `F` の間に追加 (template-python / dotfiles と同じ並び).`DOC` による新規指摘は 0 件を確認済み - `ignore` に `D104`,`D105`,`D107` を追加 - `per-file-ignores` の `tests/**` に `D` を追加 - `[tool.ruff.lint.pydocstyle] convention = "google"` を追加 既存の ignore は削除していない. ## この PR での修正 ### 改名 (N818) ドメイン概念はそのまま,`Error` 接尾辞のみ追加し,agents と tests の全使用箇所を更新した. - `UnexpandableGlob` → `UnexpandableGlobError` - `UnsupportedSyntax` → `UnsupportedSyntaxError` - `UnplacedCommit` → `UnplacedCommitError` - `UnknownTestCommand` → `UnknownTestCommandError` ### 非公開化 (外部から使われないことを `git grep` で agents/ scripts/ tests/ に対して確認) | ファイル | 件数 | 名前 | | ---------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `guard_file.py` | 10 | `_policy_path`, `_load_policy`, `_protected_reason`, `_validate_filename_rule`, `_commit_reason`, `_content_match`, `_scan_content`, `_judged_commit`, `_context`, `_session` | | `shell_paths.py` | 1 | `_brace_words` | ### docstring を書いた公開 API | ファイル | 件数 | 名前 | 理由 | | ---------------- | ---- | ----------------------------------------------- | ------------------------------------------------------------------ | | `guard_file.py` | 3 | `commit_filename_rules`, `content_text`, `main` | テストと CLI から使われる公開 API | | `shell_words.py` | 1 | `home_directory` | `tests/hooks/test_shell_words.py` が直接呼ぶため非公開化しなかった | docstring は名前の言い換えではなく,返す値・拒否する入力・例外を述べている. ## リポジトリ全体の内訳 (ac-dn の全 lane) | PR | 非公開化 | docstring 追加 | 改名 (N818) | | -------------------------------------------- | -------: | -------------: | -----------------: | | #130 (hooks/lib) | 38 | 23 | 0 (他に表記修正 2) | | #131 (session_store ほか 4 ファイル) | 48 | 20 | 0 | | #133 (hooks/\*.py, scripts, skills, tests) | 44 | 15 | 2 | | #132 (verification_session, check_execution) | 8 | 7 | 0 | | この PR | 11 | 4 | 4 | | 合計 | 149 | 69 | 6 | #130 と #133 の件数は各 PR 本文の表,#131 は本文の合計行,#132 は ac-dn の表 (非公開化 7 + `collect`,文書化 `main`/`dispatch`/`failure`/`Status`/`Result`/`Result.failed`/`execute`) による. ## 検証 - `ruff check .`: All checks passed - `ruff format --check .`: 239 files already formatted - `ty check`: All checks passed - `pytest`: 手元 (sandbox) では 2 件を除き通過.失敗は `tests/hooks/test_formatter_config.py` の dprint 統合テスト 2 件のみで,sandbox が `plugins.dprint.dev` への通信を遮断するため (この PR の変更とは無関係).CI で確認する - pre-commit (lefthook) は `LEFTHOOK_EXCLUDE` なしで全フック通過 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
概要
#74 段階 1B の ruff
D(google)とNの有効化に向けた,レーン dn-a の準備です.対象はagents/hooks/lib/のsession_store.py,session_gate.py,herdr_ownership.py,provider_adapter.pyの 4 ファイルで,pyproject.tomlは変更しません(有効化は最後の PR で行います).対象 4 ファイルは,目標設定(
D,Nを選択し,pydocstyle は google,D104D105D107を無視)で ruff の指摘が 0 件になりました.方針
_の private にしました.git grepでagents/,scripts/,tests/に外部の利用がないことを確認しています.内訳(指摘 68 件)
session_store.pysession_gate.pyherdr_ownership.pyprovider_adapter.pyherdr_ownership.pyでは,docstring が既にあった_require_closableと_require_owned_workspaceも,同じ理由(外部の利用なし)で private にしました.private 化した名前と根拠
外部の利用がないことは
git grep -wで確認済みです.session_store.py:_create_record,_atomic_bytes,_acquire_lock,_prune_records,_trusted_record_directory,_log_files,_prune_record,_remove_if_expiredsession_gate.py:_verify,_current_status,_save_skip,_bounded_summary,_valid_receipt,_check_identity,_check_budget,_notification.外部(verification_session.pyとテスト)が使うのはgate,status,unresolvedだけです.herdr_ownership.py:_record_result,_is_single_call,_target,_option_value,_record_workspace,_require_closable,_require_removable,_require_owned_workspace,_expire_workspace,_live_panes,_matches_live,_valid_entry,_normpath,_claim,_require_owned,_agent_session,_matches_agent,_save,_live_agents.外部が使うのはcheck,confirm,entries,live_path,herdr_resultです(cleanup_worktrees.pyとテスト).provider_adapter.py:Adapter._native,_audit,_fan_out,_shell,_harness,_check_paths,_content(dispatch経由でだけ呼ばれる),および_shared_directory,_secret_policy_path,_command_text,_edit_targets,_command_paths,_secret_path_refusal,_secret_path_reason,_usage_entry.main,dispatch,normalized,translated,lint(テストが使う)とno_cwd,system_message,additional_context,system_message_output,Adapter,Profile(各 provider のhook_adapter.pyが使う)は公開のままです.docstring を書いた公開 API
SessionRecord(baseline,results,save_results,end,write_log,lock),state_directory,worktree_id,session_directory,load,private_directory,read_json,atomic_json,record_directories,VerificationRun.configuration_failure,unresolved,entries,no_cwd,Adapter.main,Adapter.dispatch.検証
ruff check,ruff format --check,ty check: 通過pytest -n auto: 4531 passed,1 skippedRefs #74
🤖 Generated with Claude Code