Repository navigation
Runtime policy: the Changes scope keeps what a changed row's chips name - #83
Merged
Merged
Conversation
In the Changes scope a modified policy whose scope didn't change read "no workloads": its unchanged applies-to subject wasn't context, so the narrowed model had no chip for it. The context now also follows a policy's or rule's applies-to, matches and excludes relationships to their subjects (drawn only as chips), and a workload's covering policies (covers), so a changed workload doesn't read as covered by no policy. The context moves to scope.ts, where it is tested through the same narrowing the shell does. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the runtime-policy relationship-chip changes.
No open issues 🎉
What changed in this PR
This PR fixes missing relationship chips in the runtime-policy renderer’s Changes scope, so unchanged subjects and covering policies remain visible when needed to understand changed rows.
Changes:
- Extracts
runtimePolicyContextand retains subjects referenced by policy/rule chips and policies covering changed workloads. - Connects the renderer to the shared context function without adding unchanged covered workloads.
- Adds two regression tests comparing scoped chips with the full comparison view.
| File | Description |
|---|---|
packages/renderers/runtime-policy/test/runtime-policy.test.mjs |
Adds regression tests for policy-scope and workload-coverage chips. |
packages/renderers/runtime-policy/src/scope.ts |
Defines context traversal that retains chip subjects and covering policies. |
packages/renderers/runtime-policy/src/main.tsx |
Uses the extracted context function in the renderer’s scope configuration. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The scoped regression tests do not check selector chips, so they would miss regressions caused by removing matches and excludes from the context; coverage should compare chips for unchanged matching and excluded subjects on modified selectors against the full model.
1 open issue
Review effort: Balanced
…excluded subjects Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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.

Found by the gallery session: in the default Changes scope, a modified policy's "Applies to" read no workloads, while All showed its real subject.
Cause. The Changes scope lays out a narrowed model: the changes, plus the context the renderer asks for. Runtime policy's context kept a changed rule's probe, policy and hook, but not the subjects named by a policy's or rule's chips (
applies-to,matches,excludes). Those subjects are only drawn as chips, so when one was unchanged it wasn't in the narrowed model. The chip disappeared, and an unchanged scope read as "no workloads". Workloads have the same gap in reverse: an unchanged covering policy dropped out, so a changed workload read as covered by "no policy".Fix. The context, now in
src/scope.tsasruntimePolicyContext, also follows:applies-to,matchesandexcludesoutward to their subjects;coversinward from a workload to its policies.Subjects aren't rows, so the only effect is that their chips come back. I didn't add the workloads a changed policy covers: they aren't needed to read the policy's row, and they'd fill the Changes scope with unchanged workloads.
deployment-review, Changes scope (the egress-audit row):Tests. Two unit tests narrow a comparison exactly as the shell does (
changesScope, then the context, thenscopedModelwith whole parts), and check that every chip matches the full view:Each fails without the fix. In the workbench, "no workloads" appeared in
deployment-reviewandmonitor-modebefore the fix, and in no scenario after it.Other renderers. Database, graph, dependency injection and file packing draw relationships as links between items, not as text inside a row. A missing endpoint drops a link but doesn't make a row misread. Database key rows name only their own table's columns. So I found no other renderer with this gap;
apibelongs to the Changes work.