Skip to content

Add schema DELETE/update API with gRPC parity, frontend controls, and full test coverage - #37

Merged
DeltaRule merged 2 commits into
mainfrom
copilot/adjust-api-for-schema-management
Mar 15, 2026
Merged

Add schema DELETE/update API with gRPC parity, frontend controls, and full test coverage#37
DeltaRule merged 2 commits into
mainfrom
copilot/adjust-api-for-schema-management

Conversation

Copilot AI commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Schema templates were read/write-only — there was no way to delete a schema or update it through a documented, tested path. This adds DELETE /schema/{id} alongside PUT update semantics, gRPC equivalents, frontend controls, and complete documentation.

Backend

  • pkg/schemaDeleteTemplate(schemaID): removes file from disk, evicts cache entry. Introduces ErrSchemaNotFound sentinel so callers use errors.Is() instead of string matching.

  • DELETE /schema/{schemaID} — requires write permission; returns 404 for missing schemas, 400 for invalid IDs (path-traversal safe).

  • gRPC Process handler — three new operation strings routed before entity ops:

    operation Equivalent REST
    SCHEMA_GET GET /schema/{id}
    SCHEMA_PUT PUT /schema/{id}
    SCHEMA_DELETE DELETE /schema/{id}

Frontend

  • Templates list: each row gets a 🗑 delete button inline.
  • Editor panel: Delete button beside Save; clears editor and refreshes list on success.
  • Inline styles replaced with .schema-list-row / .schema-list-btn CSS classes.

API Spec & Docs

  • api/openapi.yaml: full DELETE /schema/{schemaID} path with 200/401/403/404.
  • docs/usage/api-reference.md: delete endpoint docs + gRPC schema operations table with Go examples.
  • docs/usage/schemas.md: new Updating and Deleting sections covering REST, Web UI, and gRPC.
  • README.md: DELETE /schema/{schemaID} reference with curl example.

Tests

  • TestDeleteTemplate (6 sub-tests): disk/cache removal, not-found, empty ID, path traversal, list exclusion, validate-after-delete.
  • TestHandleSchemaDelete (7 sub-tests): auth, success, 404-after-delete, not-found, read-only forbidden, path traversal, list exclusion.
  • TestProcessSchemaOperations (6 sub-tests): full gRPC round-trip for all three schema ops.
  • 7 new pytest integration tests covering the same surface via live server.

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: DeltaRule <83079740+DeltaRule@users.noreply.github.com>
Copilot AI changed the title [WIP] Update API to enable delete and update of schema Add schema DELETE/update API with gRPC parity, frontend controls, and full test coverage Mar 15, 2026
Copilot AI requested a review from DeltaRule March 15, 2026 15:10
@DeltaRule
DeltaRule marked this pull request as ready for review March 15, 2026 15:11
@DeltaRule
DeltaRule merged commit 0008d80 into main Mar 15, 2026
2 checks passed
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.

2 participants