Registry Mirror
Skip to content

Conversation

@backnotprop

@backnotprop backnotprop commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Builds the approved design record review-file-kinds (approved 2026-10-14 in the Inbox thread "pulls.review inspiration"): three file kinds — Code, Tests, Generated — in the code review file tree and in Guided Reviews.

What changed

One classifier — fileKind(path, generated?) in @plannotator/core/file-kind. It is pure and browser-safe, and Pi vendors it.

  • Generated: the host's generated set when it has one (the server's generatedFiles, .gitattributes included). Without a set, the built-in name list decides. That list (DEFAULT_GENERATED_PATTERNS, isDefaultGeneratedPath) moved from shared/generated-files.ts into core. Shared re-exports it, so the server's behavior is unchanged.
  • Tests:
    • by file name: .test., .spec., .cy., .e2e., .test-d. or _test. followed by a code extension (ts, tsx, js, jsx, mjs, cjs, mts, cts, py, go, rs, java, kt, kts, rb, swift, cs, fs, ex, exs, php, scala, dart, groovy, clj, lua, c/cpp/h, vue, svelte, …), each with a name before the marker; *.stories.* (any extension); test_*.py, conftest.py, Django tests.py; *.snap;
    • or by a folder above the file: __tests__, __snapshots__, __fixtures__, __mocks__, test, tests, spec, e2e, fixtures, testdata, testFixtures (case-insensitive, so Swift's Tests/ counts), a Gradle/Kotlin source set src/<name>Test (androidTest, commonTest, integrationTest; only directly under src), or a .NET *.Tests / *.UnitTests project folder.
  • Code: everything else, docs and config included.
  • These stay Code: contest.ts, latest.ts, test.ts, src/testing/…, testing-library.config.js, jest.config.js, docs/spec.md, .github/workflows/test.yml, openapi.spec.yaml, contracts/payment.spec.json, scripts/load_test.md.
  • groupByFileKind splits a list into the three kinds and keeps each item's order.

Icons — FileKindIcon in @plannotator/guide-viewer/FileKindIcon. It has the mock's three glyphs (angle brackets, a flask, a package) on the 24-unit grid with stroke 2. The review app, the Inbox and guides.show share it.

Code review tree:

  • When a change has 2 or more kinds, the tree splits into Code, Tests and Generated blocks. Each block is today's folder tree.
  • Each block header is the Git status section header (extracted as PanelSectionHeader; SectionsPanel now uses the same component) plus the icon, file count, viewed/total and +/-.
  • A header folds its block in the tree only. Generated starts folded.
  • A "Group by kind" switch is in the existing Tree controls popover, on by default.
    • It is cookie-only: plannotator-review-group-by-kind=off when turned off.
    • It is not a settings-registry entry, because the registry is bundled into the guides.show viewer.
    • The popover's switch rows now share one small TreeSwitch helper (same markup).
  • j/k/Home/End and the all-files order (fileOrder: 'kind') follow the blocks.
  • A file that becomes active by any route (j/k, a click in all-files, the scroll highlight, an annotation or search jump) opens its folded block, the same way folded folders open for the active file. A new file list never opens one, so Generated stays folded when a diff loads.
  • With hide-viewed on, a block whose rows are all hidden hides its header too.
  • Folder paths are scoped per block, so the same folder in two blocks opens and closes on its own, and collapse-all still works.
  • With one kind, or with the switch off, the tree is today's tree.
  • Test files get a flask on their diff headers (all-files and single-file) and on Git status rows. The Git status view keeps its sections, and the Commits view keeps tree order.

Guided Reviews (GuideSectionCard / GuideFileCard):

  • Within a chapter: code first, then a "Tests N" subhead, then "Generated N".
  • Subheads appear only when a chapter has 2 or more kinds.
  • The author's order is kept inside each kind, and the diff cards follow the chip order.
  • Tests are open. Generated cards start folded (through mountCollapsed).
  • Hosts may pass generatedFiles on the guide host (the review app does). The Inbox and guides.show use the name list.
  • No change to the guide format, the prompt or the export.

guides.show:

Screenshots

Taken from the real built review app on a demo diff with code, tests and generated files, plus a guide exported from the same diff and opened in a locally built guides.show viewer. The files are local, in /tmp/file-kinds-shots/:

Before After
before-tree-dark.png after-tree-dark.png (Code / Tests / Generated blocks; all-files in block order)
before-tree-dark-tree-controls.png after-tree-dark-tree-controls.png ("Group by kind" switch)
after-tests-dark.png (Tests block; flask on the diff header)
after-code-folded-dark.png (Code folded, Generated opened)
after-git-status-dark.png (Git status keeps its sections; flask on test rows)
before-guide-dark.png, before-guide-dark-full.png after-guide-dark.png, after-guide-dark-full.png (Tests and Generated subheads; generated card folded)

Tests

  • New tests:
    • packages/core/file-kind.test.ts (real-world layouts, including conftest/tests.py, .cy./.e2e./.test-d., Gradle source sets, testFixtures and .NET test projects, plus the must-stay-Code names and non-code extensions);
    • packages/review-editor/utils/fileKindTree.test.ts;
    • DOM tests FileTree.fileKinds.test.tsx (blocks, folding, one kind / switch off, j/k order, opening on any activation, hide-viewed, the switch), FileHeader.fileKind.test.tsx and packages/guide-viewer/GuideSectionCard.fileKinds.test.tsx (1 kind, 2 or more kinds, folding, the host set).
  • The new DOM tests are registered in test.yml, and the allowlist guard passes.
  • After the merge with main: DOM_TESTS=1 bun test in packages/review-editor (728 pass) and packages/guide-viewer (37 pass); bun test packages/core (458 pass); tests/entry-assets.test.ts (35 pass, no diagram engines imported); apps/guides-show tests (41 pass).
  • Earlier full root bun test (before the follow-ups): 7929 pass, 1 fail, apps/pi-extension/server/network.test.ts "configured browser launch", a timing flake under load that passes alone (38/38).
  • bun run typecheck exits 0.
  • Correction: the first version of this description said packages/inbox/tsconfig.guide.json and apps/guides-show/tsconfig.viewer.json report 0 errors. That was wrong (my script called a tsc path that does not exist). Run directly with the repo's TypeScript 5.8.3, they report pre-existing errors (5 and 6), as does apps/inbox/tsconfig.json (7). None is in a file or line this PR adds; they are in Inbox components, useEditSession.ts, CallFlowRawView.tsx, call-flow-types.ts, workerPool.tsx and two untouched selection lines of AllFilesCodeView.tsx. These configs are not CI gates.
  • bun run --cwd apps/review build and bun run build:hook pass.

Left out (parked by the owner, or outside v2)

  • The collapse menu / split button, "collapse viewed", text filters, a "Group as" override, a .gitattributes kind override, group headers between diffs in all-files, and the review overview.
  • No new shortcuts and no new menus.

…views

One pure classifier, fileKind(path, generated?), in @plannotator/core
(the built-in generated name list moves there; shared/generated-files.ts
re-exports it and Pi vendors it). Three icons in @plannotator/guide-viewer.

- Tree: Code / Tests / Generated blocks when a change has 2+ kinds, under
  the Git status section header with icon, count, viewed/total and +/-.
  Generated starts folded. "Group by kind" switch in Tree controls,
  default on, cookie-only. j/k and the all-files order follow the blocks.
- Flask on test diff headers and Git status rows.
- Guided Reviews: within a chapter, code first, then "Tests N", then
  "Generated N" (folded); subheads only with 2+ kinds; author order kept.
- guides.show JS budget +1 KB (owner-approved); manifest regenerated.
…ock on any activation

- .test./.spec./_test count only before a code extension, so
  openapi.spec.yaml, payment.spec.json and load_test.md stay code.
- Tests also: conftest.py, Django tests.py, *.cy.*, *.e2e.*, *.test-d.ts,
  Gradle src/<name>Test and testFixtures, .NET *.Tests / *.UnitTests.
- A file that becomes active by any route opens its folded kind block
  (not only j/k); a new file list never does.
- Hide-viewed hides a kind block whose rows are all hidden.
- AllFilesOrder type moved below the imports.
# Conflicts:
#	packages/core/guide-viewer-manifest.ts
@backnotprop
backnotprop merged commit d22359f into main Oct 14, 2026
32 checks passed
@backnotprop
backnotprop deleted the feat/review-file-kinds branch October 14, 2026 20:41
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