keep / --no-keep の no-op 指定を警告する#50
Merged
Merged
Conversation
Keeping works by routing a registered library through its dummy dir, so a keep ID that matches no registration is a complete no-op: a typo'd -k silently expands the library, and a committed .risundlerc.toml on a freshly cloned machine references libraries that are not registered yet (#31). State the fact and the remedy on stderr without guessing intent, aggregated into one line; the run still succeeds because the expanded output is a working submission. std stays out of this warning — its absence is already reported by warn_std_compiler. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Same no-op detection as unregistered keeps, but the consequence of a typo'd --no-keep is harder: the library stays kept, so an unresolvable #include survives into the submission. Settings::resolve now also returns the --no-keep IDs that matched neither the configured keeps nor --keep, and the handler reports them on stderr (#31). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The spec records the warning, its std exclusion, and why it is not an error; the cheatsheet FAQ now separates the two causes of an expanded kept library by whether the warning appeared. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closed vocabulary (our own schema) errors, open vocabulary (library IDs, machine-dependent) warns; imperative direct objects error, declarative settings warn. Warnings must be escapable by a legitimate action and never change the exit code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughChangesKeep and no-keep diagnostics
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant BundleCommand
participant Resolution
participant Inventory
User->>BundleCommand: run bundle with keep/no-keep options
BundleCommand->>Resolution: resolve configuration and CLI settings
Resolution-->>BundleCommand: effective settings and diagnostic metadata
BundleCommand->>Inventory: check kept IDs with is_registered
BundleCommand-->>User: emit aggregated warnings and bundle output
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
--no-keep std is a documented way to make std expansion explicit (it suppresses the std-not-kept warning), so reporting it as a no-op when the configured keep omits std contradicts that intent and the spec's std exclusion. Mirror the STD_ID exclusion warn_unregistered_keeps already applies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The implementation checks the keep after --no-keep subtraction, so an ID both kept and no-kept (a resolved contradiction) warns nowhere by design. Align the spec wording with that semantics instead of the raw config/CLI keep. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
warn_std_not_kept got its material from a raw-argument rescan in run() while the no-op --no-keep IDs rode out of resolve as an unlabeled tuple element; the next keep/no-keep diagnostic would have had to pick a mechanism again. Resolution now names both fields and is the single channel for warning material that only the merge can compute. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
warn_noop_no_keeps built a throwaway Vec<&str> solely to satisfy the &[&str] signature; a generic AsRef<str> bound lets it pass its &[String] directly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #31
概要
keep の ID が登録済みライブラリに一致しない場合、および
--no-keepが何も除外しなかった場合に、stderr へ警告を出す。「typo 検出」ではなく「効果を持たなかった指示 (no-op) の事実を告げる」と位置づけ、意図の推測はせず事実と処方 (library list/library add) を述べる。これにより typo の人にも、「config はコミット済みだが登録がまだ」の clone 直後の人にも、同じ文面が正しく機能する。変更内容
Inventory::is_registered(純粋な照合) を追加し、実効 keep のうち登録に一致しない ID を集約 1 行で警告。stdは既存のwarn_std_compilerの管轄のため対象外 (自動登録失敗時の二重警告を避ける)--no-keepの no-op 警告 — (config の keep ∪--keep) のどれにも一致しなかった--no-keepを警告。こちらの typo は「keep されたまま#includeが残り提出先で初めて壊れる」という keep 側より硬い失敗につながるため同梱。Settings::resolveの戻りに no-op リストを追加 (唯一のプラミング変更)-kしたはずのライブラリが展開されてしまう」FAQ を、警告の有無で原因 (ID 不一致 /"..."include) を切り分けられる形に改稿show/delete) はエラー・宣言形 (keep) は警告 / 警告は正当な操作で必ず消える「行き止まりの無い」ものだけを出し、exit code は変えない警告のみの非破壊的変更で、既存の挙動 (出力・終了コード) は変わらない。
検証
-k ac-libary(typo) → 処方付き警告、出力は生成され exit 0 のまま--no-keep ac-libary(typo) → no-op 警告--no-keep stdは既定の keep に一致するため警告なし (常用を邪魔しない)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
keepor--no-keepentries do not affect the resolved configuration.--no-keep.Documentation