Let editors pick the story that leads the homepage - #206
Merged
Conversation
The article schema has carried is_featured (the legacy `priority` column) since the WordPress import, but nothing ever set it and nothing ever read it: the ETL hardcodes it false on every row, no query orders by it, and Scalene has never referenced it on any branch. Editors asking how to set a featured article were right that there was no way to. Featured now means what the newsroom means by it: the big centre card at the top of the homepage, which Scalene renders from news[0]. The article is spliced into the news block rather than sorted into the news query, because the featured story may be filed under any section -- a featured sports story still takes the lead card, which a news-scoped ORDER BY could never do. It keeps its place in its own section block, the way a lead story does in print; only the news block dedupes, so featuring a news story promotes it instead of printing it twice. Featuring is exclusive on all three write paths. The homepage has one lead card, and leaving the previous pick flagged would let the tiebreak, rather than the editor, decide which story runs. The clear happens after the target write succeeds, so a failed save leaves the old lead standing instead of leaving the homepage with none. Drafts, scheduled and archived rows are skipped when resolving the lead: the flag alone must not be able to put an unpublished headline on the front page. The homepage response also states its freshness for the first time (60s, plus stale-while-revalidate). Without a Cache-Control header every intermediary applies its own heuristic, so an editor swapping the lead had no bound at all on when readers would see it. Also unpins TestTaxonomyAliasSeedAndCacheRoundTrip from a literal alias list. It asserted entertainment held exactly ["Arts & Entertainment"] and that news had no aliases, both of which c0f2ae9 invalidated when it filed the remaining orphaned categories. It now derives expectations from defaultCategoryAliases, so filing more categories cannot fail it, and checks the HTML-escaping regression explicitly rather than through a comparison that shares a marshaller with the code under test. Co-Authored-By: Claude Opus 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
is_featured(the legacyprioritycolumn) has been in the article schema since the WordPress import, but it has never done anything. The ETL hardcodes itfalseon every row, no query orders by it, and Scalene has never referenced it on any branch. Editors asking how to set a featured article were right that there was no way to — the flag was inert end to end. All 43 articles on the live homepage currently carryis_featured: false.Per the newsroom, featured means: the big centre card at the top of the homepage, which Scalene renders from
news[0]in its3-6-3layout.What it does
ORDER BYcould never do. The block is re-trimmed to 13 so it doesn't outgrow the layout.No Scalene changes are required for this to work — sorting happens server-side and
news[0]is already the lead card. The companion Scalene PR is only about cache freshness.Cache freshness
/v1/homepagenow statespublic, max-age=60, stale-while-revalidate=300. It previously sent noCache-Controlat all, so every intermediary applied its own heuristic and an editor swapping the lead had no bound on when readers would see it. 60s is short enough that a change shows on the next reload;stale-while-revalidatekeeps that cheap under load.Drive-by
TestTaxonomyAliasSeedAndCacheRoundTripwas failing onmain. It pinnedentertainmentto exactly["Arts & Entertainment"]and expectednewsto have no aliases — both invalidated by c0f2ae9 filing the remaining orphaned categories. It now derives expectations fromdefaultCategoryAliases(so filing more categories can't fail it), moves the no-defaults case offnewsto a guarded slug, and checks the HTML-escaping regression explicitly instead of via a comparison that shares a marshaller with the code under test.Testing
news[0]became it (is_featured: true, category Sports), block still 13, previous lead demoted tonews[1], no duplication — then reverted and confirmed the original lead returned.tscclean.🤖 Generated with Claude Code