Public: anyone can read this; the crew can change it.

A Windows .reg file reads as a table of keys and values, with what it deletes called out #16786

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A .reg file now opens on its blob page as one section per key with typed values, and the keys and values it deletes get their own list. I ran the new tests, the fuzz and kinds tests, test/mcp-read-file.test.ts, test/mcp-size.test.ts, tsc, the design lint and scripts/gate.ts --fix; all pass.

Notes

opened this

A .reg file now opens on its blob page as one section per key with typed values, and the keys and values it deletes get their own list. I ran the new tests, the fuzz and kinds tests, test/mcp-read-file.test.ts, test/mcp-size.test.ts, tsc, the design lint and scripts/gate.ts --fix; all pass. I did not run the full suite, which the forge runs on push. I took no screenshots and did not open the page in the running app.

What changed

  • Detection: a new kind, registry, in src/web/render/kinds.ts, with a 1 MB render cap. A .reg file counts only if its first line is Windows Registry Editor Version 5.00 or REGEDIT4. UTF-16 files have NULs in the head, so the check runs before the binary test. Any other .reg stays plain text.
  • Renderer: src/web/render/reg.ts, registered in renderers.ts. A value shows as string, dword, qword, binary, expandable string or multi-string. Binary values show only their length and first 32 bytes.
  • Deletions: [-KEY] and "name"=- appear under "Deleted by this file", in two tables, one for keys and one for values.
  • Bounds: at most 500 keys, 200 values per key and 500 deletions per list, with a note on how many were left out. Everything is escaped. A file that fails to parse or names no keys keeps its source, with the reason in one line.
  • Terminal and MCP: the terminal workspace opens the same file as a table (workspace_registry.ts). The MCP read_file tool returns about: {kind: "registry", keys, values, deletedKeys, deletedValues}, so there is no new tool and the ceilings are untouched.
  • Docs and tests:
    • Docs: docs/features/registry.md, a row in file-kinds.md, and docs/examples/settings.reg.
    • Tests: a new test/render-registry.test.ts, a sample in test/fuzz-renderers.test.ts, plus entries in test/render-kinds.test.ts and test/mcp-read-file.test.ts.

Left out

  • It is read-only, with no editing and no merge view.
  • UTF-16BE is decoded, but only UTF-16LE is the Windows norm.
  • Nothing links to the registry, and Windows environment variables are not expanded.
  • For a UTF-16 file, read_file returns the base64 body plus about, not the decoded text.

Reused: the m3u renderer's shape (kind, cap, fallback, the terminal and MCP hooks) and fileSize, escapeHtml and html. scripts/similar.ts found no closer match.

Check: scripts/gate.ts refused the first push until a commit line carried a "Try:" line, so there is an empty commit for that.

[
  {"go": "/trevato/forge/blob/main/docs/examples/settings.reg", "look": "One section per key; values table with Name, Type, Data", "expect": "A string, a dword (0x00000001 (1)), a binary (6 bytes: de ad be ef 00 01) and an expandable string (%PATH%)"},
  {"go": "/trevato/forge/blob/main/docs/examples/settings.reg", "look": "The 'Deleted by this file' section below the keys", "expect": "Legacy key listed under Keys; 'Old setting' under Values with its key"}
]

Closes #16027

7 earlier comments
commented

A .reg file now opens on its blob page as one section per key with typed values, and the keys and values it deletes get their own list. I ran the new tests, the fuzz and kinds tests, test/mcp-read-file.test.ts, test/mcp-size.test.ts, tsc, the design lint and scripts/gate.ts --fix; all pass. I did not run the full suite, which the forge runs on push. I took no screenshots and did not open the page in the running app.

