Skip to content

API contract polish: declare 400 responses + structured planner warnings #209

Closed

Description

@CameronBrooks11

Two small contract improvements surfaced during the #193 GUI-consume-client review:

  1. Declare the custom 400 in the OpenAPI spec. /validate and /plan map semantic errors (e.g. out-of-range wind angle) to HTTP 400 via the exception handler, but only 200/422 are declared in the spec. The GUI client depends on the 400 at runtime; adding responses={400: ...} to the FastAPI routes makes the contract explicit and lets the OpenAPI drift gate cover it.

  2. Structured planner warnings on /plan. The GUI preview used to show planner warnings scraped from CLI stderr; the API exposes none, so the preview now shows no warnings (noted in CHANGELOG / refactor(gui): consume the API client; replace event streaming with polling #193). Add a structured warnings: list[str] to the planner result and PlanResultOut so the preview can surface them again.

Both are additive (non-breaking) and tie off the local-API architecture epic (#195).

Activity

  1. added
    enhancement
    python
    on Jun 26, 2026
  2. CameronBrooks11 commented on Jun 26, 2026

    @CameronBrooks11
    MemberAuthor

    Investigation update from PR for the 400 half: the structured planner warnings part is being dropped as unnecessary. The planner emits no non-fatal warnings — every advisory check (circuit divisibility, lockDegrees alignment, lead-in bounds) raises LayerValidationError (→ 400), and grep finds no warnings.warn/LOGGER.warning anywhere in core. The GUI's old preview 'warnings' were scraped CLI stderr (error text on failure / logging noise), so #193's empty warnings list is not a regression. Genuine advisory warnings would be a new feature (deciding what to warn vs. reject) — open a fresh issue if wanted. The 400-declaration (the actionable part) is delivered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions