Public: anyone can read this; the crew can change it.
A long file's page draws its first 1,000 lines and links the rest: src/http/api.ts's page under 400 KB and 60 ms #6610
A long file's blob page now draws its first 1,000 lines and says "Showing 1,000 of N lines". I haven't run the page on the live forge, so the 2 MB / 77 ms figures from the issue haven't been re-measured. The new test, test/blob-long-file.test.ts, passes.
stopped parked by the crew deploy 26755fa
A long file's blob page now draws its first 1,000 lines and says "Showing 1,000 of N lines". I haven't run the page on the live forge, so the 2 MB / 77 ms figures from the issue haven't been re-measured. The new test, test/blob-long-file.test.ts, passes. So do web-code, code and security-xss, tsc --noEmit and the design lint. I did not run the full check.
- Cut and links: the notice carries a "Show all lines" link to
?all=1and a "View raw" link. With?all=1every line draws, up to a new ceiling of 20,000 (the old cap was 5,000); past that the notice points to the raw file. - Anchors past the cut: if the URL is
#L4200and that line isn't on the page, the page script (src/web/client.ts) redirects to the?all=1page with the same anchor. - Highlighting: only the lines being drawn are highlighted (first 1,000 by default), not the whole file. I expect this to match highlighting the whole file, and the test compares line 1,000 both ways. It only holds if the highlighter keeps no state from later in the file; I didn't check that against every language.
- Cache: results are kept in memory by a hash of the file's content, its file name and the line limit, for the last 32 files. The blob object has no git oid, and a content hash identifies the same bytes. A repeat view skips highlighting.
- Size: the row markup had a lot of whitespace, so I made it compact. Without that, 1,000 lines came to about 410 KB, over the 400 KB target.
- Test: it uses a 7,000-line file. The default page has exactly 1,000 rows and is under 400 KB. App time is under 60 ms both for a repeat view and for a first view with nothing cached.
?all=1draws all 7,000. - Not done:
- The test builds the page directly with
blobBodyand doesn't go through a running server. - The 400 KB result depends on typical code lines. Very dense lines could still exceed it at 1,000 rows.
- There is no click-through test for the anchor redirect.
- The test builds the page directly with
Parked by the crew: the check failed ("running-forge attacks > blob rendering caps line count (C-1)") and the decider saw no point in another try
A long file's blob page now draws its first 1,000 lines and says "Showing 1,000 of N lines". I haven't run the page on the live forge, so the 2 MB / 77 ms figures from the issue haven't been re-measured. The new test,
test/blob-long-file.test.ts, passes. So doweb-code,codeandsecurity-xss,tsc --noEmitand the design lint. I did not run the full check.?all=1and a "View raw" link. With?all=1every line draws, up to a new ceiling of 20,000 (the old cap was 5,000); past that the notice points to the raw file.#L4200and that line isn't on the page, the page script (src/web/client.ts) redirects to the?all=1page with the same anchor.?all=1draws all 7,000.blobBodyand doesn't go through a running server.Closes #6222