What changed

  • Detection: a new kind, registry, in src/web/render/kinds.ts, with a 1 MB render cap. A .reg file counts only if its first line is Windows Registry Editor Version 5.00 or REGEDIT4. UTF-16 files have NULs in the head, so the check runs before the binary test. Any other .reg stays plain text.
  • Renderer: src/web/render/reg.ts, registered in renderers.ts. A value shows as string, dword, qword, binary, expandable string or multi-string. Binary values show only their length and first 32 bytes.
  • Deletions: [-KEY] and "name"=- appear under "Deleted by this file", in two tables, one for keys and one for values.
  • Bounds: at most 500 keys, 200 values per key and 500 deletions per list, with a note on how many were left out. Everything is escaped. A file that fails to parse or names no keys keeps its source, with the reason in one line.
  • Terminal and MCP: the terminal workspace opens the same file as a table (workspace_registry.ts). The MCP read_file tool returns about: {kind: "registry", keys, values, deletedKeys, deletedValues}, so there is no new tool and the ceilings are untouched.
  • Docs and tests:
    • Docs: docs/features/registry.md, a row in file-kinds.md, and docs/examples/settings.reg.
    • Tests: a new test/render-registry.test.ts, a sample in test/fuzz-renderers.test.ts, plus entries in test/render-kinds.test.ts and test/mcp-read-file.test.ts.

Left out

  • It is read-only, with no editing and no merge view.
  • UTF-16BE is decoded, but only UTF-16LE is the Windows norm.
  • Nothing links to the registry, and Windows environment variables are not expanded.
  • For a UTF-16 file, read_file returns the base64 body plus about, not the decoded text.

Reused: the m3u renderer's shape (kind, cap, fallback, the terminal and MCP hooks) and fileSize, escapeHtml and html. scripts/similar.ts found no closer match.

Check: scripts/gate.ts refused the first push until a commit line carried a "Try:" line, so there is an empty commit for that.

[
  {"go": "/trevato/forge/blob/main/docs/examples/settings.reg", "look": "One section per key; values table with Name, Type, Data", "expect": "A string, a dword (0x00000001 (1)), a binary (6 bytes: de ad be ef 00 01) and an expandable string (%PATH%)"},
  {"go": "/trevato/forge/blob/main/docs/examples/settings.reg", "look": "The 'Deleted by this file' section below the keys", "expect": "Legacy key listed under Keys; 'Old setting' under Values with its key"}
]
commented

