Skip to content

canonical(frontend): replace every hand-written API response type with the generated contract #20867

Open

Description

@mrveiss

Parent: #12363

Problem

Both GUIs declare backend response shapes by hand instead of importing the generated contract (src/types/generated/api.ts). A hand-written type drifts from the backend without the compiler noticing, which is the class behind dead buttons, wrong fields and dates read from fields that no longer exist (#20865).

Maintainer decision 2026-11-05: "find wherever handwritten api types are present and replace with generated", at the highest priority.

Target set (measured on main at da88b6c, with the detectors of repo_tests/frontend_api_contract_ratchet_test.py)

App interface *Response inline api.get<…> generics files
autobot-frontend 186 in 76 files 534 in 157 files 194
autobot-slm-frontend 33 in 10 files 87 in 20 files 28

Boundary: non-test .ts and .vue under each app's src/. Excluded: generated/ and _generated/, and tests.

Plan

  1. Classify every site (read-only): (a) a generated type exists, so replace now; (b) the backend route has no response_model, so the generated type is missing or unknown; (c) not a backend response at all.
  2. Replace (a) in PRs of at most 100 files, grouped by feature area. Each PR lowers responses and inline_generics in the ratchet in the same commit.
  3. Fix (b) at the source: give the backend route its response_model, regenerate, then replace the call site. Never re-declare the type by hand.
  4. SLM GUI the same way, after the main GUI.

Acceptance criteria

  • responses and inline_generics reach 0 in both apps in frontend_api_contract_ratchet_test.py, each lowered in the PR that did the work.
  • Every backend route a GUI reads declares a response_model, and the generated api.ts carries a named type for it.
  • No GUI declares a type for a backend response; the guard forbids new ones (already true) and the population is empty.
  • vue-tsc passes in both apps with no new suppressions.

Activity

  1. mrveiss commented on Nov 6, 2026

    @mrveiss
    OwnerAuthor

    Maintainer direction (2026-11-06): this work goes hand in hand with the unconnected-code gate (#20512, landed on main with PR #20538). The gate's frozen baseline (repo_tests/unconnected_code_baseline.txt) lists ~844 backend routes with no caller, all linked to the umbrella #10603. When a frontend call site moves onto the generated contract, each route it now reaches through the generated client must be removed from that baseline in the same PR (the gate's test_every_baseline_entry_is_still_unconnected fails otherwise), and a route that turns out to have no real caller is either wired in or recorded with its own issue. Conversely, a frontend call to a route that does not exist in the generated contract is a defect, not a hand-written type to keep. Measure both in each PR: baseline route entries removed, hand-written types removed.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions