feat(router): self-documenting 501 body for placeholder modules (PMS-125) #63

Merged
nrupard merged 4 commits from feat/pms-125-stub-bodies into main 2026-06-04 19:20:16 +02:00
Owner

Summary

  • Replace the generic Not implemented yet JSON envelope for the remaining mounted placeholder (/api/v1/dispatch) with a per-module body that names the module, links the tracking issue (PMS-58 for dispatch), and lists the planned endpoint shape.
  • Refactor the stub helper into module_stub_routes(StubModule) so future placeholders only need to declare a StubModule literal; the new {*rest} wildcard makes sub-paths (e.g. /api/v1/dispatch/board) return the same 501 payload instead of falling through to a 404.
  • Pin the contract with tests/dispatch_stub.rs (root and sub-path cases) and add the test binary to the CI integration-tests step.

Test plan

  • CI: cargo fmt --all --check
  • CI: cargo clippy --all-targets -- -D warnings
  • CI: cargo check --all-targets
  • CI: cargo test --test dispatch_stub (new) plus the existing test suite
  • Manual: http get http://($env.MOKOSH_HOST_BIND_IP):($env.MOKOSH_PORT)/api/v1/dispatch returns 501 with module, tracking_issue, tracking_url, planned_endpoints

Closes PMS-125.

## Summary - Replace the generic `Not implemented yet` JSON envelope for the remaining mounted placeholder (`/api/v1/dispatch`) with a per-module body that names the module, links the tracking issue (PMS-58 for dispatch), and lists the planned endpoint shape. - Refactor the stub helper into `module_stub_routes(StubModule)` so future placeholders only need to declare a `StubModule` literal; the new `{*rest}` wildcard makes sub-paths (e.g. `/api/v1/dispatch/board`) return the same 501 payload instead of falling through to a 404. - Pin the contract with `tests/dispatch_stub.rs` (root and sub-path cases) and add the test binary to the CI integration-tests step. ## Test plan - [ ] CI: `cargo fmt --all --check` - [ ] CI: `cargo clippy --all-targets -- -D warnings` - [ ] CI: `cargo check --all-targets` - [ ] CI: `cargo test --test dispatch_stub` (new) plus the existing test suite - [ ] Manual: `http get http://($env.MOKOSH_HOST_BIND_IP):($env.MOKOSH_PORT)/api/v1/dispatch` returns 501 with `module`, `tracking_issue`, `tracking_url`, `planned_endpoints` Closes PMS-125.
feat(router): self-documenting 501 body for placeholder modules (PMS-125)
Some checks failed
Check / fmt + clippy + compile + tests (pull_request) Failing after 10s
Build OCI container / Build and push mokosh-api image (push) Successful in 2m59s
f42131858c
Replace the generic `Not implemented yet` JSON envelope (F12) with a per-module body that names the module slug, links the YouTrack issue tracking the implementation, and lists the planned endpoint shape. An integrator hitting `/api/v1/dispatch` (the one remaining mounted placeholder) now sees the calendar story key (PMS-58), a one-line summary, and the planned dispatch-view endpoint without having to grep the source tree.

The new `module_stub_routes(StubModule)` helper mounts `/` plus a `{*rest}` wildcard so sub-paths under the placeholder also return the same payload instead of falling through to a 404. Adds `tests/dispatch_stub.rs` (two `#[sqlx::test]` cases pinning the root and a sub-path response) and wires the test binary into the CI integration-tests step so the contract cannot silently regress.

#PMS-125
style: reflow long lines for rustfmt in PMS-125 stub
Some checks failed
Check / fmt + clippy + compile + tests (pull_request) Failing after 16s
Build OCI container / Build and push mokosh-api image (push) Successful in 6m0s
0940a9d97f
Multi-line string continuations on the `dispatch` `StubModule` literal so the `summary` and planned-endpoint summary do not exceed the 100-column line limit, and tighten the test file's `assert!` macro layouts to the single-line form that rustfmt prefers when the call fits in width.

#PMS-125
style: rewrap assert! to satisfy rustfmt in dispatch_stub test
Some checks failed
Check / fmt + clippy + compile + tests (pull_request) Failing after 20s
d8ae8afc3d
#PMS-125
style: allow dead_code on common::{seed_admin,login} for unauthenticated test binaries
All checks were successful
Check / fmt + clippy + compile + tests (pull_request) Successful in 3m12s
Create release / Create release from merged PR (pull_request) Has been skipped
d5044c0a8a
The `tests/dispatch_stub.rs` binary added in PMS-125 only exercises the unauthenticated stub handler, so it pulls in `tests/common/mod.rs` without calling `seed_admin` or `login`. Each integration-test binary compiles its own copy of `common::`, and clippy's per-binary dead-code analysis fires on the helpers in that binary. Annotate both with `#[allow(dead_code)]` (same pattern as the existing `DEFAULT_TENANT_ID` constant and `TestApp::pool` field).

#PMS-125
nrupard deleted branch feat/pms-125-stub-bodies 2026-06-04 19:20:16 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!63
No description provided.