Skip to content

refactor(api): delete the slice's work-item create, list, search and delete routes - #159

Merged
aRustyDev merged 1 commit into
mainfrom
refactor/delete-slice-work-item-routes
Nov 14, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
refactor/delete-slice-work-item-routes

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Summary

Step 5c-2 of moving off /api/_slice: delete the slice's four work-item routes. Work items are made, listed, searched and deleted through /api/v1 and Plane's compat routes, and since #155 (the slice model rebuilt on /api/v1) no test calls the slice's four except the walk that shows the routes left the reserved prefix. Under the owner's decision of 2026-11-11 a slice route with a replacement goes, and the ones without stay under /api/_slice.

What goes

  • POST and GET .../work-items, GET .../work-items/search and DELETE .../work-items/{id}: their four handlers and the two query types in thrust-api.
  • The contract suite's helpers for them: create, create_ok, list, search, search_path. wi_path stays, as the base of the activity and attachment routes.
  • The four entries of slice_routes(), the table that the_slice_routes_are_gone_from_the_reserved_v1_prefix walks (nine tenant routes become five), and the POST arm that only the deleted create used.

One assertion goes with its route

The last check of that test, "the retired-prefix calls had no effect", read the slice's list and expected the one item that the live prefix's create had made, so it cannot exist without those routes. The walk keeps its guard: every retired call is asserted a routing 404 (a 404 with no error code, so no handler ran; a handler answers with an error body or a 2xx), so a retired route that is still mounted fails on its own line, whatever state it would have changed. The commit message and a comment in the test say this.

What stays, and why

  • Sign-out-everywhere, the session info, OIDC, API keys, the activity feeds and attachments: nothing replaces them yet.
  • The core's create_work_item, delete_work_item, list_work_items and search_work_items, their port methods and the create limiter. Nothing in the routes calls them now, but the core's own model, outbox and attachment tests and the adapters' tests do, so removing them reworks those tests. That is step 5c-3, and it is more than deleting dead code (G-26 says so).

Docs

  • docs/src/flows/app.md: the three route rows go (search was never in the table); a note says where work items are served now; the "Creating a work item" section is marked as the core use case that only tests call; the errors table no longer says a slice route raises the create limit's 429 (the 409 example is now the operator's create of an account whose email is taken, which still can); the walking test's counts are corrected (five tenant routes and seven identity routes; the page said eight and ten).
  • G-26 in docs/src/testing/status.md records the deletion and updates its "Not done" clause.

Verification

On native-memory: main 70 of 70, sweeper 3 of 3, csrfoff 6 of 6 (no test is added or removed); cargo clippy --workspace --all-targets -- -D warnings and cargo fmt --all --check clean. Main has not moved since this branch was cut (9b8ebe7), so nothing was merged.

Control: with GET /work-items put back in the route table, the walking test fails (69 of 70) at "not mounted (404)", so the table is held. The change was temporary and is reverted.

Not run locally: native-pg, worker-memory and worker-cf (they run in CI), and the passes outside main, sweeper and csrfoff.

Part of #58; this PR does not close it.

🤖 Generated with Claude Code

…delete routes

Step 5c-2 of moving off /api/_slice. Work items are made, listed, searched and deleted through /api/v1 and Plane's compat routes, and since #155 no test calls the slice's four routes for that except the walk that shows the routes left the reserved prefix. Under the owner's decision of 2026-11-11 a slice route with a replacement goes.

Deleted: POST and GET .../work-items, GET .../work-items/search and DELETE .../work-items/{id}; their four handlers and the two query types in thrust-api; the contract suite's helpers for them (create, create_ok, list, search, search_path). wi_path stays: it is the base of the activity and attachment routes, which no Plane route replaces. The four leave slice_routes(), the table that the_slice_routes_are_gone_from_the_reserved_v1_prefix walks (nine tenant routes became five).

One assertion went with its route and is not replaced: the last check of that test, "the retired-prefix calls had no effect", read the slice's list and expected the one item that the live prefix's create had made, so it cannot exist without those routes. The walk keeps its guard: every retired call is asserted a routing 404 (a 404 with no error code, so no handler ran; a handler answers with an error body or a 2xx), so a retired route that is still mounted fails on its own line whatever state it would have changed. The test's POST arm, which only the deleted create used, goes too.

