Skip to content

/templates endpoint + test_api_templates.py: real bug fixed, aspirational catalog needs a contract decision #79

Description

@izzywdev

Surfaced while getting test-backend green (#72). Two things were tangled in tests/test_api_templates.py (11 failures):

REAL BUG — now fixed in #72: main_with_hierarchy.py called template_manager.get_all_templates(), which does not exist (the method is list_templates()), so the /templates endpoint has always returned 500 in production. Renamed to list_templates().

ASPIRATIONAL — quarantined pending a decision: even with the endpoint fixed, test_api_templates.py asserts a contract that was never built:

  • a config-nested response shape, while AgentTemplate.to_dict() ships a flat shape;
  • a creative category not in the AgentCategory enum;
  • template IDs/tools (typescript_developer, react_developer, ui_ux_designer, ai_code_generation, …) not in the AGENT_TEMPLATES catalog;
  • 404 semantics for an unknown template, while get_template() raises ValueError.

These need a contract decision (the /templates response contract + the template catalog + 404 behaviour) — contract-designer defines it, backend implements it, then these tests verify it. Rubber-stamping the current incomplete endpoint would fake green; reshaping the API unilaterally would edit a contract. So the file is skipped at collection with a citation to this issue.

To close: freeze the /templates contract + catalog, implement it, then un-skip (rewrite the assertions to the frozen contract). Do not un-skip by hacking the tests to match today's incomplete endpoint.

Coverage gap while skipped: /templates has no automated test until this lands. The endpoint itself now at least returns rather than 500s.

Refs: #72.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions