Skip to content

fix: restore TOC listings for publications without revisionDesc/@status#612

Merged
windauer merged 1 commit into
masterfrom
fix/toc-suppressed-for-non-frus-publications
Jul 14, 2026
Merged

fix: restore TOC listings for publications without revisionDesc/@status#612
windauer merged 1 commit into
masterfrom
fix/toc-suppressed-for-non-frus-publications

Conversation

@joewiz

@joewiz joewiz commented Jul 14, 2026

Copy link
Copy Markdown
Member

[This PR was prompted by Joe, drafted by Claude Code, and reviewed by Joe.]

Problem

Reports came in today of missing content on production: the article listings on Milestones chapter pages (e.g. /milestones/1750-1775), the FAQ listing (/about/faq), the HAC listing (/about/hac), and the Short History chapter listing (/departmenthistory/short-history) all render an empty <div class="toc"></div> where the table of contents should be. The regression was invisible until now because the site's nginx caches had served year-old copies of these pages; repopulating the caches yesterday exposed it.

Root cause

Commit 4e2e4c3 (2025-09-29, first released in v3.10.11) added a guard to toc:toc() in modules/frus-toc-html.xqm so that anticipated (not-yet-published) FRUS volumes — whose TEI may contain just chapter titles — don't display a table of contents:

let $some-published := root($root)//tei:revisionDesc[@status = ("published", "partially-published")]

Every FRUS volume carries tei:revisionDesc/@status, so the guard behaves correctly there. But toc:toc() is shared by every publication that renders a TOC – including Milestones, FAQ, HAC, Short History, Buildings, Conferences, and FRUS History. These generally have no tei:revisionDesc/@status at all (nine Milestones chapters have a revisionDesc without @status; the rest have none). For all of those, the guard evaluated to false and the TOC was silently suppressed.

Fix

Suppress the TOC only when the document actually carries tei:revisionDesc/@status and none of its values is published or partially-published. Documents without the attribute always show their TOC, restoring the pre-v3.10.11 behavior for non-FRUS publications while preserving the anticipated-volume suppression for FRUS.

Verified against a container built from joewiz/hsg-project:latest:

  • /milestones/1750-1775, /about/faq, /about/hac, /departmenthistory/short-history, /departmenthistory/buildings, and /conferences/2010-southeast-asia all render their listings again
  • published (frus1937v04) and partially published (frus1969-76ve10) volume landing pages still show their TOC
  • an anticipated volume (frus1981-88v16, status being-cleared) still suppresses its TOC

Tests

The existing Cypress specs for these pages only assert headlines, which is why the regression passed CI. This PR adds tests/cypress/e2e/ui-components/table-of-contents.cy.js, which asserts that the TOC listings contain links on all four reported page types and on a published FRUS volume landing page, and that an anticipated FRUS volume still suppresses its TOC. Run against the broken code, the four publication-listing tests fail and the two FRUS tests pass; against the fix, all six pass.

🤖 Generated with Claude Code

The anticipated-volume guard added in 4e2e4c3 suppressed the table of
contents for any document lacking tei:revisionDesc/@status = "published"
or "partially-published". FRUS volumes all carry that attribute, but
Milestones, FAQ, HAC, Short History, Buildings, Conferences, and FRUS
History TEI do not, so their article/section listings rendered empty.
The site's nginx cache masked the regression until the caches were
repopulated.

Suppress the TOC only when a document actually carries
tei:revisionDesc/@status and none of its values is published or
partially-published, preserving the anticipated-volume behavior for
FRUS while restoring listings everywhere else. Add Cypress regression
tests asserting the listings are present on the affected page types and
that the FRUS suppression still works.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@windauer
windauer merged commit abee659 into master Jul 14, 2026
3 of 6 checks passed
@joewiz

joewiz commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 3.12.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants