Skip to content

#578 [tools] Bash の書き方の拒否で、workspace 相対 path での再実行を求めないようにする - #650

Merged
Kewton merged 1 commit into
developfrom
feature/issue-578-tools-bash-workspace-path-575
Oct 10, 2026
Merged

Kewton merged 1 commit into
developfrom
feature/issue-578-tools-bash-workspace-path-575

Conversation

@Kewton

@Kewton Kewton commented Oct 10, 2026

Copy link
Copy Markdown
Owner

概要

Bash が「書き方」を理由にコマンドを拒否したとき、エラー文が workspace 相対の path での再実行を求めないようにします。書き方の拒否は path を直しても通らないので、この案内は誤解を招きます。path が workspace の外にあることによる拒否の文は変えません。

変更

  • src/tools/bash.rs
    • path_confinement_rejection の文の組み立てだけを分けました。
    • 判定には is_command_form_operation(operation) を使います。書き方の拒否のとき、文は bash_path_confinement_error: {reason} だけになります。
    • 書き方の拒否は次の 6 つです:ANSI-C / locale quoting・env -S / --split-string・unresolved command prefix・unreadable shell text・unverifiable backtick command substitution・unverifiable glob write target。
    • path の拒否の文は 1 字も変えていません。
    • 次のものも変えていません:拒否と許可の判定、event の名前(bash_path_confinement_rejected)と schema、path・nearest_relative・guidance などの field の値。
  • tests/issue578_bash_rejection_guidance.rs(新規)
    • 書き方の拒否は 6 種類それぞれ 1 コマンドで、文が「接頭辞+reason」と完全に一致し、再実行の文言を含まないことを確かめます。
    • path の拒否では、後半の案内が残ることを確かめます。
    • event の schema(schema_version 1・blocked・operation・nearest_relative・guidance)を確かめます。
    • 書き方の一覧と path の一覧が重ならないことを確かめます。

検証

  • commandmate verify の 15 ゲート(fmt・clippy -D warnings・cargo test の全体を含む)は、develop c98bdc7c の上の HEAD cdebe287 で 15/15 pass でした。
  • 二点測定:develop c98bdc7c のコードに新しいテストのファイルだけを置いて実行しました。
    • 4 本中 2 本が FAIL しました(form_rejection_message_is_only_the_reason・form_rejection_event_keeps_the_existing_schema)。今のコードの文が再実行の案内を含むためです。
    • path の拒否の 2 本は develop でも pass します。文が変わらないことを確かめるテストなので、期待どおりです。
    • HEAD では 4 本とも pass します。
  • 既存のテストは 1 行も変えていません。成長上限の対象(runner.rs・loop_run.rs・baseline)も変えていません。

確かめてほしい点

  • 一覧は、各 module の定数ではなく、文字列を書き写したものです。定数が変わると一覧と食い違いますが、新しいテストが 1 種類につき 1 コマンドで operation の一致を確かめるので、食い違えば捕まります。
  • unreadable shell text と unverifiable backtick command substitution は、Issue の表にない 2 種類です。どちらの場合も、path に入るのは番兵の値(<shell text> など)なので、path を直す案内は意味を持ちません。

レビュー

文とテストの変更なので、merge 前レビューは行いません(利用者承認済み)。

Refs #578

🤖 Generated with Claude Code

Issue #578: a rejection whose operation refuses the command's form
(ANSI-C / locale quoting, env -S / --split-string, an unresolved
command prefix, a mixed glob/brace write target, unreadable shell
text, or a backtick command substitution) holds a spelling in its
`path` field, not a path. It no longer appends "use workspace-relative
path ..."; only the reason, which already names the alternative
spelling, is shown. Path rejections keep their message byte for byte.
The `nearest_relative` and `guidance` fields keep their values, so the
recorded event and its schema are unchanged, and the reject/allow
decision is untouched.

判断: the issue table lists four form kinds ("など"); the design rule is
"operation が path ではないもの", so the two other fail-closed
operations (unreadable shell text, unverifiable backtick command
substitution) are included too — their `path` is a sentinel, so the
path guidance was equally wrong for them. The form/path operation
partition, the short message, and the unchanged field values are frozen
in tests/issue578_bash_rejection_guidance.rs.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@Kewton
Kewton merged commit 9303e20 into develop Oct 10, 2026
5 checks passed
@Kewton
Kewton deleted the feature/issue-578-tools-bash-workspace-path-575 branch October 10, 2026 16:47
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