fix(policy): ignore dotfile presets from directories#2525
fix(policy): ignore dotfile presets from directories#2525WuKongAI-CMU wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
Directory-based custom preset loading should mirror normal directory scans by ignoring hidden dotfiles such as .draft.yaml. This keeps --from-dir focused on intentionally selected visible preset files. Constraint: Preserve sorted application order and first-failure abort semantics for visible YAML files. Rejected: Filter dotfiles inside loadPresetFromFile | single-file loading should still honor an explicit user path. Confidence: high Scope-risk: narrow Tested: npm run build:cli Tested: npm run typecheck:cli Tested: npm test -- test/policies.test.ts -t='--from-dir skips hidden dotfile yaml presets' Tested: git diff --check
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
✨ Thanks for submitting this pull request that proposes a way to ignore hidden dotfile YAML entries when applying custom presets from a directory. Related open issues: |
|
@WuKongAI-CMU please add DCO sign-off for this change |
Replays the approved functional change from @WuKongAI-CMU in #2525 onto current main. Original PR: - #2525 by @WuKongAI-CMU Behavior: - `policy-add --from-dir` ignores hidden dotfile YAML entries while still applying non-hidden `.yaml`/`.yml` files in lexicographic order. - Explicit `policy-add --from-file .hidden.yaml` behavior is unchanged because the `--from-file` path is not filtered. Replacement rationale: - #2525 was already approved but is currently blocked by branch/process state. - This PR carries the same functional change forward on a clean replay branch so it can be validated and merged without waiting on the original branch update. Validation: - `git diff --check` passed. - `npm test -- test/policies.test.ts -t="--from-dir skips hidden dotfile yaml presets"` passed after installing dependencies and rebuilding the CLI. - GitHub checks are being monitored before merge. Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
Thanks @WuKongAI-CMU for the contribution here. The functional change from this PR has now been replayed and merged via #2679 because #2525 was blocked by branch/process state. The merged change preserves the behavior proposed here: Closing this PR as superseded by #2679. |
Pull request was closed
Replays the approved functional change from @WuKongAI-CMU in NVIDIA#2525 onto current main. Original PR: - NVIDIA#2525 by @WuKongAI-CMU Behavior: - `policy-add --from-dir` ignores hidden dotfile YAML entries while still applying non-hidden `.yaml`/`.yml` files in lexicographic order. - Explicit `policy-add --from-file .hidden.yaml` behavior is unchanged because the `--from-file` path is not filtered. Replacement rationale: - NVIDIA#2525 was already approved but is currently blocked by branch/process state. - This PR carries the same functional change forward on a clean replay branch so it can be validated and merged without waiting on the original branch update. Validation: - `git diff --check` passed. - `npm test -- test/policies.test.ts -t="--from-dir skips hidden dotfile yaml presets"` passed after installing dependencies and rebuilding the CLI. - GitHub checks are being monitored before merge. Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Summary
Addresses one hardening item from #2521.
Test plan
Summary by CodeRabbit
Bug Fixes
policy-add --from-dircommand now ignores hidden dotfiles (those beginning with a dot) when loading YAML policies, ensuring only visible configuration files are applied.Tests