Skip to content

feat(gateway,admin-ui): corpus create/delete admin CRUD (Step 3.10)#189

Merged
officialCodeWork merged 1 commit into
mainfrom
build/phase-3/step-3.10-corpus-admin-crud
Jun 11, 2026
Merged

feat(gateway,admin-ui): corpus create/delete admin CRUD (Step 3.10)#189
officialCodeWork merged 1 commit into
mainfrom
build/phase-3/step-3.10-corpus-admin-crud

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Problem

Creating a corpus from the admin console triggered no API call — the New corpus button only mutated React state, and the gateway had no write route at all (POST /v1/corpora405). So corpora "created" in the UI never persisted and vanished on refresh. Same for delete (local filter) and edit (no-op).

This is the Step 3.10 admin write surface the CorpusStore SPI + corpus router docstrings always anticipated ("Create / delete are operator actions tied to the admin surface, Step 3.10").

Change (vertical slice)

Layer What
SPI CorpusStore gains tenant-scoped create / delete — same cross-tenant invisibility rule as get (tenant A can neither see nor delete tenant B's corpus). Implemented in NoopCorpusStore + PgCorpusStore (new DELETE … RETURNING; create reuses the tested upsert path).
Wire type CreateCorpusRequest — body carries only display/embedding fields; id is server-minted (corpus_…) and tenant_id comes from the authenticated request, so a caller can't choose an id or write into another tenant.
Gateway POST /v1/corpora (201) + DELETE /v1/corpora/{id} (204 / 404). Mirrors the webhook write surface; emits corpus.created / corpus.deleted.
Admin UI createCorpus / deleteCorpus client; the Corpora page calls them when live and keeps local behaviour in demo mode (same GATEWAY_URL && source === "live" gate as the Webhooks page).

Corpus update (PATCH) stays deferred — the console edits no corpus fields yet; the Edit row action remains a placeholder.

Verification (CI is billing-blocked → verified locally)

  • Live lifecycle against a running gateway: POST201 (server-minted id, tenant_id from auth) → GET lists it → DELETE204 → second DELETE404 corpus_not_found → list back to 0.
  • Tenant isolation: globex can neither GET nor DELETE acme's corpus (404).
  • Browser path: CORS preflight from http://localhost:3100200 (allows POST/DELETE + the UI's headers); real cross-origin POST201.
  • Gates: pytest (gateway incl. new test_corpora.py, contract incl. policy-coverage + SPI-signature linters, logs/event-registry, retrieval, backends, ragctl), ruff, mypy --strict (163 files), admin-ui tsc, admin-ui vitest, OpenAPI + schema drift — all green.

Documentation

  • docs/reference/gateway.md — new POST /v1/corpora + DELETE /v1/corpora/{id} sections (request table, curl, status codes) + routes table.
  • docs/architecture/gateway.md — corpus CRUD note updated (read shipped v0; create/delete in 3.10; update still deferred).
  • docs/reference/admin-ui.md — Corpora row now reflects live create/delete.
  • dist/openapi.{json,yaml} regenerated (45 paths; create_corpus / delete_corpus operations).

🤖 Generated with Claude Code

Corpus management in the admin console was local-only: the "New corpus"
button mutated React state and never called the gateway, and the gateway
had no write route (POST /v1/corpora returned 405). This wires it end to end.

- CorpusStore SPI: add tenant-scoped create / delete (NoopCorpusStore +
  PgCorpusStore), with the same cross-tenant invisibility rule as get.
- Gateway: POST /v1/corpora (201, server-minted id, tenant from ctx) and
  DELETE /v1/corpora/{id} (204/404). New CreateCorpusRequest wire type.
- Admin UI: createCorpus / deleteCorpus client + Corpora page calls them
  when live, keeps local behaviour in demo mode (mirrors the Webhooks page).
- Tests: gateway routes (test_corpora.py), SPI conformance, Pg integration.
- Docs + regenerated dist/openapi.{json,yaml}.

Verified locally (CI billing-blocked): full create -> list -> delete -> 404
lifecycle + tenant isolation + CORS preflight/POST from :3100; ruff,
mypy --strict, pytest, admin-ui tsc + vitest all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit 0235ae6 into main Jun 11, 2026
13 of 23 checks passed
officialCodeWork pushed a commit that referenced this pull request Jun 11, 2026
Recently-shipped bullet + PR & Branch History row + Status note for the
first post-GA V1.1 feature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
officialCodeWork added a commit that referenced this pull request Jun 12, 2026
…-corpus-admin-crud

docs(tracker): record Step 3.10 corpus admin CRUD (#189)
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