Skip to content

fix(types): handle CurrentStatus enum suffix shift after MonitorDto.currentStatus addition#26

Merged
caballeto merged 2 commits into
mainfrom
fix/spec-refresh-current-status-rename
May 6, 2026
Merged

fix(types): handle CurrentStatus enum suffix shift after MonitorDto.currentStatus addition#26
caballeto merged 2 commits into
mainfrom
fix/spec-refresh-current-status-rename

Conversation

@caballeto
Copy link
Copy Markdown
Contributor

Summary

Unblocks mono#369 launch sprint. When mono v0.13.0 adds
`MonitorDto.currentStatus`, datamodel-code-generator's iteration order
shifts the inline enum suffixes:

Before After
`CurrentStatus` → ResultSummaryDto `CurrentStatus` → MonitorDto + ResultSummaryDto (deduped)
`CurrentStatus1` → StatusPageComponentDto `CurrentStatus2` → StatusPageComponentDto

`types.py` imports `CurrentStatus1 as StatusPageComponentCurrentStatus`
which fails to resolve after regen. Fix the alias and add a comment
documenting the suffix-stability hazard.

Changes

  • Refresh `docs/openapi/monitoring-api.json` from mono v0.13.0
  • Regenerate `_generated.py` (lock-step with the new spec — adds
    `MonitorDto.currentStatus` field as Optional)
  • Update `types.py` import: `CurrentStatus1` → `CurrentStatus2`
  • Add a comment block warning that adding another inline `currentStatus`
    field can shift suffixes again

Why now

mono#369 Spec Evolution Harness regenerates sdk-python (and mcp-server,
which depends on it) against the new spec and fails to import. 16
sdk-python tests + 11 mcp-server tests gated on this.

Test plan

  • `uv run python -c "from devhelm.types import MonitorCurrentStatus, StatusPageComponentCurrentStatus"` — clean
  • `uv run ruff check src/devhelm/types.py` — clean
  • `uv run mypy src/devhelm/types.py` — clean
  • sdk-python CI green
  • re-run mono#369 Spec Evolution Harness → green

Made with Cursor

caballeto and others added 2 commits May 6, 2026 15:31
…dds currentStatus

mono v0.13.0 adds `MonitorDto.currentStatus`. datamodel-code-generator
names inline enums by iteration order, so the existing inline
StatusPageComponentDto.currentStatus enum shifts from CurrentStatus1 to
CurrentStatus2 (MonitorDto + ResultSummaryDto share CurrentStatus —
deduped because their value sets are identical).

Update the type alias in `types.py` to match the new generator output
and re-pin _generated.py + spec to mono v0.13.0. Adds a comment
explaining the suffix-stability hazard so future authors don't repeat
this lesson the hard way.

Caught by mono#369's Spec Evolution Harness — 16 sdk-python tests +
11 mcp-server tests (which depends on sdk-python) failed to import.

Co-authored-by: Cursor <cursoragent@cursor.com>
The previous test asserted managedBy was required. mono v0.13 made it
optional with a server-side default of API, so SDK consumers can omit
it. Replace the negative test with a positive assertion that omitting
it parses cleanly with managed_by == None.

Co-authored-by: Cursor <cursoragent@cursor.com>
@caballeto caballeto merged commit 6fda8ac into main May 6, 2026
4 checks passed
@caballeto caballeto deleted the fix/spec-refresh-current-status-rename branch May 6, 2026 13:36
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