Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TESTING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Use `docs/test-doc-maintenance-plan.md` before moving oversized suites or adding
YAML `outline` integration coverage must assert nested sequence paths, mapping-parent depth, unchanged source ranges and symbol counts, deterministic sorting, and cursor replay across a page boundary.
CLI parsing, command execution, and installer behavior. Index command coverage is split by run mode or feature area, and query command coverage is split by command family with partial test classes so shared console and fixture helpers stay centralized. Keep repeated query-result fixtures, such as overlapping chunk content used by multiple search deduplication tests, in narrow class-level helpers instead of duplicating local builders. `ProgramCliTests.cs` covers top-level entrypoint behavior that must be exercised through a subprocess, while `InstallScriptTests.cs` runs focused bash snippets against `install.sh` in library mode to lock in release-installer regressions without performing real network installs. Installer bundle-generation tests must also verify that `install.sh` is marked generated while every canonical `install_modules/` source remains unmarked.
Status-explain coverage must enumerate the source-generated `StatusResult` serializer properties and require every serialized top-level key to succeed without opening a database. Keep major readiness/trust/extension/maintenance/cap-hit metadata assertions, dotted-member resolution, bounded valid unknown candidates, and redaction of hostile field input in the same focused fixture so serialization and explainability cannot drift independently. Keep every structured explain response key registered for status `--fields` projection, and exercise the response through a bounded JSON projection that proves the outer envelope also omits runtime and path metadata.
Safety-recipe semantic coverage must keep safe and unsafe controls in separate indexed files: assert that `Regex.Escape` / `Regex.Unescape` and literal `UseShellExecute=false` are absent, while matching, source-defined, or unresolved Regex members, literal `true`, and propagated shell-policy values remain with classification evidence. Include alias trivia, alias-like comments and strings, a qualified BCL call in a file with a bare `BoundedRegex` alias, a line break before literal `false`, and computed continuations after block and line comments. Also retain a bare receiver from a legacy index without current reference identity, add enough safe helpers to saturate the normal result envelope, keep count output aligned with full JSON, and retain a separate `new Regex` construction positive.
Graph snippet-length validation uses one command/format matrix across `references`, `callers`, and `callees`. Keep explicit `--snippet-lines` fail-fast without `--body`, reject location-only and count output even when `--body` is present, preserve the zero/range errors, and retain successful text/JSON body excerpts through the accepted maximum. Also cover option-like literals supplied through `--query` and `--`, plus two-page bounded body projection with clean stderr, correct total counts, and cursor continuation. Top-level compact aliases must validate the original arguments before database access, and bounded count replay must preserve snippet-like query literals.
Search-to-find recovery coverage must exercise `--regex` and `--all` in human and JSON modes, option-shaped and shell-sensitive query values, normalized path/language/exclusion/limit arguments, and explicit non-equivalent or unsafe cases. Assert typed argv plus POSIX-shell and PowerShell displays, absence of implicit workspace defaults, and the no-execution markers; an unmappable request must return no alternative command.
C# `unused` partial-family coverage must reuse one multi-file fixture across regular JSON, compact, `--by-bucket`, and `--actionable`; include top-level and nested partial types, genuinely unused private members, an unrelated same-named family, a containing-type generic-arity collision, and a family-external occurrence in a matched peer file so semantic membership cannot regress into name-only, flattened-qualified-name, or whole-file evidence sharing.
Expand Down Expand Up @@ -1150,6 +1151,7 @@ dotnet test --filter "FullyQualifiedName~GitHelperTests"
YAML `outline` の integration coverage では、入れ子 sequence path、mapping parent の depth、不変な source range と symbol count、決定的な sort、page 境界を越える cursor replay を検証してください。
CLI の引数解析、コマンド実行、installer 挙動のテスト。Index command coverage は run mode または機能領域ごとの partial suite に分割し、Query command coverage は command family ごとの partial test class に分割して、共有 console / fixture helper は一箇所に保ちます。`ProgramCliTests.cs` はグローバル引数の解釈や完全な CLI 起動フローのように subprocess 経由で確認すべき Program エントリポイント挙動を扱い、`InstallScriptTests.cs` は `install.sh` を library mode で source した bash snippet を実行して、実ネットワーク install を行わずに release installer の回帰を固定する。installer bundle 生成テストでは、`install.sh` が generated と判定される一方、canonical な `install_modules/` source はすべて unmarked のままであることも検証してください。
status explain の coverage は source-generated `StatusResult` serializer property を列挙し、database を開かずに serialized top-level key がすべて成功することを必須にします。主要な readiness / trust / extension / maintenance / cap-hit metadata、dot 区切り member resolution、unknown key に対する上限付きの有効な candidate、悪意ある field input の redaction を同じ focused fixture に置き、serialization と explainability が独立して drift しないようにしてください。structured explain response の全 key を status の `--fields` projection に登録し、outer envelope からも runtime / path metadata が省略されることを上限付き JSON projection で固定してください。
safety recipe の意味論 coverage では、安全側と危険側の control を別々の indexed file に置いてください。`Regex.Escape` / `Regex.Unescape` と literal `UseShellExecute=false` が除外され、matching、source-defined、または解決不能な Regex member、literal `true`、伝播された shell-policy 値が classification evidence 付きで残ることを検証します。alias の trivia、alias に見える comment / string、bare `BoundedRegex` alias と完全修飾 BCL call が同居する file、literal `false` の前の改行、block / line comment の後に続く計算式を含めます。また、現行 reference identity を持たない legacy index の bare receiver を残すこと、通常の result envelope を埋める数の safe helper、count 出力と full JSON の一致、別の `new Regex` construction 正例も維持してください。
graph の snippet 長 validation は、`references`、`callers`、`callees` を横断する1つの command / format matrix で検証します。明示した `--snippet-lines` は `--body` なしで fail-fast し、`--body` があっても location-only / count 出力では拒否すること、zero / range error を維持すること、受理上限まで text / JSON の body excerpt が成功することを固定してください。さらに、`--query` と `--` で渡した option 風 literal、および stderr が空で total count と cursor continuation が正しい2ページの bounded body projection も検証してください。top-level compact alias は database access より前に原引数を検証し、bounded count replay は snippet 風の query literal を維持しなければなりません。
search から find への recovery coverage では、human / JSON mode の `--regex` と `--all`、option 風および shell-sensitive な query 値、正規化した path / language / exclude / limit 引数、明示的に非等価または unsafe な case を検証してください。型付き argv と POSIX shell / PowerShell 表示、暗黙の workspace default が含まれないこと、未実行 marker を固定し、対応不能な request が代替 command を返さないことを必須にします。
C# `unused` の partial-family coverage では、通常の JSON、compact、`--by-bucket`、`--actionable` で1つの multi-file fixture を共有してください。top-level / nested partial type、本当に未使用の private member、無関係な同名 family、containing type の generic-arity collision、matched peer file 内の family 外 occurrence を含め、semantic membership が name-only、平坦化された qualified name、または file 全体の evidence 共有へ戻らないことを固定します。
Expand Down
32 changes: 24 additions & 8 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1410,15 +1410,24 @@ issue-draft export and downstream triage tools can keep the reviewer guidance
next to the evidence path. For example,
`classifiers` describe the triage dimensions that downstream tools should use,
such as `source_origin`, `guard_evidence`, `secret_origin`,
`parser_guard_evidence`, `process_launch_boundary`, `cancellation_intent`,
`task_result_intent`, `active_skip_governance`, `broad_catch_boundary`, and
`diagnostic_redaction`; each classifier lists categories, evidence fields, and
guidance so noisy audit terms can be separated before filing.
`parser_guard_evidence`, `process_launch_boundary`, `regex_operation_semantics`,
`shell_execute_polarity`, `cancellation_intent`, `task_result_intent`,
`active_skip_governance`, `broad_catch_boundary`, and `diagnostic_redaction`;
each classifier lists categories, evidence fields, and guidance so noisy audit
terms can be separated before filing.
`dogfood-risk-patterns` includes process-launch boundary child queries for
`ProcessStartInfo`, `Process.Start`, `ArgumentList`, `UseShellExecute`,
working-directory choices, stdout/stderr redirection, waits, termination, shared
launch/environment policies, and broad plugin/hook/trust-override discovery
terms.
The `static-regex-api*` children inspect the matched code-origin `Regex` member:
exact `Escape` / `Unescape` helpers on a receiver proven to be the BCL type are
suppressed, while matching operations and unresolved or source-defined
receiver/member evidence remain findings. `process-shell-execute` similarly
suppresses only a matched direct literal `UseShellExecute=false` assignment;
literal `true` and propagated or otherwise unresolved values remain findings
with semantic classification evidence. Nearby comments and string literals do
not change either semantic decision.
`risky-code/broad-exception-catch` includes broad-catch boundary categories and
expected diagnostic behaviors so users can distinguish intentional top-level,
cleanup, probe, diagnostic-sanitization, and worker boundaries from catches that
Expand Down Expand Up @@ -4801,14 +4810,21 @@ facet の短い一覧です。recipe run の JSON は各 matching result にも
issue-draft export や下流の triage tool が evidence path の近くに reviewer guidance を
保持できます。`classifiers` は下流 tool が使うべき triage の軸を表し、
`source_origin`、`guard_evidence`、`secret_origin`、`parser_guard_evidence`、
`process_launch_boundary`、`cancellation_intent`、`task_result_intent`、
`active_skip_governance`、`broad_catch_boundary`、`diagnostic_redaction` などの
classifier が category、evidence field、guidance を持つため、ノイズの多い audit term を
起票前に切り分けられます
`process_launch_boundary`、`regex_operation_semantics`、`shell_execute_polarity`、
`cancellation_intent`、`task_result_intent`、`active_skip_governance`、
`broad_catch_boundary`、`diagnostic_redaction` などの classifier が category、
evidence field、guidance を持つため、ノイズの多い audit term を起票前に切り分けられます
`dogfood-risk-patterns` は `ProcessStartInfo`、`Process.Start`、`ArgumentList`、
`UseShellExecute`、working-directory 選択、stdout/stderr redirection、wait、
termination、共有 launch/environment policy、広めの plugin/hook/trust-override
discovery 用語を process-launch boundary の child query として含みます。
`static-regex-api*` child は一致した code-origin の `Regex` member を判定し、BCL type と
証明できる receiver 上の厳密な `Escape` / `Unescape` helper を除外する一方、matching
operation、解決不能または source-defined の receiver/member evidence は finding として
残します。`process-shell-execute` も、一致した直接の literal `UseShellExecute=false` 代入だけを
除外します。literal `true` と、伝播またはその他の理由で解決できない値は、意味論的な分類
evidence を伴う finding として残ります。周辺の comment や string literal は、どちらの意味
判定も変更しません。
たとえば `risky-code/broad-exception-catch` は
broad catch の境界カテゴリと期待される diagnostic behavior を含めるため、意図的な
top-level、cleanup、probe、diagnostic-sanitization、worker 境界と、narrowing または
Expand Down
19 changes: 19 additions & 0 deletions changelog.d/unreleased/4911.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
category: fixed
issues:
- 4911
affected:
- src/CodeIndex/Cli/SearchAuditRecipes.cs
- src/CodeIndex/Cli/QueryCommandRunner.SearchRecipes.cs
- tests/CodeIndex.Tests/QueryCommandRunnerSearchTests.cs
- USER_GUIDE.md
- TESTING_GUIDE.md
---

## English

- **Safety audits now distinguish safe helper operations and negative policy values (#4911)** — the dogfood static-Regex audit suppresses exact BCL `Regex.Escape` / `Regex.Unescape` helpers without hiding pattern execution, source-defined receivers, or unresolved members, while the shell-execution audit suppresses direct literal `UseShellExecute=false` assignments and retains `true` or propagated values. The decisions follow matched code evidence rather than nearby comments, and retained findings include semantic classification evidence for the matched operation or value.

## 日本語

- **安全性 audit が安全な helper 操作と否定 policy 値を区別するようになりました (#4911)** — dogfood の static Regex audit は厳密な BCL `Regex.Escape` / `Regex.Unescape` helper を除外しつつ、pattern 実行、source-defined receiver、解決不能な member を検出に残します。shell-execution audit は直接の literal `UseShellExecute=false` 代入を除外し、`true` または伝播された値を残します。判定は周辺 comment ではなく一致した code evidence に従い、残った finding には一致した操作または値の意味論的な分類 evidence が含まれます。
Loading
Loading