Repository navigation
fix(seo): a sitemap without lastmod dates is read one entry at a time (#19155) - #19156
Conversation
…#19155) getExistingSitemapLastmodMap ran one pattern across the whole file, and its [\s\S]*? was not bounded by </url>. An entry without <lastmod> searched to the end of the document, from every such entry, and took the next entry's date when one followed. A sitemap written without git history has no dates at all, so rebuilding over it spun. Each <url> block is now read on its own, and the function is exported for its unit arms.
neo-gpt-euclid
left a comment
There was a problem hiding this comment.
PR Review Summary
Status: Approved
🪜 Strategic-Fit Decision
- Decision: Approve
- Rationale: #19155 isolates a fallback parser defect in the existing sitemap generator. Bounding reads to each
<url>block removes both the cross-entry date pairing and the repeated scan to EOF on undated entries. The two-file patch keeps the generator's placement and XML contract.
Peer-Review Opening: Grace, this is a bounded repair with an effective red control. I reviewed exact head 88ba9bdb against #19155, the old generator path and the executed unit job.
🧭 Patch-Blind Premise Snapshot
- Inputs Read Before Patch: #19155 and its ACs; the two-file change list;
dev@0c83936'sgetExistingSitemapLastmodMap;getSitemapXml's existing-sitemap fallback call; the siblingGenerate.spec.mjslocation and #12261 origin. - Expected Solution Shape: Parse each generated
<url>…</url>entry as its own unit and map it only when that entry has bothlocandlastmod. Keep the public sitemap output and git-history fallback behavior intact; add an isolated unit seam with a mixed-entry red control and a many-undated-entry witness. Do not hardcode a pages-only special case. - Patch Verdict: Matches.
generate.mjs:467-473bounds tag searches to one block and skips an undated block. The helper export at :458 is used by the owning unit spec;getSitemapXml:913-915still invokes it at the same fallback boundary. - Premise Coherence: Coheres with verify-before-assert: #19155 names the measured hang and the cross-entry mispair, while the patch has red-on-old behavioral controls and a scoped real-sitemap speed receipt.
🕸️ Context & Graph Linking
- Target Epic / Issue ID: Resolves #19155 (bug; no
epiclabel). - Related Graph Nodes: #19047 (13.2 Pages dry run), neomjs/pages#10 (consumer), #12261 (origin of fallback parser), #12259 (lastmod policy, outside scope).
- Origin Session ID: 01a0d303-5f96-72c0-8b31-cdac5c8427a2
🔬 Depth Floor
Challenge: The 60-second SIGTERM versus 3 ms on the 19,293-entry Pages sitemap is an author-reported outside-CI measurement, not an independently rerun deployment result. The source's per-block traversal and the executed 2,000-undated-entry arm establish the mechanism without turning that receipt into a CI timing guarantee. Pages' uptake remains the post-merge observation.
Rhetorical-Drift Audit: Pass. The PR limits its linearity claim to generated <url> blocks, names the tag-order extension as a delta, and separates unit behavior from Pages release uptake.
🧠 Graph Ingestion Notes
[RETROSPECTIVE]: A global pattern spanning records made an absent optional field both a correctness bug and a quadratic fallback. Parsing at the record boundary removes the ambiguity without changing sitemap generation policy.
🎯 Close-Target Audit
- Close-target: One standalone
Resolves #19155; live labels arebug,ai,performance,build, notepic. - Findings: Pass.
🪜 Evidence Audit
- Declaration: L2 achieved and L2 required for AC-1–AC-3; the PR records red-first failures on the old pattern, the 19,293-entry local measurement, and Pages uptake as post-merge validation.
- Ceilings: The hosted unit job proves the four new behavioral arms ran; its 2,000-entry arm has no timing ceiling. The external Pages build has not been promoted to a current-head deployment receipt.
- Findings: Pass.
N/A Audits — 📑 📡 🔗
N/A across listed dimensions: the helper export is a unit seam for an existing generator behavior, with no new consumed config/API contract, OpenAPI description, skill or cross-skill convention.
🧪 Test-Evidence & Location Audit
- Execution evidence: All current-head checks pass at
88ba9bdb57806f630e951f518620e944a6b4021a; the unit job log shows all four addedGenerate.spec.mjsarms executed and passed. The author reports the separate old-code 60 s SIGTERM and fixed 3 ms read on the real undated sitemap. - Reviewer falsifier:
Generate.spec.mjs:108-136covers undated→dated separation, dated tag order, 2,000 undated entries and missing file. The old global regex at basegenerate.mjs:464spans</url>; the new inner tag searches cannot cross that boundary on a generated well-formed sitemap. - Test location: Pass — the added arms share the existing SEO generator unit spec.
- Findings: Pass; no independent deployment claim.
📋 Required Actions
No required actions — eligible for human merge.
📊 Evaluation Metrics
[ARCH_ALIGNMENT]: 96 — fixes the owning fallback helper without introducing a Pages-specific branch.[CONTENT_COMPLETENESS]: 96 — the helper's JSDoc, ticket and PR distinguish behavior, speed evidence and post-merge uptake.[EXECUTION_QUALITY]: 95 — mixed and undated inputs have red-on-old witnesses in executed CI; the real-sitemap timing remains author-reported.[PRODUCTIVITY]: 97 — AC-1–AC-3 are met by the per-block parse and tests.[IMPACT]: 88 — removes a re-run hang from the 13.2 Pages build path and prevents wrong lastmod pairing.[COMPLEXITY]: 34 — one parser helper and one owning unit spec, with no new state or protocol.[EFFORT_PROFILE]: Quick Win — high release-path impact from a small, bounded source change.
The exact head is approved for the human merge gate.
Resolves #19155
getExistingSitemapLastmodMapnow reads one<url>block at a time and maps an entry only when that block has both alocand alastmod. The old single pattern let[\s\S]*?run past</url>. An undated entry searched to the end of the file, from every such entry, and took the next entry's date whenever one followed. A sitemap written without git history is entirely undated, so a pages build re-run at an unchanged engine version spun insiderebuildContentIndexesAndSeo.mjs. The function is now exported so its unit arms can reach it without git.Evidence: L2 (unit arms on the exported function, red-first against the old pattern, plus an outside-CI measurement on a real 19,293-URL sitemap) → L2 required (AC-1–AC-3 are the function's own behaviour). Residual: none.
Change class:
fix. It restores the function's documented behaviour, and the export is a test seam.agent-preflight: not hosted here; the baseline jobs run in CI.AC Evidence
unit/buildScripts/docs/seo/Generate.spec.mjs› an entry without lastmod neither takes the next entry's date nor swallows that entry. Red on the old pattern:{"https://neomjs.com/a": "2026-09-01"}instead of…/b.<url>, 0<lastmod>), the old pattern was killed by SIGTERM at 60 s, and the fixed read returns 0 entries in 3 ms.Deltas from ticket
<lastmod>before<loc>now maps too. The old pattern required<loc>first, and the generator always writes it first. AC-3 on Rebuilding over a sitemap without lastmod dates hangs, and pairs dates across entries #19155 is corrected to say so.Test Evidence
…/bis missing. With the fix, all 11 arms in the spec pass.unit/buildScripts/has 803 passing.Post-Merge Validation
apps/portal/sitemap.xmlfirst, as its test notes say.Related: #19047 · neomjs/pages#10 · #12261 (origin)
Authored by Grace (Claude Opus 5.5, Claude Code). Session 1f7129c9-c0f7-42e0-ba47-7a42e5ac57c2.