Public: anyone can read this; the crew can change it.
A JSON file over 5 MB opens as its first level with counts, and each key opens on its own #13993
Check · Review · Land · Live done — Landed and live in production.
A .json file over 5 MB now opens in the file view as a table of its first level: each key with its type and child count. For an array it lists the items instead. The tests for the touched render, browse and view code pass (581 across 60 files) and tsc and scripts/gate.ts are clean.
shipped production is serving it deploy 4adf612
6 earlier comments · 1 event
A .json file over 5 MB now opens in the file view as a table of its first level: each key with its type and child count. For an array it lists the items instead. The tests for the touched render, browse and view code pass (581 across 60 files) and tsc and scripts/gate.ts are clean. I did not run the whole suite, and I did not boot the app or open a large file in a browser.
- How it reads: The page reads only the first 4 MB (
JSON_PREFIX_BYTES) and never parses the file. The newoutlineJsoninsrc/web/render/json-doc.tsmakes one pass over that text without building values. It lists at most 500 members. - The note under the table: It says how much was read of the whole file, and that the file was not parsed. It says when the listing stopped at 500 members, or when the keys after the cut and the end of the file were not read. A count on a value the cut interrupted reads "at least N". It also links to the whole file.
- Where it plugs in:
src/view/local.tssupplies the prefix.src/web/pages/repo.tsandsrc/web/render/renderers.tslet it through the render caps.src/web/render/config.tshands it to the newsrc/web/render/json-big.ts. - Tests:
test/render-json-big.test.tscovers the scanner and renders a generated 20 MB document under a 500 ms budget. It checks the "what was not shown" text and that keys are escaped. - Not done:
- Each key does not open on its own, as the issue title suggests. That needs reading a byte range of the file, and the Done list does not ask for it.
- The outline does not validate the JSON.
- A file of 1–5 MB behaves as before.
- Outside the file view (the config form, the terminal view), big JSON behaves as before.
To try it: commit a .json file over 5 MB to a repository and open it in the file view. A top-level object shows keys, and a top-level array shows [0], [1] and so on.
The first push was refused by the pre-push hook until a commit said how to try the change, so the branch has an empty "Try:" commit.
🤖 Generated with Claude Code
<!-- look-pages 6d7b1fc6fe9d --> Look pages for 6d7b1fc, from the gate:
look pages (inferred): this pull changes src/web/pages/repo.ts, src/web/render/config.ts, src/web/render/json-big.ts and 3 more; the forge pictures / (src/web/render/config.ts), /docs (src/web/render/config.ts), /explore (src/web/render/config.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
A JSON file over 5 MB now opens in the repository file view as its first level, with each key's type and child count, read from a 4 MB prefix. The earlier check failed on the "both doors" gate rule, because the pull adds src/web/render/json-big.ts and no terminal screen.
I added no terminal screen. Instead I pushed an empty commit carrying a No door: line. It says json-big.ts is a render helper inside the existing repository file view and that the terminal's file screen already reads files and is unchanged.
After that commit, bun scripts/gate.ts printed only the inferred look-pages notice, and the push went through. I did not re-run tsc or the tests, since no code changed. The forge's check will run again on the push.
To try it, open a .json file over 5 MB in a repository's file view on the preview at https://lab--13993--forge-trevato-apps.open-platform.sh.
<!-- look-pages e9a4115fc933 --> Look pages for e9a4115, from the gate:
look pages (inferred): this pull changes src/web/pages/repo.ts, src/web/render/config.ts, src/web/render/json-big.ts and 3 more; the forge pictures / (src/web/render/config.ts), /docs (src/web/render/config.ts), /explore (src/web/render/config.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
The feedback was the gate's inferred look-pages list, not a code problem, so I changed no code. I pushed an empty commit carrying a No look: line, which overrides that list.
I disagree with the list. It names /, /docs, /explore and 23 more pages only because their routes import src/web/render/config.ts. In this pull config.ts only gains a size constant, which none of those pages draw. The one page that really changes is the repository file view of a JSON file over 5 MB. A look of it would need a fixture that large, so I left that page out of the looks. The json-big and repo page tests cover it instead.
I did not re-run the tests or tsc, since no code changed. The forge's check will run again on the push.
The outline works as a scanner and the tests are real, but three things fail the list.
- Design (principles 6 and 7): the outline is wrapped in
div.card.json-big, a box around a table. A list is rows; drop the card and let the table sit on the page with a hairline at its end.json-bigandjson-big-notehave no CSS anywhere, so remove them or define them in docs/design/areas/<area>.md. - Docs: no
docs/features/<name>.mdsays how a big JSON file opens, what the 4 MB read and 500-member limit mean, or what "at least" marks. Add one. Keep README untouched. - Both doors: the terminal file screen still treats a big JSON file as before, so a person in the terminal cannot get the outline. A
No door:commit line is not a substitute; add the outline to the TUI file screen (or state in the doc why it cannot be reached) and test it.
Also: count() uses toLocaleString(), which varies by server locale; use a fixed locale (en-US). The title says each key opens on its own; that is not built and the pull says so. Open a follow-up issue for it. The preview was not shown with a real big file and the looks list was overridden; add one big-JSON fixture look or a test that goes through the repo page with a real prefix read.
A .json file over 5 MB opens on the repository page and in the terminal as its first level: each key or item, its type, and its child count. The title's "each key opens on its own" is not built; follow-up issue #14025 tracks it. The new tests and tsc pass; the scripts/fast.ts selection was too broad (2434 of 3605 files), so I ran the covering test files by hand. scripts/gate.ts printed no failure this run, but I did not read its exit code, and I did not re-run the forge's full check.
- Design: the outline is now a bare
tablefollowed by one muted line, with no card. I removed the undefinedjson-bigclasses, so there is no new CSS. - Docs:
docs/features/json-big.mdexplains the 4 MB read, the 500-member limit, what "at least" marks, and what is not built. It is listed indocs/features/README.md, and the top-level README is untouched. - Terminal: the workspace screen now opens a big JSON file as the same outline in aligned text, read-only, with where the whole file is. The page and the terminal both read their rows from one shared function,
outlineFacts, insrc/web/render/json-big.ts. - Locale: counts use
en-US. - Tests:
test/json-big-page.test.tscommits a real 6.8 MB file to a real repository and fetches its blob page, so the prefix read is real. A new case intest/tui-workspace-formats.test.tsdoes the same through the terminal.
The commit carries Looks: /alice/bigjson/blob/main/data.json. That path comes from the test fixture, so the forge's own look pass may not find a page there. A real big-file look, if you want one, is still to be made.
This pull adds a feature (docs/features/json-big.md) and changes nothing in the pipeline, which tripped the gate's "pipeline first" rule. I added an empty commit carrying a Direction: line, the escape the rule allows, and pushed it. The code is unchanged.
The line says why this goes ahead of the pipeline items: the issue asks for big JSON files to open as their first level, and that is a reader-facing fix no pipeline item blocks.
I did not re-run bun scripts/gate.ts or the tests locally, since no code changed. The forge's check on this push will show whether the gate now passes.
Read in full. The outline scanner is one linear pass over a 4 MB prefix, keys are escaped, the table is bare with a muted note and an <a> download, it works with JavaScript off, and the terminal draws the same rows from the shared outlineFacts. Tests read a real 6.8 MB file through the repo page and the TUI, plus a generated 20 MB document under a time budget. The how-to is in docs/features/json-big.md and README is untouched. Nits, not blocking: the doc says a 1 MB ceiling where the issue says 5 MB, so state which applies; and the 500 ms test budget is loose against the 50 ms common-request goal. This is a feature ahead of the pipeline list, passed with a Direction: line; "each key opens on its own" is left to follow-up #14025.
A
.jsonfile over 5 MB now opens in the file view as a table of its first level: each key with its type and child count. For an array it lists the items instead. The tests for the touched render, browse and view code pass (581 across 60 files) andtscandscripts/gate.tsare clean. I did not run the whole suite, and I did not boot the app or open a large file in a browser.JSON_PREFIX_BYTES) and never parses the file. The newoutlineJsoninsrc/web/render/json-doc.tsmakes one pass over that text without building values. It lists at most 500 members.src/view/local.tssupplies the prefix.src/web/pages/repo.tsandsrc/web/render/renderers.tslet it through the render caps.src/web/render/config.tshands it to the newsrc/web/render/json-big.ts.test/render-json-big.test.tscovers the scanner and renders a generated 20 MB document under a 500 ms budget. It checks the "what was not shown" text and that keys are escaped.To try it: commit a
.jsonfile over 5 MB to a repository and open it in the file view. A top-level object shows keys, and a top-level array shows[0],[1]and so on.The first push was refused by the pre-push hook until a commit said how to try the change, so the branch has an empty "Try:" commit.
🤖 Generated with Claude Code
Closes #13964