feat: add IaCM provider registry create and version update - #811
feat: add IaCM provider registry create and version update#811anushk-singhal wants to merge 5 commits into
Conversation
4644380 to
8354bf5
Compare
Expose account-scoped iacm_provider operations over existing IaCM APIs.
Create maps type to the path segment; update is version-oriented (POST/PUT
/providers/{id}/version) because there is no metadata PUT endpoint.
Co-authored-by: Cursor <cursoragent@cursor.com>
IaCM provider-registry version create/update returns 201 with no body. Agents previously saw a false 502; accept empty successful responses. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Document version-oriented update semantics, empty 2xx success bodies, and Experimental iac_providerregistry_* RBAC. Add mock-fetch, elicitation, and MCP tool wiring coverage aligned with module/variable-set patterns. Co-authored-by: Cursor <cursoragent@cursor.com>
Cross-repo audit against iac-server OpenAPI: providers have no scope_*
params (account-only by design, unlike modules), create returns { id }
only, and version writes return empty 201. Document the create → get →
version-update flow, reject org/project resource_scope, and add
regressions that ambient org/project never leak onto provider URLs.
Co-authored-by: Cursor <cursoragent@cursor.com>
8354bf5 to
6340d7b
Compare
Review summarySolid addition — this follows the declarative registry pattern well and is clearly aligned with the IaCM OpenAPI contract (account-only scope, What looks good
Non-blocking suggestions (left inline)
CI is green on my check. Nice work on the cross-repo audit notes in the resource description — that should save agents a lot of confusion. |
|
|
||
| // ─── Workspace Costs ─────────────────────────────────────────────────── | ||
| { | ||
| resourceType: "iacm_workspace_costs", |
There was a problem hiding this comment.
Nice version-oriented update modeling. One optional gap: there's a dispatch/validation test for iacm_module create when system is missing — consider a sibling test that iacm_provider update without body.version (and without params.version) throws before hitting the network. That would lock in the providerVersionBody error path the same way module create locks in name/system.
| }); | ||
|
|
||
| it("elicits confirmation for iacm_provider medium_write create", async () => { | ||
| mockRequest = vi.fn().mockResolvedValue({ |
There was a problem hiding this comment.
Minor fidelity nit: the real create API returns { id } only (documented throughout this PR). The mock and assertion both include type: "aws", which could drift from the contract agents will see in production.
Suggest aligning to:
mockRequest = vi.fn().mockResolvedValue({ id: "1" });
// ...
expect(JSON.parse(result.content[0]!.text)).toEqual({ id: "1" });| const text = await response.text(); | ||
| // Empty body on 2xx is a valid success (204 No Content; also 201 from | ||
| // IaCM provider-registry create/update version, which returns no JSON). | ||
| if (!text) { |
There was a problem hiding this comment.
Global behavior change (non-blocking): this now normalizes any empty 2xx to { status: "SUCCESS", message: "No content" }, not just 204. That's the right fix for IaCM provider version writes, but it does mean an unexpected empty 200 from another service will no longer surface as a 502.
Consider keeping a log.debug when taking this branch (path + status) so we can spot regressions in production logs. Also worth extending the unit test to cover empty 200 and 204 explicitly now that the dedicated 204 branch was removed — behavior should stay identical for DELETE/PATCH callers.
|
Thanks for the review — all three notes are non-blocking:
|
Summary
iacm_providerlist/get/create and version-oriented update via the declarative registry.POST /iacm/api/providers/{type}—body.typeis the path segment; optionaldescriptionin JSON. Response is{ id }only — follow up withharness_get/harness_list./providers/{id}/versionto create a version, or PUT/providers/{id}/version/{version}whenparams.versionis set. Required:protocol+gpg_key_id(+body.versionwhen creating). Empty 201/204 bodies normalize to{ status: "SUCCESS", message: "No content" }via HarnessClient.scope_org/scope_project, unlikeiacm_module). Ambientorg_id/project_idare ignored;resource_scope=org|projectis rejected.iac_providerregistry_*).Coverage
{ id }, empty version bodies, ambient org/project leak regression), tool handlers, elicitation, HarnessClient empty-2xx.Test plan
pnpm typecheckpnpm test(130 files, 2868 passing)pnpm build && pnpm docs:generateMade with Cursor