Skip to content

Show inherited values, head rules and rule update revisions in policy views - #74

Merged
KunalSin9h merged 11 commits into
mainfrom
claude/pensive-sagan-3x8any-cli-policy-fields
Nov 6, 2026
Merged

KunalSin9h merged 11 commits into
mainfrom
claude/pensive-sagan-3x8any-cli-policy-fields

Conversation

@abhisek

@abhisek abhisek commented Nov 6, 2026

Copy link
Copy Markdown
Member

The policy API added three fields in safedep/api#263. This change bumps the SDK to that build and shows the fields. It also fixes the last findings of the dogfood run in safedep/control-tower#1663.

Changes

View Before After
Preview, a field that only the default policy sets scan_gate.fail_on - -> medium high (default) -> medium
Preview, an override unsets a field 1d -> - 1d -> 7d (inherited)
Preview, a rule update or delete delete r_80b delete trust pkg:npm/leftpad (r_80b)
Publish warning It loosens delete r_80b (- -> -) in package rules It loosens delete trust pkg:npm/leftpad (r_80b) in package rules
rule show added in revision 40 added in revision 40, updated in revision 43
endpoint list, a tool with no policy report rev 0 -
A refused request with 0.604800s 0.7d 0.604800s
  • The inherited value follows the empty side. An empty old side shows the lower layers before the change. An empty new side shows them after the change.
  • JSON output adds inherited to a change item and updated_revision to a rule. Plain output adds inherited as the last column of a change line. Both additions keep the existing fields and columns.
  • The publish warning reads from high (default) to low, with no nested parentheses.

Tests

  • rule create checks a trust entry with a 91d expiry before it connects to the server.
  • The policy edit retry test checks the refused request and the corrected request. Three of its cases replaced a comment line in the document header, not the field, so they sent the refused value again. They now edit the field.
  • Each new test fails without its fix.
  • make build, make test and make lint-conventions pass.

The server side is safedep/control-tower#1668. Until it ships, the new fields are empty and the views show what they show today.


Generated by Claude Code

claude added 11 commits November 6, 2026 11:46
The policy API now sends the inherited value of a path change, the head
rule of a rule operation preview and the update revision of a rule. The
CLI needs this build to read these fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
DocumentDurations matched "604800s" inside "0.604800s" because a word
boundary is also between a dot and a digit. The message then showed
"0.7d", which is not the value of the server. The pattern now captures
the character before the number and excludes a dot and a word
character. The replacement keeps that character.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
A field change with an empty side showed "-", as in
"scan_gate.fail_on - -> medium", although the default policy gave the
field the value high. The reader could not see the value that applied.
The preview now shows the inherited value that the server sends on the
empty side. It marks the value "(default)" for the policy base and
"(inherited)" for a policy override, as the notice email does. The JSON
and plain output carry the exact inherited value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
A preview showed an update or a delete of a package rule by its id
only, as "delete r_68e23zskkh". An admin could not see what the rule
selected before they published a rollback. The preview now reads the
head rule that the server sends and shows its effect, selector and id,
as "delete trust pkg:npm/lodash (r_68e23zskkh)". The row also names the
policy override that the head rule attaches to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
The server now keeps added_revision as the revision that first created
a rule, and sends updated_revision for the last update. rule show gave
only the added revision, so an admin could not see that a later
revision changed the rule. rule show now writes "added in revision 17,
updated in revision 23" when an update changed the rule. The JSON and
plain output carry the updated revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
endpoint list showed "rev 0" in the POLICY column for a tool that sent
no policy report. The state of such a tool is unspecified and its
revision is 0, which is not a policy revision. The column now leaves
out a tool with an unspecified state and revision 0, as it does for a
disabled tool. A tool with an unspecified state and a revision keeps
its revision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
No test checked that rule create refuses an invalid request before it
connects to the server. The trust expiry test now runs createRules with
a trust entry that expires in 91 days. Its connection callback fails
the test when createRules calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
The test of a refused edit counted the requests but did not read them.
Three cases corrected a comment line in the file header and not the
field, so the second request sent the refused value again, and the test
passed. The test now reads the edited field in the refused request and
in the corrected request. The three corrections now edit the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
No test read the inherited column of a plain change line. A change that
dropped the column passed every test. The inherited value test now
checks one full plain change line in each case. The test table also
uses the names oldValue and newValue, because new is a Go built-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
The publish warning put the old and new values in parentheses. An
inherited value has its own parentheses, so the warning read
"scan_gate.fail_on (high (default) -> low)". A rule operation has no
values, so its warning ended in "(- -> -)". The warning now reads
"It loosens scan_gate.fail_on from high (default) to low in base". For
an item with no old and no new value, it names only the item and its
place, as "It loosens delete trust pkg:npm/leftpad (r_80b) in package
rules".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
ruleOperationItem set the place of a row and then set it again for a
head rule. It now finds the override id first and sets the place one
time. The comment on the revisions of a rule now gives the reason for
its guard. The edit retry test now says why its fix step anchors on the
indent of the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
@safedep

safedep Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

Package Details
Package Malware Vulnerability Risky License Report
icon buf.build/gen/go/safedep/api/grpc/go @ v1.6.2-20261106062459-79f98cf26185.1
go.mod
ok icon
ok icon
ok icon
🔗
icon buf.build/gen/go/safedep/api/protocolbuffers/go @ v1.36.12-20261106062459-79f98cf26185.2
go.mod
ok icon
ok icon
ok icon
🔗

View complete scan results →

This report is generated by SafeDep GitHub App

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: d44da8b3-84ae-4119-818a-e33e7f73a13d
Commits

Reviewing files that changed from the base of the PR and between 1832647 and 607d887.

Files ignored due to path filters: 1

  • go.sum is excluded by !**/*.sum
Files selected for processing: 20

  • docs/cmd/endpoint-list.md
  • docs/cmd/policy-change-create.md
  • docs/cmd/policy-change-publish.md
  • docs/cmd/policy-change-show.md
  • docs/cmd/policy-rule-list.md
  • docs/cmd/policy-rule-show.md
  • go.mod
  • internal/cloudpolicy/docpath.go
  • internal/cloudpolicy/docpath_test.go
  • internal/cmd/endpoint/policy_test.go
  • internal/cmd/endpoint/service.go
  • internal/cmd/policy/change_preview.go
  • internal/cmd/policy/change_publish.go
  • internal/cmd/policy/change_render.go
  • internal/cmd/policy/change_test.go
  • internal/cmd/policy/errors_test.go
  • internal/cmd/policy/publish_test.go
  • internal/cmd/policy/rule_show.go
  • internal/cmd/policy/rule_test.go
  • internal/cmd/policy/rule_view.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T12:06:39.560090Z 607d887 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@abhisek
abhisek enabled auto-merge (squash) November 6, 2026 13:11
@KunalSin9h
KunalSin9h disabled auto-merge November 6, 2026 13:19
@KunalSin9h
KunalSin9h merged commit b9c1b6f into main Nov 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants