Skip to content

feat(rsync): index files as directory pages, UTF-8 charset labels - #27

Merged
jshvn merged 2 commits into
mainfrom
josh/index-pages-charset
Oct 17, 2026
Merged

jshvn merged 2 commits into
mainfrom
josh/index-pages-charset

Conversation

@jshvn

@jshvn jshvn commented Oct 17, 2026

Copy link
Copy Markdown
Member

What

  • label: a text/* type gets ; charset=utf-8 when the whole file decodes as strict UTF-8 (read 1 MiB at a time). Other text gets no charset. Generated pages upload as text/html; charset=utf-8.
  • smoke: compares the full Content-Type value (new CTYPE), not the first word, so a type with a charset compares correctly.
  • INDEX_FILES (new, empty by default): names of upstream index files, in sequence. For a directory with such a file, pages writes the listing only to the slashless key and adds <source key> TAB <page key> to .run/index-real.txt; index-copy then copies the file to the page key with one s3api copy-object --metadata-directive COPY (same bytes, Content-Type and ETag). /dir/ then serves the index file, as the upstream server does. The README says to set it only where upstream serves the index file at the directory URL; CTAN asks its mirrors not to (DirectoryIndex disabled).
  • smoke page check: for a copied page key, size and type must equal the source; the slashless key is compared with the listing in the SLASH tree.
  • Run summary counts the copied page keys. README, engine header and CLAUDE.md hazards updated.

With INDEX_FILES unset (every mirror until its own PR), behaviour is unchanged apart from the charset on labels and pages.

Test plan

  • task run -- task offline (new cases: pages picks index.html over index.htm; label charset for ASCII, UTF-8, Latin-1, UTF-16, empty; smoke accepts an equal copy and refuses one a byte longer; index-copy passes the raw key with a space and + to a stub aws)
  • task check (render.txt updated)
  • validate-vars.sh --check, chain-file.sh --check, gpg-gate-check.sh, op-retry-check.sh
  • CI green (image build included)
  • After release: one run per mirror green; /timestamp on ctan served as text/plain; charset=utf-8; smoke lines show charset types and pass

jshvn added 2 commits October 16, 2026 18:01
INDEX_FILES (empty by default) names the upstream index files, in
sequence. For a directory with such a file, pages writes the listing
only to the slashless key and records "<source key> TAB <page key>" in
.run/index-real.txt. index then copies the file to the page key with
one server-side copy-object (--metadata-directive COPY), so /dir/
serves the same bytes, Content-Type and ETag as the index file.

label adds "; charset=utf-8" to a text/* type when the whole file
decodes as strict UTF-8. Generated pages upload as
"text/html; charset=utf-8".

smoke compares the full Content-Type value (CTYPE), not the first
word, and for an index directory checks the copy against its source.

index-real.txt starts each line with a full key: read with a TAB in
IFS drops an empty first field, which the root directory would be.
The CLI percent-encodes --copy-source, so the encoded key went out
encoded twice and the copy read a different key. The copy loop is now
index-copy; offline runs it against a stub aws and compares the exact
arguments for a key with a space and a plus.

The run summary counts the copied page keys. The README says to set
INDEX_FILES only where upstream serves the index file, and that ctan
does not: CTAN asks its mirrors for DirectoryIndex disabled.
@jshvn
jshvn merged commit be86aed into main Oct 17, 2026
2 checks passed
@jshvn
jshvn deleted the josh/index-pages-charset branch October 17, 2026 01:37
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