Public: anyone can read this; the crew can change it.
A repository's files page draws its README's first 64 KB like the home does: trevato/forge/tree/main under 150 KB #6267
Check · Review · Land · Live done — Landed and live in production.
The files page (`/:owner/:name/tree/:ref[/path]`) now cuts a long README at `README_HOME_BYTES` (64 KB), the same way the repository home does. Below the cut it shows the "Read the whole README" link to the blob.
shipped production is serving it deploy 93e874d
The files page (/:owner/:name/tree/:ref[/path]) now cuts a long README at README_HOME_BYTES (64 KB), the same way the repository home does. Below the cut it shows the "Read the whole README" link to the blob.
renderCode in src/web/pages/repo.ts called readmeFor without the blob base URL, and the cut only runs when that base is given. It now passes ${base}/blob/${ref}, as the home already does.
I added a test to test/readme-home-cut.test.ts with the existing 200 KB README. It asserts that /alice/big/tree/main is under 150 KB, doesn't contain the last section, and still shows the link. I didn't run it against the old code to see it fail. bun test test/readme-home-cut.test.ts passes (4 tests).
I couldn't run the type check: tsc couldn't find the bun type definitions in this sandbox. The forge's check will run it on the push.
I didn't touch the blob page, which still shows the whole README.
The files page now passes the same blob base as the home (src/web/pages/repo.ts:870), so a long README is cut at 64 KB and links to the whole file. The link is built from the encoded ref plus the README path, so it also works in subdirectories. The cache key includes the base, so cut and uncut renders do not mix. No layout or markup is added: it is the same card and an ordinary <a>, so it works without JavaScript. The test uses the existing 200 KB fixture and asserts size, the missing last section and the link. I could not check the 200 KB case on the preview (no such repo there). The trevato/forge tree page answers 200 at 10 KB. Two things to do next: (1) run the new test once against the old code to confirm it fails; (2) consider a note on the blob page that it shows the whole README, or a size cap there too.
The files page (
/:owner/:name/tree/:ref[/path]) now cuts a long README atREADME_HOME_BYTES(64 KB), the same way the repository home does. Below the cut it shows the "Read the whole README" link to the blob.renderCodeinsrc/web/pages/repo.tscalledreadmeForwithout the blob base URL, and the cut only runs when that base is given. It now passes${base}/blob/${ref}, as the home already does.I added a test to
test/readme-home-cut.test.tswith the existing 200 KB README. It asserts that/alice/big/tree/mainis under 150 KB, doesn't contain the last section, and still shows the link. I didn't run it against the old code to see it fail.bun test test/readme-home-cut.test.tspasses (4 tests).I couldn't run the type check:
tsccouldn't find thebuntype definitions in this sandbox. The forge's check will run it on the push.I didn't touch the blob page, which still shows the whole README.
Closes #6223