Skip to content

feat(agent-config): policy_data model and minimal merge patches [7/21] - #328

Open
gusfcarvalho wants to merge 2 commits into
agent-config/06-instance-statusfrom
agent-config/07-policy-data
Open

gusfcarvalho wants to merge 2 commits into
agent-config/06-instance-statusfrom
agent-config/07-policy-data

Conversation

@gusfcarvalho

Copy link
Copy Markdown
Contributor

Part 7 of 21 of the stacked split of #318 (agent remote configuration). Every layer adds the final version of its files from #318, and only imports from layers below it, so each layer passes make reviewable on its own. Nothing is reachable in the app until layer 20 wires the Configuration tab in.

What

Models policy_data as a tree and records edits as minimal merge patches (key-level and list-element changes, masked-value handling). Also adds the API request/response types for the agent-config endpoints.

Tests

Unit specs for policy-data and policy-data-patch.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 5, 2026 10:52
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 1de6b95b-d911-41c7-a073-6a10f093d9ca
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Numeric literals can be silently rounded, and null-valued object members are incorrectly converted into deletions.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adds structured policy_data editing utilities, minimal merge-patch generation, and agent configuration API contracts.

Changes:

  • Adds policy-data tree parsing and mutation helpers.
  • Generates minimal RFC 7396 patches with tests.
  • Defines shared agent-config API types and errors.
File Description
src/​utils/​agent-config/​policy-data.ts Adds tree, scalar, mask, and environment-reference helpers.
src/​utils/​agent-config/​policy-data-patch.ts Builds minimal policy-data merge patches.
src/​utils/​agent-config/​__tests__/​policy-data.spec.ts Tests policy-data helpers.
src/​utils/​agent-config/​__tests__/​policy-data-patch.spec.ts Tests merge-patch behavior.
src/​composables/​agent-config/​api-types.ts Defines agent-config client contracts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +64 to +65
if (!deepEqual(before, after))
out.push({ op: 'set', ptr, value: clone(after) });
Comment thread src/utils/agent-config/policy-data.ts Outdated
Comment on lines +116 to +121
/** True when `n` survives a JSON round trip as typed: finite, and an integer only up to 2^53. */
function isStorableNumber(n: number): boolean {
return (
Number.isFinite(n) &&
!(Number.isInteger(n) && Math.abs(n) > Number.MAX_SAFE_INTEGER)
);
ianmiell
ianmiell previously approved these changes Oct 6, 2026

@ianmiell ianmiell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ccf-review: APPROVE

no findings.

Stack (gh stack 343): #322 → #323 → #324 → #325 → #326 → #327 → #328 → #329 → #330 → #331 → #332 → #333 → #334 → #335 → #336 → #337 → #338 → #339 → #340 → #341 → #342

gusfcarvalho and others added 2 commits October 6, 2026 10:28
Layer 7 of 21 in the stacked split of #318.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion

policy-data.ts reuses validation.ts isStorableNumber and exports
hasUnstorableNumber for the raw policy_data view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccf-lisa
ccf-lisa Bot force-pushed the agent-config/07-policy-data branch from a403fa1 to a1f76ff Compare October 6, 2026 13:32
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