Skip to content

chore(api): move the slice's routes out of the /api/v1 prefix; reserve it for wire-compatible routes - #75

Merged
aRustyDev merged 2 commits into
mainfrom
chore/slice-route-prefix
Oct 23, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
chore/slice-route-prefix

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Closes #47 (FR-06).

The slice's own tenant routes move from /api/v1/workspaces/{slug}/projects/{project_id}/... to
/api/_slice/workspaces/{slug}/projects/{project_id}/..., so /api/v1 is reserved for routes that are
wire-compatible with Plane (ADR-0031) and the oracle can cover it (ADR-0122). Nothing is served under /api/v1 now;
the first routes there are #58's.

The code change is two constants (SLICE_PREFIX in thrust-api and in the black-box contract suite), because #35 and
#36 had already made every path build from one. The work is the test, the counts and the docs.

Commits (one per bead)

  1. chore(api): the prefix moves.
    • the_slice_routes_are_gone_from_the_reserved_v1_prefix requests all eight slice routes, from a table, through the
      retired prefix with a real token, slug and project. Each must be a routing 404 (told apart from a use-case 404 by
      the absence of the API's JSON error body), and the same request through the live prefix must not be one. The
      retired-prefix calls must also have had no effect (one row exists at the end).
    • scripts/contract.sh expects 21 in the main pass, scripts/stage2-contract.sh 21 (it still said 18; the count
      had been 20), and contract-suite.md carries the count measured today.
  2. docs: flows/app.md, by-change.md, an "issue chore(api): move the slice's routes out of the /api/v1 prefix; reserve it for wire-compatible routes #47" note in ADR-0034 and ADR-0032, the stale
    lib.rs:269-293 anchor in ARCHITECTURE.md, SPEC R-F7, Q-0030.2, and feat(api): /api/v1 projects, states, labels and work items with the oracle gate on those operations #58's Blocked-by column in PLAN.md.

Deviations from the issue text (owner, 2026-10-23)

The issue's criteria were amended on GitHub, because three of them could not hold as written:

  • The test path. POST /api/v1/projects/{id}/work-items has answered 404 since feat(core): user-only Principal, database-authoritative sessions, delete KvSessionStore #36 added the slug, so a test on it
    passes before the move and proves nothing. The test uses the slugged old path, which answered before the move, and
    covers all eight routes.
  • The count. The new test is a main-pass test, so EXPECT_MAIN goes from 20 to 21, not "unchanged".
  • The grep. grep -rn '"/api/v1' crates/thrust-api/src crates/thrust-contract-tests prints only
    RETIRED_SLICE_PREFIX, the one constant in the test that names the old prefix on purpose.

The issue's last bullet named #44, which supplies compat routes. #58 builds the /api/v1 work-item routes that replace
the slice's, so it owns deleting the _slice routes, moving the contract suite and retiring the new test. There is a
comment on #58 saying so.

Evidence

All local, at the PR head c9d2ff6; the second commit changes documentation only, so the runs below are from 89bef82.

Check Result
New test against the router before the move (native-memory main) 20 passed, 1 failed: the new test alone
native-memory main after the move 21 of 21
scripts/contract-all.sh 16 of 16 cells, 21 tests in each main pass, the Worker cells included
Router constant set back, contract constant left 18 of 21 fail, so a mismatch between the two constants cannot pass
scripts/mutants.sh 5 of 5 KILLED, with DOCKER_HOST set and no SocketNotFoundError in the Postgres run
cargo nextest run --workspace 208 passed
cargo test --doc --workspace 3 passed
scripts/check-deps.sh exit 0
wasm32 thrust-worker builds with default features and with --no-default-features
git grep -n '"/api/v1' -- crates/thrust-api/src crates/thrust-contract-tests only RETIRED_SLICE_PREFIX

Not verified

  • The deployed edge. /api/* in run_worker_first and the /api Access bypass (ADR-0011, ADR-0090) cover
    /api/_slice/..., but nothing in the repository configures either, so that is a reading of the plan, not a test.
    feat(worker): reject non-canonical-case /api, /auth, /live paths and run the Worker first at the Access phase #50 (M6) owns the edge tests. The ADR note says so.
  • The mdBook build could not run here (mdbook-mermaid is not installed). The edited tables were checked for
    column counts with a script that was shown to fail on a malformed table.
  • The routing-404 check tells a routing 404 from a use-case 404 by the missing JSON error body. It holds on all four
    targets today. If a target ever put a body on a routing 404 that looked like an API error, the retired-prefix half
    would fail loudly, not pass.

Heads-up for later issues

🤖 Generated with Claude Code

aRustyDev and others added 2 commits October 23, 2026 17:09
/api/v1 is reserved for routes that are wire-compatible with Plane (ADR-0031, FR-06), and the oracle
checks it (ADR-0122). The slice's own tenant routes now live under /api/_slice/workspaces/{slug}/projects/
{project_id}/...: no Plane route starts with an underscore, and the prefix stays under /api, so every
edge pattern that covers /api/* covers it. Both SLICE_PREFIX constants (thrust-api and the black-box
contract suite) change; nothing else spells the prefix, so wi_path, the matrix, the model and the bench
need no edit.

the_slice_routes_are_gone_from_the_reserved_v1_prefix requests every slice route (eight, from a table)
through the retired prefix with a real token, slug and project: each must be a routing 404, told apart
from a use-case 404 by the absence of the API's JSON error body, and the same request through the live
prefix must not be one. The calls through the retired prefix must also have had no effect (one row
exists at the end, the live create). The test uses the slugged old path, not the issue's
/api/v1/projects/{id}/work-items: that one has answered 404 since #36 added the slug, so a test on it
passes before the move and proves nothing.

Control: with the constants still at /api/v1, native-memory main ran 20 passed and 1 failed (this test
alone). After the move it runs 21 of 21, and contract-all.sh is 16 of 16 with 21 in each main pass,
the worker cells included. With only the router's constant set back, 18 of 21 fail, so a mismatch
between the two constants cannot pass. mutants.sh: 5 of 5 killed, no SocketNotFoundError.

scripts/contract.sh now expects 21 in the main pass. scripts/stage2-contract.sh went from 18 to 21: it
was already stale (the count had been 20), and evidence-and-controls.md says to change both together.
contract-suite.md carries the count measured today.

Refs: plane-byd.11.3.1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
flows/app.md: the eight route rows and the sequence diagram show /api/_slice/..., and the "Pending rename"
paragraph becomes a statement of what is true: the prefix, why it is clear of every Plane route, that it
stays under /api, that nothing is served under /api/v1 yet, which test shows it, and that #58 deletes the
routes and retires the test. Plane's real v1 URL is quoted unchanged. by-change.md says the same in its
routing bullet; its v1 row is still exactly right and stays.

ADR-0034 and ADR-0032 get an "issue #47" note in the style of the #35 and #36 notes: the prefix, that
/api/* in run_worker_first and the /api Access bypass already cover it (ADR-0011, ADR-0090; nothing in
the repository configures either, so this is a reading of the plan and says so), the test, the cleanup
owner (#58, not #44, which supplies compat routes), and the stale lib.rs:269-293 anchor, replaced by the
symbols SLICE_PREFIX and slice_path. ARCHITECTURE.md carries the same anchor and gets the same fix; SPEC
R-F7 gains the prefix; QUESTIONS Q-0030.2 notes the temporary route group; PLAN.md gives #58 the
Blocked-by column that GitHub already shows (#35 #36 #47).

The mdBook build could not run locally (mdbook-mermaid is not installed); the edited tables were checked
for column counts.

Refs: plane-byd.11.3.2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 83c5646 into main Oct 23, 2026
26 checks passed
@aRustyDev
aRustyDev deleted the chore/slice-route-prefix branch October 23, 2026 21:17
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.

chore(api): move the slice's routes out of the /api/v1 prefix; reserve it for wire-compatible routes

1 participant