Skip to content

Roll sports with no subsection row back into Sports - #199

Merged
ssavutu merged 1 commit into
mainfrom
fix/sports-subsection-rollup
Aug 6, 2026
Merged

Roll sports with no subsection row back into Sports#199
ssavutu merged 1 commit into
mainfrom
fix/sports-subsection-rollup

Conversation

@ssavutu

@ssavutu ssavutu commented Aug 6, 2026

Copy link
Copy Markdown
Member

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 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 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 sports row, 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_aliases is NULL in 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

ReportOrphanedArticles warns in the direction that actually loses content. countArticlesForSlugs already 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

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>
@ssavutu
ssavutu merged commit d5d80d5 into main Aug 6, 2026
6 checks passed
@ssavutu
ssavutu deleted the fix/sports-subsection-rollup branch August 6, 2026 23:37
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