Skip to content

Phase 4: API - #15

Merged
withrvr merged 1 commit into
claude/erp-collection-reporting-workflow-iycqtofrom
phase/04-api
Aug 31, 2026
Merged

withrvr merged 1 commit into
claude/erp-collection-reporting-workflow-iycqtofrom
phase/04-api

Conversation

@withrvr

@withrvr withrvr commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Phase 4: API

What this adds

Six routers under /api/v1/collections: runs (POST upload+execute, GET list, GET detail), overdue, exceptions (rule_code/severity filters), regions, summary, run-log/{id}/events. Pydantic response schemas (api/schemas.py). No auth.

Assessment requirement served

MASTER_PLAN.md Phase 4 done-when: "a reviewer can drive the whole flow from /docs." `POST /run never returns 500 for a bad input file"* — verified: a corrupt-file upload returns 200 with a FAILED run body.

Docs updated

  • README.md - [x] ARCHITECTURE.md - [x] API.md
  • RULES.md (no rule changes) - [x] DEVELOPMENT.md - [x] CHANGELOG.md

Verification

uv run pytest app/collections/tests -v   # 132 passed (122 -> 132)
uv run mypy app/collections/api app/collections/tests/api   # clean

Known gaps carried to next phase

  • summary endpoint has no gate/blocked payload yet -- Phase 5.
  • mappings.py still a stub -- Phase 10 (multi-workbook).

A reviewer can now drive the whole flow from /docs: upload a workbook,
watch it become a Run, read its overdue/exceptions/regions/summary,
and see exactly why it failed if it did.

- api/schemas.py: Pydantic response models, separate from models.py's
  SQLModel tables.
- api/deps.py: get_run_or_404, shared by every report endpoint.
- POST /collections/runs/: upload + synchronous execute_run. Always
  200 with a Run -- a bad file produces a FAILED run in the body,
  never a 500.
- GET /collections/runs/, /runs/{id}, /overdue/, /exceptions/
  (rule_code/severity filters), /regions/, /summary/,
  /run-log/{id}/events.
- No auth: this is an internal ops tool, not a multi-tenant product,
  and nothing in MASTER_PLAN.md asks for one.
- summary.py returns the numeric summary + region breakdown now;
  Phase 5 layers the control gate on the same response.

Refs: docs/API.md, docs/ARCHITECTURE.md
@withrvr
withrvr merged commit a3237c7 into claude/erp-collection-reporting-workflow-iycqto Aug 31, 2026
3 of 7 checks passed
@withrvr
withrvr deleted the phase/04-api branch August 31, 2026 19:02
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