Repository navigation
feat(policy): show every policy setting on its own row in policy show - #78
Conversation
The table view of `safedep policy show` put every setting of the SafeDep default policy on one "Default policy" line, joined by middle dots. A license deny list made the line run far past an 80 column terminal, and each new setting made it longer. The view also never showed the settings of the tenant base, so a base value hid behind the default value on that line, and it did not say which settings a policy override changes. The view now has a Settings section with one setting on each row, grouped by the parent of its path, as scan_gate.licenses. Each row shows the value that every subject gets and its layer, base or default policy, in the source words of the subject policy views. Each policy override that sets the field adds a row below it, from the highest priority to the lowest. A list value wraps after an item to the terminal width. The head revision line, the empty messages and the override description also wrap, so no line passes the terminal width. The summary keeps a short "Default policy revision N" row and points to `safedep policy rule list` and `safedep policy get`. The JSON and plain output do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
The first version of the settings section in `safedep policy show` had gaps: - One long override name widened the SOURCE column for every row, so each row passed the terminal edge. A name can have 63 characters. - An override past its expiry showed its value as if it still applied. - The section listed only the settings that a layer sets, and it hid a setting that this CLI's SDK does not know without a word. - The view read the width of stderr, so output to a file wrapped at the terminal width, and output on a wide terminal with stderr redirected wrapped at 80 columns. - The word wrap copied the one of the edit template. Now the SOURCE column fits the layers and the override sources up to a third of the width. A longer override source takes a line of its own, with the value on the next line. An expired override keeps its row, with ", expired" after its source. The section lists every settings path of the contract, with "-" and "not set" when no layer sets it, and a note when the policy holds settings that this CLI does not know. The view wraps to the width of stdout, and does not wrap when stdout is not a terminal. cloudpolicy.WrapWords is now the one word wrap. It counts display columns, and the edit template output does not change. A cloudpolicy test fails when a settings path stops to merge by replace, because the SOURCE column assumes that the nearest layer wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep GitHub App |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Sahilb315
left a comment
There was a problem hiding this comment.
Reviewed the settings view, the wrap helpers and the override table. Build and the policy, cloudpolicy and tui tests pass on the head commit. Server text is escaped before it wraps. JSON and plain output keep their shape. TestLeafPathsMergeByReplace guards the rule that the nearest layer wins. No blocking issues.
Generated by Claude Code



What was wrong
safedep policy showprinted the policy settings on one line, joined by·:fail_on: medium, the view still printedhigh.policy get.What changes
A settings section lists every setting the CLI knows, grouped by parent path. Each row shows the value that applies and the layer that sets it:
base,default policy, or-with "not set, each tool uses its local value". Under a setting, each override that sets it gets its own row, highest priority first, and an expired override is marked, expired.At 80 columns:
Package rulesline points tosafedep policy rule list.cloudpolicy.WrapWordscounts display columns and serves both the edit template and this view. The template output is byte-identical.Tests
TestShowRenderTableandTestShowRenderTable_Examplecover:Each case checks that no line passes the width.
TestLeafPathsMergeByReplacefails if a setting stops merging by replace. The SOURCE column assumes the nearest layer wins.TestWrapWordschecks wrapping by display width.Known limits
LicenseRef-id, can pass the width.wrapLastColumnworks around the missing option for the description cell. A dry/tui table width option would remove that workaround.Generated by Claude Code
Summary by CodeRabbit