Document that hydration already prioritizes newest articles (AI)

No functional change — hydrateArticles() already processes stubs in
their existing array order, and discoverArticles() already sorts
that array newest-first by the authoritative date field, so search
results (and page hydration) already fill in newest-first. Adds a
comment making this explicit, since it's a non-obvious "free"
property of the sort order rather than something the code visibly
does on purpose.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXSVPS3UmmASiiprPfcnUd
This commit is contained in:
biosiasandClaude Sonnet 5 committed 2026-09-11 21:02:30 +02:00
1 parent 36297616a5
commit 58acdbff98
1 file changed
+9
+9
View File
@@ -269,6 +269,15 @@ export async function hydrateArticle(stub) {
// resolves with (resolvedCount, total) — lets a caller hydrating a much
// bigger batch (search hydrates every result, not just one page) show
// results incrementally instead of one long wait for all of them.
//
// Processing order follows `stubs`' own array order (each worker below
// just claims the next unclaimed index) — since discoverArticles() already
// returns stubs sorted newest-first by the authoritative `date` field, that
// means hydration (and thus which search results fill in first) is already
// newest-first too, for free. Unlike the indexing crawl's mtime-based
// priority order (see mtimeSortValue), no heuristic is needed here: by the
// time anything calls this, the real publish date is already known for
// every stub, so there's nothing left to guess at.
export function hydrateArticles(stubs, onProgress) {
let resolved = 0;
return mapWithConcurrency(stubs, MAX_CONCURRENT_REQUESTS, async stub => {