Repository navigation
fix: refs で解析できない言語のファイルを申告し、検索できない範囲をエラーにする - #48
Merged
Merged
Conversation
refs は解析できない言語のファイル (.applescript など) を黙って走査から外しており、 そのファイルにしか無い参照を探すと警告なしの 0 件・終了コード 0 になっていた。 --glob でそのファイルだけを指定しても同じで、symbols --path が UNSUPPORTED_LANGUAGE を返すのと食い違っていた。 - 検索範囲の解析できないソースを、dead-code / review と同じ truncations の unanalyzable_source で申告する。refs --names では skipped と同じく先頭の結果に だけ付ける。この申告があれば complete_input も false にする - 範囲にファイルはあるのに検索できる入力が 1 件も無いときは UNSUPPORTED_LANGUAGE にする。対応言語のファイル・生成物・先頭を読めなかった拡張子なしファイル・ component に紐付いた Angular テンプレートのどれかがあれば従来どおり空の結果を返す - エラーにするのは CLI / session / MCP の利用者向けの経路だけで、API 差分の内部検索は 従来どおり参照 0 件として扱う - 申告する拡張子に applescript を足す Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
usage (日英) に「解析できない言語のファイル」の節を足し、truncations の申告と、 UNSUPPORTED_LANGUAGE になる条件・ならない条件を書く。complete_input の説明も更新する。 README・skills/SKILL.md・AGENTS.md にも要点を足す。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
概要
refsは、解析できない言語のファイル (.applescriptなど) を検索範囲に含めても黙って外しており、そのファイルにしか無い参照を探すと警告なしの 0 件・終了コード 0 になっていました。--glob sample.applescriptでそのファイルだけを指定しても同じで、symbols --pathがUNSUPPORTED_LANGUAGEを返すのと食い違っていました。この PR では次の 2 点を直します。
dead-code/reviewと同じtruncationsのunanalyzable_sourceで申告するUNSUPPORTED_LANGUAGEにする原因と修正
refs/files.rsのclassify_candidateは、言語の決まらないファイルを「ソースだと確実に言える拡張子 (UnanalyzableSource)」と「それ以外 (Ignore)」に分けます。前者を申告していたのはdead-code/reviewだけで、refsはどちらも捨てていました。.applescriptは前者の一覧にも入っていませんでした。RefScanに申告 (unanalyzable) と「検索できる入力が無い」判定 (unsupported_only) を持たせ、RefsResult.truncations(空なら出力しない) に載せる。input_is_complete()も申告があれば false にし、省略が起きたときのresult_summary.complete_inputに反映するrefs --namesでは、申告をskippedと同じく先頭の結果にだけ付ける。後続の名前のcomplete_inputも、apply_refs_batch_limitsが全結果を集約するので false になる「検索できる入力が無い」判定 (
FileCollection::unsupported_only) では、画像・文書・未知の拡張子も含めて範囲に入ったファイルをすべて数える。glob の書き方 (sample.applescript/*.applescript) では変えない。次のどれかがあればエラーにしないskippedで申告済み)CandidateDecision::Unreadable。対応言語のスクリプトかもしれない)AngularBatchContext::input_count。--glob '**/*.html'でも検索できる。判定にヒット数は使わない)範囲に 1 件もファイルが無い場合は、従来どおり空の結果を返します
エラーにするのは利用者向けの経路 (CLI / session / MCP が呼ぶ
find_references_with_generated/find_references_batch_with_generated) だけ。API 差分の内部検索 (find_symbol_references_batch) はRefSearchAudience::Internalとしてエラーにせず、従来どおり参照 0 件として扱う申告する拡張子に
applescriptを足す (dead-code/reviewの申告にも効く)Angular の単一名経路も
AngularBatchContext::prepareを 1 回だけ呼び、テンプレート数とヒットを同じ前処理から取る。公開 API のfind_angular_template_references(_batch)は残す設計の判断 (codex と相談)
採ったもの:
skipped_unsupportedなど) を作らず、既存のtruncations/unanalyzable_sourceに寄せる採らなかったもの:
--namesの全結果への申告: 申告は 1 拡張子あたり推定 88〜135 トークン (estimated_tokensの実測、代表パス 1〜3 件) あり、名前ごとに繰り返すと既定の予算 3,000 トークンを申告だけで使い切るため.elm/.rktなどの追加: 報告のある.applescriptだけに留めたbudget_exceeded: 「省略が 1 件も無ければresult_summaryを出さない」は既存の意図的な契約 (skippedも同じ)。申告は最大 10 件なので、通常の長さのパスなら既定の予算を申告だけで超えることはない。契約そのものを変えるのは別の設計にする今回の範囲外 (別対応):
failed_files) と Angular テンプレートの読み込み失敗は、出力の省略が起きたときのcomplete_inputにしか現れないsymbols --dirも、未対応言語のファイルしか無い範囲では黙って何も出さない検証
make ci: pass (unit 1,668 件 / integration 517 件)astro-sight review --dir . --git --base <base> --hook: exit 0 (参考情報の共変更の履歴だけ)refs_declares_unsupported_language_sources: 混在する範囲で.applescript/.vueを申告し、README.mdは申告しない。--namesでは先頭だけに付き、後続のcomplete_inputも false。--glob '*.sh'に絞れば申告なし・complete_input: truerefs_rejects_scope_without_any_searchable_file:--glob sample.applescript/*.applescript/docs/**(md だけ) /--namesがUNSUPPORTED_LANGUAGE。対照として、何にも当たらない glob・生成物だけ・対応言語だけの範囲は成功refs_html_glob_counts_linked_angular_templates_as_searchable_input:--glob '**/*.html'で紐付いたテンプレートを検索でき、ヒット 0 件でもエラーにしない。紐付かないindex.htmlだけならエラーsession_refs_reports_unsupported_language_scope_and_sources/mcp_refs_search_rejects_scope_without_searchable_file: session と MCP も同じunsupported_only_scope_is_an_error_only_for_user_searches: 内部の API 判定はエラーにしないcollect_files_scan_detects_scope_without_searchable_input/unsupported_scope_caps_extensions_and_reports_the_rest/unreadable_extensionless_file_is_not_treated_as_unsupported: 拡張子の内訳と代表パスが決定的なこと (作成順を辞書順と逆にしても先頭 3 件)、hidden 配下は数えないこと、上限、読めないファイルの扱いunanalyzable_sources_make_the_input_incomplete_and_count_toward_the_budget: 採寸用の描画にも申告が載るtruncationsが付き、--glob sample.applescriptはUNSUPPORTED_LANGUAGE(終了コード 1) になることを確認Closes #47
🤖 Generated with Claude Code