koala73 / koala73/worldmonitor
Remove v1 path aliases when scenario/supply-chain bump to v2
- Dominant language
- TypeScript
- Stars
- 86.6k
- Forks
- 13.1k
- Avg merge
- 8h 4m
- Merged PRs (30d)
- 825
Description
## Background
PR #3242 (sebuf migration) renamed five documented v1 URLs because the sebuf RPC path generator derives paths from method names:
| Legacy v1 URL | New sebuf path |
|---|---|
| `POST /api/scenario/v1/run` | `/api/scenario/v1/run-scenario` |
| `GET /api/scenario/v1/status` | `/api/scenario/v1/get-scenario-status` |
| `GET /api/scenario/v1/templates` | `/api/scenario/v1/list-scenario-templates` |
| `GET /api/supply-chain/v1/country-products` | `/api/supply-chain/v1/get-country-products` |
| `GET /api/supply-chain/v1/multi-sector-cost-shock` | `/api/supply-chain/v1/get-multi-sector-cost-shock` |
To preserve the wire contract, #3242 added thin URL-rewrite alias files:
- `api/scenario/v1/{run,status,templates}.ts`
- `api/supply-chain/v1/{country-products,multi-sector-cost-shock}.ts`
Each file rewrites the pathname to the new sebuf path and delegates to the domain `[rpc].ts` gateway via `server/alias-rewrite.ts`. A matching alias table lives in `vite.config.ts` (`V1_ALIASES`) for dev parity.
## What to do here
When either service bumps to v2 (i.e. the next breaking contract change):
1. Delete the 5 alias files.
2. Delete `server/alias-rewrite.ts` if nothing else consumes it.
3. Delete the `V1_ALIASES` block in `vite.config.ts`.
4. Update docs to the new-only paths.
Until then the aliases are harmless: they're pure URL rewrites, keyed on exact pathname, and premium/rate-limit/entitlement checks all fire on the canonical new path.
## Why not now
The old URLs are in `docs/api-scenarios.mdx`, `docs/panels/supply-chain.mdx`, OpenAPI specs under `docs/api/`, and possibly partner scripts. Removing them is a v1→v2 break, not a silent follow-up.
Contributor guide
Research direction
Start by confirming that scenario or supply-chain has actually bumped to v2, then inspect the five alias files under api/scenario/v1 and api/supply-chain/v1, server/alias-rewrite.ts, and V1_ALIASES in vite.config.ts. Remove the obsolete aliases and rewrite helper when unused, then update docs/api-scenarios.mdx, docs/panels/supply-chain.mdx, and the OpenAPI files so only the new paths remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- api, build-system, documentation
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100