Roll sports with no subsection row back into Sports - #199
Merged
Conversation
An editor reported men's lacrosse articles missing from the Sports section. 469 of 10,025 published articles -- 4.7% -- match no section or subsection at all: they are published and reachable by direct link and by search, but they appear on no section page. WordPress category archives roll a parent up over its child terms automatically, so /category/sports/ listed every article tagged "Men's Lacrosse" without anyone configuring it. Matching here is flat: a section finds itself plus the subsections that have a site_taxonomy row, and there is no lacrosse row anywhere in the table. Nine sports are in that position -- both lacrosses, tennis, crew, golf, softball, swimming & diving, running, athlete of the week. It read as arbitrary because 164 of the 175 lacrosse articles also carry a literal "Sports" tag and were never affected. Only the ones tagged solely with the sport went missing, so the section looked normal rather than broken. Aliases rather than subsection rows: these need to rejoin Sports, not to acquire a nav entry and a page each. They go through the same anchored patterns as every other match, so "Mark and Jair Explain Sports" -- which ends in the section's own name and is not a sports article -- stays out. ReportOrphanedArticles is the other half. countArticlesForSlugs already warns when a slug finds no articles; this warns in the direction that actually loses content, naming the count and the category sets to alias. A section that quietly omits some of its articles reads as a normal section, which is why this went unnoticed until an editor happened to miss one sport. It is diagnostic only -- which section an orphan belongs to is an editorial call -- and its failure cannot keep the server down. The remaining orphans are style (207), editorial (103), podcasts (75) and the column series, which need the desk to say where they belong. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 6, 2026
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.
Reported by Janine: men's lacrosse articles are not showing up in Sports.
What's actually wrong
469 of 10,025 published articles (4.7%) match no section or subsection at all. They're published and reachable by direct link and search, but they appear on no section page.
WordPress category archives roll a parent up over its child terms automatically, so
/category/sports/listed everything tagged "Men's Lacrosse" without anyone configuring it. Matching in the CMS is flat — a section finds itself plus the subsections that have asite_taxonomyrow — and there is no lacrosse row anywhere in the table. Nine sports are in that position: both lacrosses, tennis, crew, golf, softball, swimming & diving, running, athlete of the week.It read as arbitrary rather than as a broken section because 164 of the 175 lacrosse articles also carry a literal "Sports" tag and were never affected. Only the ones tagged solely with the sport went missing.
The fix
Aliases on the
sportsrow, not new subsection rows: these need to rejoin Sports, not to acquire a nav entry and a page each. Adding a row is still right for a sport the desk wants to feature.Aliases go through the same anchored patterns as every other match, so this does not reintroduce the substring merging that once filed every comic under Puzzles —
"Mark and Jair Explain Sports"ends in the section's own name, is not a sports article, and stays out. There's a test for exactly that.sports.category_aliasesisNULLin production, and the seed only writes where the column IS NULL, so this applies on the next restart without touching a deliberate edit.The other half
ReportOrphanedArticleswarns in the direction that actually loses content.countArticlesForSlugsalready warns when a slug finds no articles; nothing warned when an article matches no slug. A section that quietly omits some of its articles reads as a perfectly normal section, which is why this went unnoticed for months until an editor happened to miss one sport.Diagnostic only — which section an orphan belongs to is an editorial call — and its failure can't keep the server down.
Still needs the desk
The remaining orphans are editorial decisions, not mine: style (207), editorial (103), podcasts (75), plus column series like "Mark and Jair Explain Sports" (31) and "Ain't That Something with Brandon & Liz" (24). After this merges the startup WARN will name them on every boot.
Testing
go build,go vet, and the full suite pass. Three new tests: the rollup works, anchoring still holds, and no alias duplicates an existing subsection row. Expect sports to go 2148 → ~2181 on the next count rebuild.🤖 Generated with Claude Code