Skip to content

chore: refresh OpenAPI spec + managedBy on RG/SP/AlertChannel#33

Merged
caballeto merged 1 commit intomainfrom
chore/spec-sync-managedby-currentstatus
May 6, 2026
Merged

chore: refresh OpenAPI spec + managedBy on RG/SP/AlertChannel#33
caballeto merged 1 commit intomainfrom
chore/spec-sync-managedby-currentstatus

Conversation

@caballeto
Copy link
Copy Markdown
Contributor

Summary

After mono#369 merged and dispatched spec_updated, the CLI's spec-check (and downstream npm test) ran red because:

  1. The bundled spec was stale — missing managedBy on Create* / Update* DTOs for ResourceGroup, StatusPage, and AlertChannel (added for attribution parity with Monitor); missing currentStatus on MonitorDto.
  2. The field-parity audit (test/yaml/spec-field-parity.test.ts) saw the new managedBy API field with no entry in API_ONLY_FIELDS for those three resource families and failed the audit.
  3. test/commands/monitors-test-config.test.ts deliberately omitted managedBy to trigger a Zod error; that field is now optional (server defaults to API / surface-injected value), so the assertion expect(out).toContain('managedBy') no longer matched the actual error.

This PR fixes the immediate spec-check breakage and the v0.7.0 resource-groups list bug that started this whole sprint (strict Zod was rejecting the production API's new managedBy response field).

Changes

  • Refresh docs/openapi/monitoring-api.json from the live mono spec.
  • Regenerate src/lib/api.generated.ts, api-zod.generated.ts, spec-facts.generated.ts, descriptions.generated.ts, and the skill field references.
  • Inject managedBy: 'CLI' in YAML transforms for AlertChannel, ResourceGroup, and StatusPage so resources created via devhelm apply get correct attribution. Mirrors the existing Monitor transform pattern; the snapshot diffs already exclude managedBy so we don't fight the dashboard on subsequent updates.
  • Add managedBy to API_ONLY_FIELDS for alertChannel, resourceGroup, and statusPage in the field-parity test — the CLI sets it internally and YAML users must not author it.
  • Pivot the malformed-config test fixture to omit the still-required name field so we keep a stable, typed Zod error path.

Why managedBy on those three resources is API-only (not YAML)

managedBy is a provenance signal owned by the surface, not declarative state authored by the user. If a YAML config drops the field, the CLI should still stamp CLI; if the user explicitly wrote managedBy: TERRAFORM we would want to reject it because YAML files belong to the CLI. Marking it API-only enforces that contract.

Test plan

  • regen all generated artefacts; in sync
  • npm test → 998/998 pass (was 994/998 before)
  • npm run lint clean
  • npm run typecheck clean
  • npm run build succeeds
  • After merge: cut v0.7.1 to fix v0.7.0 resource-groups list bug + ship currentStatus + correct managedBy attribution.

Made with Cursor

mono#369 added `managedBy` to Create/Update Request DTOs for
ResourceGroup, StatusPage, and AlertChannel (it was already on Monitor),
and added `currentStatus` to MonitorDto. After the spec_updated dispatch
post-merge, the bundled CLI spec was stale and several spec-check tests
broke.

Changes:

* Refresh `docs/openapi/monitoring-api.json` from the live mono spec.
* Regenerate `src/lib/api.generated.ts`, `api-zod.generated.ts`,
  `spec-facts.generated.ts`, and `descriptions.generated.ts`; refresh
  the generated skill field references.
* Inject `managedBy: 'CLI'` in the YAML transforms for AlertChannel,
  ResourceGroup, and StatusPage so resources created via `devhelm apply`
  get correct attribution. Mirrors the existing Monitor transform.
* Add `managedBy` to `API_ONLY_FIELDS` for alertChannel, resourceGroup,
  and statusPage in the field-parity test — the CLI sets it internally,
  it is not a YAML-authored field.
* Update `monitors test --config` malformed-config test: the previous
  bad fixture relied on `managedBy` being a required field, which it no
  longer is. Pivot to omitting the still-required `name` field so the
  Zod parse still produces a stable, typed validation error.

This unblocks the spec-check workflow on `main` and clears the way for
v0.7.1, which also fixes the v0.7.0 `resource-groups list` bug
(strict Zod schema rejected the now-present `managedBy` response field).

Co-authored-by: Cursor <cursoragent@cursor.com>
@caballeto caballeto merged commit 19d6c65 into main May 6, 2026
3 checks passed
@caballeto caballeto deleted the chore/spec-sync-managedby-currentstatus branch May 6, 2026 14:08
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.

1 participant