What stays, and why: the core's create_work_item, delete_work_item, list_work_items and search_work_items, their port methods and the create limiter. Nothing in the routes calls them now, but the core's own model, outbox and attachment tests and the adapters' tests do, so removing them reworks those tests: that is step 5c-3 and more than dead code. G-26 and the flows page say so.

Docs: flows/app.md loses the three route rows (search was never in the table), notes where work items are served now, marks the "Creating a work item" section as the core use case that only tests call, corrects the errors table (no slice route raises the create limit's 429 any more; the 409 example is the operator's create of an account whose email is taken, which still can) and the route counts of the walking test (five tenant routes and seven identity routes, were "eight" and "ten"). G-26 records the deletion and updates its "Not done" clause.

No test is added or removed. Checked on native-memory: main 70 of 70, sweeper 3 of 3, csrfoff 6 of 6, clippy clean on the workspace and rustfmt clean. Control: with GET /work-items put back in the table, the walking test fails (69 of 70) at "not mounted (404)", so the table is held. The other three targets run in CI.

Refs: #58
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 7625192 into main Nov 14, 2026
35 checks passed
@aRustyDev
aRustyDev deleted the refactor/delete-slice-work-item-routes branch November 14, 2026 06:19
aRustyDev added a commit that referenced this pull request Nov 14, 2026
…routes called (#161)

Step 5c-3a of moving off /api/_slice. The owner split step 5c-3 into three PRs, one each: the core (this), then the adapters, then the create limiter. Since #159 nothing in the routes calls the core's slice work-item use-cases, and `/api/v1` and the compat plane make, read and delete work items through `create_issue`, `list_issues` and `delete_issue`.

Deleted in thrust-core: `create_work_item`, `delete_work_item`, `list_work_items`, `search_work_items`, their constants `SEARCH_LIMIT` and `SEARCH_QUERY_MAX`, and the two permissions only they used (`DeleteWorkItem`, `ReadDeleted`, with their rows in the role table). Deleted in thrust-contracts: `CreateWorkItemRequest`, the wire type of the deleted create route. `validate_name`, `relay_after_commit` and `event` stay: the issue use-cases use them.

One passing test file is deleted, on purpose and under AGENTS rule 3: tests/model.rs (`model_work_items_match_the_reference_model` and its coverage control). Its subject was the deleted functions (validation first, who may list, who may list the deleted rows), so unlike the slice model of #155 it has no vehicle to keep. What it wrote down for work items is `tests/v1_model/` over HTTP and the core's tests of the v1 use-cases. That the deletion loses no kill was measured, not assumed: with `cargo nextest run -p thrust-core --no-fail-fast`, the planted `mutant_ignore_tenant` still fails 40 core tests (`another_tenants_project_is_not_found` and `the_slug_decides_which_workspace_a_project_is_looked_up_in` among them) and `mutant_dup_sequence` fails 3 (the generated `prop_work_items_are_numbered_and_placed_one_after_another` and two `issues_v1` tests).

Changed, not deleted: the outbox and attachment tests keep their subjects (the relay, ADR-0080) and make their work items with `v1_issue_writer`, `create_issue` and `delete_issue`, as `/api/v1` does; their assertions are unchanged except that an id is read from `item.item.id`. `authorize_follows_the_role_table` loses the two removed permissions' rows, and `another_tenants_project_is_not_found` probes `WriteState` where it probed `ReadDeleted`, so it keeps its three cases.

Docs: flows/app.md describes creating and deleting a work item as `create_issue` and `delete_issue` do (the request layer is Plane's; the old section described the deleted function and its limiter); contributing/patterns.md cites those instead; model-based.md, evidence-and-controls.md, defect-matrix.md, mutation.md and G-11 and G-26 in status.md stop naming the deleted model and say where its properties live.

Checked: `cargo nextest run -p thrust-core` 1569 of 1569; native-memory main 70 of 70, sweeper 3 of 3, csrfoff 6 of 6 (no contract test is added or removed); clippy and rustfmt clean on the workspace. Controls: a temporary change that let `put_attachment` accept a soft-deleted item failed `an_attachment_needs_a_live_work_item` alone (9 of 10 attachment tests pass); inverting the fast-path guard in `relay_after_commit` failed 5 of 6 outbox tests. Both reverted. The other three targets run in CI.

Refs: #58

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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