chore(api): remove 4.13 grace-period shims — v1 root paths + /api/upgrade 410s (closes #4117)#4189
chore(api): remove 4.13 grace-period shims — v1 root paths + /api/upgrade 410s (closes #4117)#4189Yeraze wants to merge 1 commit into
Conversation
…rade 410s
Removes the two deprecation shims that shipped in 4.13 with a documented
one-release grace period (docs + blog promised removal in 4.14).
Part 1 — v1 root-path API shim:
- Delete deprecatedShim.ts (the `deprecationShim` middleware that stamped the
`Warning: 299` header) and its test.
- Remove the legacy root mounts in v1/index.ts (`/api/v1/{nodes,messages,
channels,telemetry,traceroutes,packets,network,status}` + root
position-history). These paths now 404.
- Simplify the `getScopedSourceId` helpers (nodes/channels/telemetry/
traceroutes/messages/network/packets/positionHistory + inline status) to read
the `:sourceId` path param only — the `?sourceId=` / body fallbacks existed
solely to serve the removed root mounts.
- Canonical `/api/v1/sources/{sourceId}/...` mounts, `attachSource`, the
`default` alias, and the global `/solar` + `/channel-database` endpoints are
unchanged.
- Convert the associated legacy-shape tests (v1-api, messages.search,
messages.permissions) to the per-source shape; add explicit 404 assertions
for the removed root paths and a canonical-shape smoke test.
- openapi.yaml: drop the deprecated `/nodes` root path block and the
`Warning: 299` framing.
Part 2 — /api/upgrade/* 410 FEATURE_RETIRED endpoints:
- Delete upgradeRoutes.ts (the 410 stubs from #4108) and its server mount.
These paths now 404 like any unknown route; the test asserts 404 (not 410).
Docs updated to past tense (removed in 4.14); the historical blog post is left
as-is. Docs build (vitepress) is green.
Closes #4117
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018e4dtLyWeYJYJ7SbgFvGG1
|
Claude finished @Yeraze's task —— View job PR Review: chore(api): remove 4.13 grace-period shimsTasks
Overall AssessmentThis is a clean, well-scoped removal PR. The diff is net-negative (−211 lines), the intent is clear, and the approach is sound. A few observations below, ranging from blocking to informational. Issues Worth Addressing1. Duplicate test in
2.
void getScopedSourceId(req);The call is discarded to silence a lint warning, with a TODO referencing 3.
const sourceNodes = (await databaseService.nodes.getAllNodes(sourceId ?? ALL_SOURCES)) as unknown as DbNode[];
const node = sourceNodes.find(n => n.nodeId === nodeId);Fetching all nodes and filtering in-process is inefficient when only one node is needed. This is pre-existing code, not introduced here, but since this file was touched it's a good opportunity to note it. If there's a Positive ObservationsGood: Good: Upgrade routes test conversion to Good: Good: The Good: Test coverage of the removal. The Good: Server typecheck and lint:ci are confirmed green. Security / PermissionsNo regressions observed. Permission checks remain in place on all retained routes. The removal of root mounts closes the surface area where a caller could bypass the per-source SummaryTwo items worth fixing before merge:
Neither is a blocker in the strictest sense, but the duplicate test is a clear bug-in-tests and should be cleaned up. The Merge timing note is well-called — this should only land once 4.14 is the active target. |
Summary
Removes the two deprecation shims that shipped in 4.13 with a documented one-release grace period. Docs and the announcement blog promised both would be removed in 4.14; this does that cleanly.
Part 1 — v1 root-path API shim (removed)
src/server/routes/v1/deprecatedShim.ts(thedeprecationShimmiddleware that stamped theWarning: 299header) and its test.v1/index.ts(/api/v1/{nodes,messages,channels,telemetry,traceroutes,packets,network,status}+ rootposition-history). These now 404.getScopedSourceIdhelpers across the sub-routers (and the inline resolver instatus.ts) to read the:sourceIdpath param only — the?sourceId=/ body fallbacks existed solely to serve the removed root mounts./api/v1/sources/{sourceId}/...mounts,attachSource, thedefaultalias, and the global/api/v1/solar+/api/v1/channel-databaseendpoints.openapi.yaml: dropped the deprecated/nodesroot path block and allWarning: 299framing.Part 2 —
/api/upgrade/*410FEATURE_RETIREDendpoints (removed)src/server/routes/upgradeRoutes.ts(the 410 stubs from feat!: retire in-app auto-upgrade, replace with update notifications #4108) and itsserver.tsmount. These paths now 404 like any unknown route (Auto-Upgrade Retirement Plan, Phase 3).Docs
REST_API.md,API_REFERENCE.md,development/api-reference.md: warning banners rewritten to past tense ("removed in 4.14 — now return 404"); migration table retained for reference.docs/api/API.mdalready marked outdated (no change). FAQ auto-upgrade stubs left (they reference the retirement, not the 410 endpoints).npm run docs:build, vitepress) is green.Tests
v1-api.test.ts,messages.search.test.ts,messages.permissions.test.ts) to the per-source shape.GET /api/v1/nodes(root) → 404,GET /api/v1/messages(root) → 404, canonical/api/v1/sources/default/nodesstill works;/api/upgrade/*→ 404 (not 410).Acceptance criteria
GET /api/v1/nodes(root shape) → 404;GET /api/v1/sources/default/nodesstill works.deprecatedShim.tsdeleted; noWarning: 299emitted anywhere (no code sets aWarningheader; remaining mentions are past-tense docs/comments + the historical blog)./api/upgrade/trigger→ 404 (not 410).npm run lint:ciexits 0.ts-overlapping-marker-spiderfier-leafletdep + the [BUG] MeshCore: Virtual Node functionality still does not work correctly #4094 fork-dependentmeshcoreCompanionCodectest) — all confirmed to fail identically on the clean baseline, and they pass in CI. My changes introduce zero new failures.Note on the
defaultaliasWhile converting tests I found a pre-existing latent issue (not introduced here, out of scope):
attachSourcenormalizesreq.params.sourceIdto the resolved source id, but Express re-derivesreq.paramsfor the mergeParams sub-router, so handlers readingreq.params.sourceId(the codebase convention, incl.actions.ts) see the raw URL literal"default"rather than the resolved id. Route resolution fordefaultstill works (returns 200); deeper DB scoping by the literal"default"is the latent bug. Kept helpers param-only per the issue's guidance; used concrete source ids where a test asserts real scoping. Flagging for a follow-up.This breaks the documented grace period if it ships in a 4.13.x release. It should only be merged once 4.14 is the active target. Do not merge before then.
🤖 Generated with Claude Code