Skip to content

Source date epoch rebuilds - #14777

Open
Darlokt wants to merge 4 commits into
sphinx-doc:masterfrom
Darlokt:source-date-epoch-rebuilds
Open

Darlokt wants to merge 4 commits into
sphinx-doc:masterfrom
Darlokt:source-date-epoch-rebuilds

Conversation

@Darlokt

@Darlokt Darlokt commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Purpose

Hej,
as requested by @AA-Turner, here is the second of 3 more reviewable split up of the main PR #14770 targeting the SOURCE_DATE_EPOCH behavior and related fixes.

Date substitutions are resolved while documents are read and remain in cached doctrees. Changing SOURCE_DATE_EPOCH between builds can therefore leave old dates in the output. This change stores the effective epoch in the build environment and triggers a reread when it changes, including when it is set or unset. Equivalent inputs, such as 0 and 00, do not cause an unnecessary reread.

There is also a selected-file build issue: a global configuration change can cause all documents to be reread, while output is written only for the selected documents. The updated environment then leaves other output files stale. Selected-file builds now take the full-build path when read-affecting configuration, the extension list, or the effective epoch changes. Without a global change, selected-file builds remain selective. If none of the selected filenames are valid, existing warnings are retained and pending invalidation is preserved.

The tests use Sphinx's existing |today| substitution, so this part can be reviewed and merged before the Docutils compatibility changes. Coverage includes clean and incremental builds, serial and parallel execution, selected output, invalid filename selections, and recovery after a failed build. The change also updates the environment version, regenerates the search fixtures through utils/generate_js_fixtures.py, and includes documentation and a changelog entry.

References

AI Disclosure

OpenAI Codex assisted with splitting up #14770. All AI-assisted work was reviewed and understood by me.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant