Skip to content

Runtime policy: the Changes scope keeps what a changed row's chips name - #83

Merged
agorischek merged 3 commits into
mainfrom
agorischek/rp-changes-context
Nov 21, 2026
Merged

agorischek merged 3 commits into
mainfrom
agorischek/rp-changes-context

Conversation

@agorischek

@agorischek agorischek commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.ts as runtimePolicyContext, also follows:

  • applies-to, matches and excludes outward to their subjects;
  • covers inward 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):

egress-audit in the Changes scope, light: before reads "no workloads", after reads "pods in namespace checkout"
The same, dark

Tests. Two unit tests narrow a comparison exactly as the shell does (changesScope, then the context, then scopedModel with whole parts), and check that every chip matches the full view:

  • a policy whose rule changes but whose scope doesn't;
  • a workload whose covering policies don't change.

Each fails without the fix. In the workbench, "no workloads" appeared in deployment-review and monitor-mode before 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; api belongs to the Changes work.

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 runtimePolicyContext and 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
@agorischek
agorischek merged commit d865b04 into main Nov 21, 2026
37 checks passed
@agorischek
agorischek deleted the agorischek/rp-changes-context branch November 21, 2026 04:04
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.

2 participants