Repository navigation
feat(agent-config): agent config API client, configure permission and review helpers [9/21] - #330
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
e479df4 to
5747965
Compare
5747965 to
9607c2d
Compare
9607c2d to
d7054a8
Compare
d7054a8 to
fb9f246
Compare
gusfcarvalho
left a comment
There was a problem hiding this comment.
ccf-review: would REQUEST_CHANGES
Submitted as COMMENT: GitHub does not let a PR's author request changes on or approve it.
1 Must-fix.
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
| ); | ||
| return saveResult(res); | ||
| }), | ||
| listInstances: (agentId) => |
There was a problem hiding this comment.
[Must-fix] Follow the API's bounded instance list (companion of api#476)
Reviewer decision on compliance-framework/api#476: the instance list is paginated before merge. GET /api/admin/agents/{id}/instances today returns every instance with its full summary columns (warnings, unsafe, plugins, remote-config). That can exceed 1 GiB for one agent, and listInstances loads it in full whenever an agent is opened.
New API contract (being implemented on api#476/#483):
- query
page(default 1) andlimit(default 25, max 25);dataholds that page's instance summaries, same order as today (last seen first); meta:desired-revision,counts(still over all instances: total, fresh, stale, in-sync, out-of-sync, pending, rejected, failed, unknown), pluspage,limit,total,total-pages;GET …/instances/{instanceId}is unchanged.
Why: The API change breaks this client's assumption that the list carries full per-instance lists; landing one side without the other breaks the Configuration tab.
Fix: What the UI needs to do (this PR and the ones above it in the stack):
- feat(agent-config): agent config API client, configure permission and review helpers [9/21] #330
useAgentConfigApi.ts:listInstances(agentId, { page, limit })sends the query and returns{ items, meta }with the new meta fields. UpdateInstancesMeta/InstancesListinapi-types.tsand theuseAgentConfigApi.spec.tscases (query params, meta shape). - Fleet-wide numbers come from
meta.counts, not from the loaded rows:summarizeSyncand the instance count (useAgentConfig.ts,AgentConfigTab.vueinstance-count). - Code that needs every instance: field access (
field-access.ts, which uses each instance'sremoteConfigandplugins), the warnings aggregation inuseConfigWorkspace.ts, and the save-preview instance list. Load all pages through one helper (for examplelistAllInstances: sequential pages untilpage === total-pages) with a hard cap on pages. Past the cap, show that the view covers only part of the fleet; do not silently compute over a partial set. - The instance picker (
AgentConfigTab.vue,v-if="state.instances.value.length > 1") pages through the list instead of rendering every row. - Update fixtures, the integration specs (test(agents): integration specs for the Configuration tab [21/21] #342) and the conformance or field-access tests that build instance lists.
Merge only together with api#476/#483; landing either side alone breaks the Configuration tab.
Severity basis: no rule matched; decision tree: wrong behaviour or missing companion change.
ccf-review · 4142df644d96 · rules@992d25d050e9
fb9f246 to
b1748b6
Compare
… review helpers Layer 9 of 21 in the stacked split of #318. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- listInstances sends ?page&limit (default 1 and 25, the API's max) and returns one page with its meta (page, limit, total, totalPages and the fleet-wide counts) - listAllInstances (instancePages.ts) is the one way to load every instance: pages in order until the last one, at most MAX_INSTANCE_PAGES (4 pages = 100 instances; a worst-case summary is about 3 MiB), each instance once. Past the cap, or when the list moved while paging, the result is marked partial Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hen it moved listAllInstances marks the result partial when it stops at the page cap, or when a row comes back twice (the list moved under the pages, so another row was skipped), instead of comparing the rows with counts.total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b1748b6 to
17842c8
Compare
Part 9 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 reviewableon its own. Nothing is reachable in the app until layer 20 wires the Configuration tab in.What
The agent-config API client (
useAgentConfigApi) on the axios layer, ajsonBodyrequest transform that sends overlay keys verbatim (no camel/kebab conversion), theagent:configurepermission action,usePermissions().loaded, and the review-row helpers used by the workspace and save preview.Tests
Specs for the API client and the axios transform.
🤖 Generated with Claude Code