feat(api): legacy laddr URL redirects (closes #78)#93
Merged
Conversation
Five redirect patterns + a 410 carve-out per behaviors/legacy-id-mapping.md → "Legacy URL forms we accept". Without this, every external bookmark / Google-indexed result / Slack-shared link to the old laddr URL shape 404s at flip-time. Plan covers two new in-memory indices (projectIdByLegacyId, buzzIdBySlug), the onRequest hook pattern-matching the 5 shapes + the 2 deferred-page 410 targets, and tests. Companion to #80 (slug-history redirect) — that one handles renames within the new site; this one handles inbound legacy URLs from the old one. Closes #78. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two new in-memory maps powering the legacy-redirect plugin:
- projectIdByLegacyId: Map<number, string>
Populated by indexProject when record.legacyId is set.
Lookup for /projects?ID=<n> and /project-updates?ProjectID=<n>.
- buzzIdBySlug: Map<string, string>
Populated by indexProjectBuzz (buzz slugs are globally unique per
data-model.md#projectbuzz). Lookup for /project-buzz/<slug>.
indexProjectBuzz now mirrors indexProject + indexPerson — reads the old
record before re-indexing so a buzz slug change doesn't leak a stale
buzzIdBySlug entry. The corresponding StateApply.removeProject and
removeProjectBuzz ops clean up the new indices too.
People don't need a legacy-id index because /people/:username → /members/:slug
is a static prefix rewrite (laddr's Username was copied verbatim into
slug per behaviors/slug-handles.md#migration-from-laddr).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
onRequest hook catching the URL shapes the old codeforphilly.org site served and 301ing them to canonical equivalents per specs/behaviors/legacy-id-mapping.md: /projects?ID=<n> → /projects/<slug> /people/:username[/...] → /members/:username[/...] /project-updates?ProjectID=<n> → /projects/<slug> /project-buzz/<slug>[/...] → /projects/<projectSlug>/buzz/<slug>[/...] /tags/<namespace>.<slug>[/...] → /tags/<namespace>/<slug>[/...] Plus 410 Gone with a minimal HTML explanation for /checkin and /bigscreen — explicitly-deferred features per specs/deferred.md. Cache-Control: max-age=86400 (24h) — legacy URL shapes are permanent. Companion to slug-redirect (renames within the new site); the two hooks pattern-match disjoint URL shapes and coexist without coordination. Both bypass /api/* and register before static-web's SPA fallthrough. 19 new test cases cover all five patterns + 410s + the /api/* bypass + unknown-legacyId pass-through + sub-route + query-string preservation. 274/274 API tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closeout: flip to done, tick all validations (19 new tests + 274/274 API tests, lint + type-check clean), fill Notes (removeProject / removeProjectBuzz needed legacy-index cleanup too; indexProjectBuzz gained an upsert-on-replace lookup; 24h Cache-Control for permanent redirects; unknown legacyIds pass through rather than 410) + Follow-ups (polished 410 page, more 410 targets, cutover smoke). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five 301 redirect patterns + two 410 carve-outs covering `specs/behaviors/legacy-id-mapping.md` → "Legacy URL forms we accept". Without this, every external bookmark / Google-indexed result / Slack-shared link to the old laddr URL shape 404s at flip-time.
What's new
Unknown legacy-IDs and unknown buzz slugs fall through to the SPA rather than 410 — we don't claim "this used to exist" for inputs we can't verify.
Test plan
Closes #78.
🤖 Generated with Claude Code