Repository navigation
Redirect merged author pages to the author they were merged into - #869
Merged
Merged
Conversation
/authors/<id> is rendered server-side straight from the authors table, so an author ID merged away through author_aliases (e.g. /authors/251936 into /authors/181986) returned "Page not found", although the authors API already resolves aliases. The page route now 301-redirects a merged ID to the surviving author, keeping the query string, before the organization redirect. Co-Authored-By: Claude Opus 5.5 <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.
Why
/authors/251936 shows "Page not found". It is one of the paper-less author rows deleted in #868 and aliased in
author_aliasesto /authors/181986 (Vik Paruchuri). The authors API already resolves aliases, but the server-rendered/authors/{id}page readsauthorsdirectly and never checks them.What
merged_author_id(db, author_id)helper inauthor_service.AuthorService._resolve_author_idnow uses it too.author_pagereturns a 301 redirect from a merged ID to/authors/<surviving id>, keeping the query string. This check runs before the existing redirect for authors that are organizations.Validation
uv run pytest backend/tests/test_search_discovery.py backend/tests/test_authors_api.py: 71 passed, including a new test for the alias redirect.🤖 Generated with Claude Code
Note
Low Risk
Read-only redirect and alias lookup on public discovery routes; behavior mirrors existing API resolution with no data or auth changes.
Overview
Server-rendered
/authors/{id}routes now treatauthor_aliaseslike the authors API: merged (deleted) IDs no longer 404 when they still appear in links or bookmarks.A shared
merged_author_idhelper inauthor_servicelooks up the surviving author ID;AuthorService._resolve_author_iduses it instead of duplicating the query. Onauthor_page, a 301 to/authors/<surviving id>runs before the existing org-name redirect, and query strings are preserved. Tests cover the new redirect and stubmerged_author_idwhere author routes are exercised without hitting the DB.Reviewed by Cursor Bugbot for commit 62026ae. Bugbot is set up for automated code reviews on this repo. Configure here.