<!-- look-pages 762679399402 --> Look pages for 7626793, from the gate:

  • look pages (inferred): this pull changes src/web/render/kinds.ts, src/web/render/reg.ts, src/web/render/renderers.ts; the forge pictures / (src/web/render/kinds.ts), /docs (src/web/render/kinds.ts), /explore (src/web/render/kinds.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

A .reg file now shows as a table of keys with typed values, and what it deletes is listed apart. I pushed a fix for the two file-kind guide failures; the other four check failures I did not fix.

What changed

  • scripts/kinds-guide.ts named the new kind "Registry export (.reg)", but src/web/render/kinds.ts never listed reg as one of its extensions. The guide table came out with an empty extension list, so it no longer matched docs/features/file-kinds.md.
  • I registered reg in SNIFFED_EXTENSIONS in kinds.ts and shortened the name to "Registry export".
  • The guide doc already held the right row, so it didn't change.
  • test/kinds-guide.test.ts passes. It had two failures: the table check and the "stale table is repaired" check.

Not fixed

  • test/llms-budget.test.ts is red on main too, so the check doesn't count it against this pull. It still fails locally.
  • The three code-browser tests in test/web-code.test.ts pass here, both with my fix and without it. I couldn't reproduce them. My guess is a flake or a sharding effect, but I haven't confirmed that.
  • bun x tsc --noEmit and bun scripts/gate.ts --fix came back clean. The gate notes one over-long comment in test/mcp-read-file.test.ts that the nightly rewrap handles.
  • I didn't run the full suite locally; the forge's check runs it on this push.

To try: open docs/examples/settings.reg in the file view.

commented

<!-- look-pages ffa1c70adca4 --> Look pages for ffa1c70, from the gate:

  • look pages (inferred): this pull changes src/web/render/kinds.ts, src/web/render/reg.ts, src/web/render/renderers.ts; the forge pictures / (src/web/render/kinds.ts), /docs (src/web/render/kinds.ts), /explore (src/web/render/kinds.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The feedback is the gate's automatic list of look pages for ffa1c70. It asks for no change, so I changed nothing and pushed nothing.

The gate inferred the pages by following which routes import src/web/render/kinds.ts, which is how it got /, /docs, /explore and 28 more. The change itself only affects how a .reg file reads in the file view. The gate says a Looks: <path> or No look: <why> line in a commit message would override the inferred list. I haven't added one, because I'd have to amend a pushed commit or add an empty one. If you want the list narrowed to the file view, say so and I'll add the line.

Pull description

A Windows .reg file now reads as a table of keys with typed values, and what the file deletes is listed apart. The change adds a registry file kind with a renderer in src/web/render/reg.ts. It reads UTF-16 and ASCII exports and decides by the Windows Registry Editor Version 5.00 header line, not by the name alone. The terminal workspace and the MCP read_file tool get the same reading. There is a how-to in docs/features/registry.md.

The file-kind guide is regenerated, with reg listed as the kind's extension.

Left out: editing or merging a registry file, and files over 1 MB, which keep their source view.

To try it, open docs/examples/settings.reg in the file view.

commented

I fixed the duplicate registryView wiring, but I couldn't take the screenshots, so the review block is still missing them. The registry, terminal workspace and format tests pass (66), and the type check is clean. I did not run the full set of tests the change touches: scripts/fast.ts named 3,789 files, so I ran only the four covering the registry renderer and terminal views.

What changed

  • A Windows .reg file now reads as a table of keys with typed values, and what it deletes is listed apart. The renderer is src/web/render/reg.ts. It reads UTF-16 and ASCII exports and decides by the Windows Registry Editor Version 5.00 header line, not by the name alone.
  • The terminal workspace and the MCP read_file tool read it the same way.
  • The file-kind guide is regenerated with reg as the extension. A how-to is in docs/features/registry.md.
  • registryView is now wired into workspace.ts once, in the book chain. I removed the second call on the playlist line, which now reads playlistView(...) alone.

What I left out

  • Editing or merging a registry file.
  • Files over 1 MB, which keep their source view.
  • Before and after screenshots. The preview holds no repository, and my sandbox reaches only the forge and the app's own previews, so I had no way to take them. The go paths below point at the branch, where the example file lives, so a reviewer can capture them.

To try it: open docs/examples/settings.reg on this branch in the file view.

[
  {"go": "/trevato/forge/blob/scout/16027-a-windows-reg-file-reads-as-a-table-of-k/docs/examples/settings.reg", "look": "The keys table. Each value shows its type, and the deleted keys and values sit in their own list apart.", "expect": "A table of keys with typed values, and a separate deletions list. No raw .reg source is shown first.", "ask": "Take the after screenshot here."},
  {"go": "/trevato/forge/blob/main/docs/features/file-kinds.md", "look": "The kind table row for Registry export.", "expect": "`.reg` is listed beside Registry export, drawn up to 1 MB.", "ask": "Take the before screenshot of a .reg file's plain source view on main, for comparison."}
]
commented

<!-- look-pages 6cb77f6f8a79 --> Look pages for 6cb77f6, from the gate:

  • look pages (inferred): this pull changes src/web/render/kinds.ts, src/web/render/reg.ts, src/web/render/renderers.ts; the forge pictures / (src/web/render/kinds.ts), /docs (src/web/render/kinds.ts), /explore (src/web/render/kinds.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

Left #16027 open: 1 unticked item remain (The new test file is found by the gate list; bun scripts/design-lint.ts is clean; the pull carries a review block with before/after screenshots.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs