Sitemap: operator-seeded shards, listed in the index while their blob exists - #1591
Conversation
… exists A shard an operator writes straight into Redis (blob under the shard key, optional lastmod beside it) is served by the public route and listed in the index by the generator for as long as the key exists; removing the key retires it on the next run. The generator never writes it and never stamps it with its own time. First use: a temporary recovery list of posts that still carry the noindex the removed blacklist gate left in the index, so they get recrawled without waiting for a chance revisit.
Code Review by Qodo
1.
|
|
Warning Review limit reached
Next review available in: 22 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoSitemap: include operator-seeded shards in index while Redis blob exists
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5fc86c1c77
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export type SitemapShard = (typeof SITEMAP_SHARDS)[number] | (typeof OPERATOR_SHARDS)[number]; | ||
|
|
||
| const SHARD_SET: ReadonlySet<string> = new Set(SITEMAP_SHARDS); | ||
| const SHARD_SET: ReadonlySet<string> = new Set<string>([...SITEMAP_SHARDS, ...OPERATOR_SHARDS]); |
There was a problem hiding this comment.
Stop treating deleted operator shards as permanently live
When the operator deletes seo:sitemap:recovery.xml, the next generation removes it from the index, but this permanent inclusion in SHARD_SET means the public shard route still considers it known; its missing Redis blob therefore takes the unavailable() path in app/sitemap/[shard]/route.ts and returns 503 forever rather than 404. Crawlers that retained the old URL will consequently keep retrying a shard that was meant to be retired, so operator shards need a way to stop being treated as live after removal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Fixed in 253d252: isOperatorShard() and the shard route now answers 404 (no Retry-After) for an operator shard whose blob is gone, while a generated shard that is merely not in Redis yet keeps the transient 503. The generator drops the entry from the index on its next run; a crawler holding the old index gets a clean "gone" in the meantime. New shard-route spec covers the three states.
Greptile SummaryThis PR adds support for temporary, operator-seeded sitemap shards whose Redis blob controls whether they appear in the sitemap index and remain publicly routable.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/web/src/app/api/internal/seo/sitemap-generate/route.ts | Extends index generation to include non-empty operator-managed shards while leaving their blobs and timestamps under operator control. |
| apps/web/src/app/sitemap/[shard]/route.ts | Distinguishes retired operator shards from temporarily unavailable generated shards by returning 404 instead of 503. |
| apps/web/src/features/seo/sitemap-shards.ts | Introduces the operator-shard allowlist and incorporates it into public shard validation. |
| apps/web/src/specs/api/sitemap-generate-route.spec.ts | Covers operator-shard inclusion, supplied lastmod preservation, and removal for empty or deleted blobs. |
| apps/web/src/specs/api/sitemap-shard-route.spec.ts | Covers generated, unknown, seeded operator, and retired operator shard response semantics. |
| apps/web/src/specs/features/seo/sitemap-shards.spec.ts | Verifies operator shards are publicly known without entering the generated shard set. |
Sequence Diagram
sequenceDiagram
participant O as Operator
participant R as Redis
participant G as Sitemap generator
participant I as Sitemap index
participant C as Crawler
O->>R: Seed recovery.xml and optional lastmod
G->>R: STRLEN recovery.xml
alt Blob is non-empty
R-->>G: Positive length
G->>R: Read operator lastmod
G->>I: Include recovery.xml
C->>R: GET /sitemap/recovery.xml
R-->>C: 200 XML
else Blob is absent or empty
R-->>G: Zero length
G->>I: Omit recovery.xml
C->>R: GET /sitemap/recovery.xml
R-->>C: 404 Not Found
end
Reviews (4): Last reviewed commit: "Merge develop and make index and route a..." | Re-trigger Greptile
An operator shard exists only through its blob, so a missing blob means the operator retired it, not that it is pending. Returning the transient 503 there would keep crawlers retrying a shard that was meant to be gone.
Code Review by Qodo
1.
|
…s present only with a non-empty blob Resolves the accessor conflict with the merged Redis warm-up change: the shard route keeps getSeoRedisReady() and gains isOperatorShard(). The generator now decides presence with STRLEN, the same rule the public route applies, so the index never advertises a shard URL that answers 404.
Closes #1590
What changed
sitemap-shards.ts:OPERATOR_SHARDS(recovery.xml), known to the public shard route but not part of the generated set.sitemap-generate/route.ts: after the generated shards, each operator shard whose blob exists in Redis is added to the sitemap index with the lastmod stored beside it (or the previously recorded one); the generator never writes the blob and never stamps it with the run's time. Removing the key retires the shard on the next run.Operation (outside the repo): the recovery list is seeded per origin under
seo:sitemap:recovery.xmlwithseo:sitemap:recovery.xml:lastmodset to the day the blacklist gate was removed; it is deleted once Search Console shows the affected pages recrawled.