Skip to content

[Bug] Design list/get/export ignore SQLite-stored designs; README overstates SQLite as source of truth #7

Description

@sjohnston1972

Part of the "SQLite migration is half-done" parent issue. Do this last — after the build/journal sub-issues.

Background

The /design endpoints and the design list/export helpers still read the flat-file store, while orchestrator + legacy-imported designs live in SQLite section_designs.

Problem / Goal

  • backend/app/api/design.py calls list_designs, get_design, delete_design from app.agents.loop — all flat-file (loop.py:43, 92, 100).
  • Legacy-imported designs (legacy_import.py writes them to section_designs as section_name="FULL") and orchestrator designs are therefore invisible on GET /api/design/list and cannot be exported via /design/{id}/export.html|docx.
  • The README claims SQLite covers "section designs" as the source of truth, which does not match these endpoints.

Goal: make the design read/list/export paths surface SQLite-stored designs, and correct the README so its persistence claims are accurate.

Where to look

  • backend/app/api/design.py:79-142/list, /{id}, delete, export.html, export.docx.
  • backend/app/agents/loop.py:43-111 — flat-file list_designs, get_design, delete_design.
  • backend/app/db/models.py:82SectionDesign (record, legacy_id, final_verdict, etc.).
  • backend/app/export/render.pyto_html / to_docx consume the design record dict; confirm the SQLite record is the same shape (it is — legacy_import.py copies it verbatim).
  • README.md — persistence section + "Files of interest".

Suggested approach

  1. Point list_designs/get_design/delete_design (or new DB-backed equivalents used by api/design.py) at section_designs. A design "id" becomes the SectionDesign.id; record is the payload the renderers already expect.
  2. Keep the /design/list response fields the same (summary, decisions, citations, composition, outstanding_flaws) — they're all derivable from record["iterations"][-1].
  3. Export endpoints just need get_design to return the SQLite record.
  4. Update README.md so the persistence claims (source of truth, journal in SQLite) are true after the whole parent lands.

Acceptance criteria

  • GET /api/design/list includes orchestrator-run and legacy-imported designs.
  • GET /api/design/{id} and the HTML/DOCX exports work for a SQLite-stored design.
  • README's persistence statements match the code.

Testing

Local backend. Import a legacy design (or produce one via a run), then:

  • GET /api/design/list shows it.
  • GET /api/design/{id}/export.html returns a self-contained HTML doc.
    Add a unit test that a SectionDesign.record round-trips through export_render.to_html without error.

Out of scope

  • Any change to the record JSON shape.
  • Deduping the (now overlapping) legacy flat-file /designs directory — it can remain unused on disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions