Skip to content

Drop the "by-" a WordPress login leaves on an author slug - #63

Open
ssavutu wants to merge 1 commit into
mainfrom
fix/author-login-by-prefix
Open

Drop the "by-" a WordPress login leaves on an author slug#63
ssavutu wants to merge 1 commit into
mainfrom
fix/author-login-by-prefix

Conversation

@ssavutu

@ssavutu ssavutu commented Aug 8, 2026

Copy link
Copy Markdown
Member

Latent until the next reseed. The live 404s this describes are fixed on the site side in Scalene#88, which needs no reseed. This is the root-cause half.

The defect

A few WordPress accounts were registered with the byline text as the login, so the slug built from that login carries a by- the display name never had:

CMS slug display name
by-nayab-iqbal Nayab Iqbal
by-lena-tran Lena Tran
by-jack-davis Jack Davis
by-anum-hassan Anum Hassan

The name is right, so nothing looks wrong on the page — but the author's URL is /author/by-nayab-iqbal while every link and every indexed URL says /author/nayab-iqbal, which 404s.

_AUTHOR_CLEAN_PATTERN already strips this from names. It can't be reused on a slug: it also strips digits, which would rewrite the numeric suffix dedupe_slug adds to break collisions. Hence a separate anchored, dash-terminated pattern. canonicalize_slug has already collapsed the separator by that point, so "By Nayab Iqbal" and "by_nayab_iqbal" both arrive as by-nayab-iqbal, while a surname like Byrne arrives as byrne and is left alone.

What this does not fix

This is one shape of a larger defect: the slug is derived from the login at all. Same root cause, not covered here:

  • rkeating — abbreviated login. Ryan Keating has 59 articles and his page was unreachable from every URL that names him.
  • stefan-kusmirek-dev-thetriangle-org — email as login.
  • sanjana-bandi-2 — WordPress's duplicate-account suffix, where the CMS holds only sanjana-bandi.

Preferring display_name over login would fix the class outright, but it rewrites slugs for all 875 authors and invalidates the URLs that currently work. That wants its own decision rather than riding along here.

Tests

tests/test_author_login_slugs.py — the prefix, the separator spellings, the surname that must survive, the display-name fallback, and the collision stripping can create (jack-davis + by-jack-davis).

Ran 6 tests — OK

Note: tests.test_article_author_links and tests.test_conflict_cache fail on this branch, but they also fail on clean main — unrelated and pre-existing.

🤖 Generated with Claude Code

A few accounts were registered with the byline text as the login, so the slug
built from that login carries a "by-" the display name never had: the CMS holds
by-nayab-iqbal, by-lena-tran, by-jack-davis and by-anum-hassan while their
display names are correct and every link says /author/nayab-iqbal.

_AUTHOR_CLEAN_PATTERN already strips this from names. It cannot be reused on a
slug -- it also strips digits, which would rewrite the numeric suffix
dedupe_slug adds to break collisions -- so this is a separate anchored,
dash-terminated pattern. canonicalize_slug has already collapsed the separator
by then, so "By Nayab Iqbal" and "by_nayab_iqbal" both arrive as
"by-nayab-iqbal", while a surname like Byrne arrives as "byrne" and is left
alone.

Note this only takes effect on the next reseed, and it only covers this one
shape. It does not touch the larger defect it is a symptom of: the slug comes
from the login at all, so an abbreviated login gives Ryan Keating the slug
"rkeating" and an email-style login gives Stefan Kusmirek
"stefan-kusmirek-dev-thetriangle-org". Preferring the display name would fix
that class outright but rewrites slugs for all 875 authors, so it wants its own
decision rather than riding along here.

tests/test_author_login_slugs.py covers the prefix, the separator spellings,
the surname that must survive, the display-name fallback, and the collision
that stripping can create.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant