Repository navigation
Commit 453cdba
authored
fix(docs): sort the sitemap's entries so the route is a function of the content (#200)
Fixes #194
Two consecutive builds of an identical, untouched tree emitted different bytes
for the same 346 sitemap entries. source.getPages() enumerates in file-read
completion order, so docs entries moved between builds in contiguous chunks
while the advertised set stayed exactly the same. deploy-docs.yml publishes on
every push to main, so the served sitemap.xml changed bytes on deploys that
changed no content, and anything downstream treating "bytes changed" as
"content changed" was reading noise.
Sorting by url before returning makes the route a pure function of the content.
One statement; the builder and the staticPaths/docPaths composition are
untouched and the ordering is plain lexicographic.
The comparator is code-unit, not localeCompare: localeCompare depends on the
runtime's ICU data and default locale, so it would move the irreproducibility
from across-builds to across-machines — invisibly, since any single machine
would still look perfectly stable.
Verified by the card's own reproduction inverted: pre-fix builds 60a0416c vs
f261b188 (differ), post-fix builds 84ec138c vs 84ec138c (byte-identical). The
advertised set is unchanged — the sorted-url-blocks digest holds at a57adad5 on
all four builds, the same value the card recorded. The locale-surface gate is
green for the same reason as before, measured rather than asserted: its stdout
is byte-identical when run against the pre-fix and post-fix artifacts.1 parent 9a1a7ad commit 453cdba
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
56 | 66 | | |
0 commit comments