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

The rosters: generate the palette roster from one file per member (child of #14248) #14443

Merged opened this

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

Merged

The terminal palette roster (ENTRIES in src/tui/screens/entries.ts) is now built from the screen files instead of a hand-kept list of about 108 imports. What changed entries.ts reads src/tui/screens/.

Notes

shipped production is serving it deploy 2f48880

opened this

The terminal palette roster (ENTRIES in src/tui/screens/entries.ts) is now built from the screen files instead of a hand-kept list of about 108 imports.

What changed

  • entries.ts reads src/tui/screens/. Every file that declares : PaletteEntry = is loaded, and every PaletteEntry it exports goes into the roster, in file-name order. A new screen adds a file and touches nothing else.
  • An entry that names another in after is now held back until that entry is placed. Otherwise the file-name order broke the anchors: new-issue-anywhere follows repolist, which sorts later.
  • test/palette-entries.test.ts gains four tests: the roster equals what the screen files export, ids are unique, the file scan finds a declaring file and skips others, and after ordering survives the sort.
  • Test results: bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. All 1,890 tests in the tui, palette and screen files pass (329 files); I did not run the whole suite, as the instructions say.

One visible change to look at

  • The palette now lists the generated entries in file-name order, with after anchors kept, rather than the old hand order.
  • I reordered the four pinned lists in test/palette-roster.test.ts to match. The ids, titles, hints and who is offered what are unchanged; only the order moved, so that is the diff to review.

Left out

  • There is no per-entry rank to restore the old order exactly.
  • The duty roster in src/maintain/registry.ts is still a hand list. The issue says #14355 made it one file per member, but that file is still a list of imports. I left it alone.

I pushed an empty Try: commit because the pre-push hook demanded one.

Try it Run ssh into the forge, press :, and type a screen's title. Or run bun test test/palette-entries.test.ts test/palette-roster.test.ts.

Closes #14434

5 earlier comments · 1 event
commented

The terminal palette roster (ENTRIES in src/tui/screens/entries.ts) is now built from the screen files instead of a hand-kept list of about 108 imports.

What changed

  • entries.ts reads src/tui/screens/. Every file that declares : PaletteEntry = is loaded, and every PaletteEntry it exports goes into the roster, in file-name order. A new screen adds a file and touches nothing else.
  • An entry that names another in after is now held back until that entry is placed. Otherwise the file-name order broke the anchors: new-issue-anywhere follows repolist, which sorts later.
  • test/palette-entries.test.ts gains four tests: the roster equals what the screen files export, ids are unique, the file scan finds a declaring file and skips others, and after ordering survives the sort.
  • Test results: bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. All 1,890 tests in the tui, palette and screen files pass (329 files); I did not run the whole suite, as the instructions say.

One visible change to look at

  • The palette now lists the generated entries in file-name order, with after anchors kept, rather than the old hand order.
  • I reordered the four pinned lists in test/palette-roster.test.ts to match. The ids, titles, hints and who is offered what are unchanged; only the order moved, so that is the diff to review.

Left out

  • There is no per-entry rank to restore the old order exactly.
  • The duty roster in src/maintain/registry.ts is still a hand list. The issue says #14355 made it one file per member, but that file is still a list of imports. I left it alone.

I pushed an empty Try: commit because the pre-push hook demanded one.

Try it Run ssh into the forge, press :, and type a screen's title. Or run bun test test/palette-entries.test.ts test/palette-roster.test.ts.

commented

The terminal palette roster is now built from the screen files rather than a hand-kept list of about 108 imports. The check failed on the "pipeline first" rule because this pull changes a feature file and nothing in the pipeline directories. I added the Direction: line it asks for in a new commit, and bun scripts/gate.ts now passes locally. I have not seen the forge's check re-run on this push yet.

What changed

  • src/tui/screens/entries.ts reads src/tui/screens/. It loads every file that declares : PaletteEntry = and takes every entry those files export, in file-name order. A new screen adds a file and nothing else.
  • An entry that names another in after is held back until that one is placed. Without this, new-issue-anywhere fell to the end of the list, because it follows repolist, which sorts after it by file name.
  • test/palette-entries.test.ts has four new tests:
    • The roster equals what the screen files export.
    • Ids are unique.
    • The file scan finds a declaring file and skips others.
    • after ordering survives the file-name sort.
  • The tui, palette and screen test files passed (1,890 tests across 329 files). bun x tsc --noEmit and the gate are clean. I did not run the whole suite.

What to look at

  • The palette now offers entries in file-name order, with after anchors kept, not the old hand order. I reordered the four pinned lists in test/palette-roster.test.ts to match. The ids, titles, hints and who is offered what are unchanged; only the order moved.
  • The Direction: line says generated shared lists ahead of pipeline items is what the owner asked for in #14248. A reviewer should confirm that reading.

Left out

  • There is no per-entry rank to restore the old order exactly.
  • src/maintain/registry.ts (the duty roster) is still a hand-kept list of imports, though #14355 was meant to cover it. I left it alone.

Try it Open the terminal, press :, and type a screen's title. Or run bun test test/palette-entries.test.ts test/palette-roster.test.ts.

commented

The three failing checks came from the audits not knowing the palette now loads its screens by listing the directory. I've pushed the fix; the three audit test files and the palette tests pass locally, but I haven't seen the forge's check re-run.

Once nothing imports the screen files by name, three audits flagged them:

  • scripts/unreached.ts: it treated every screen file that exports a palette entry as imported by nothing. Those files now count as reached, because entries.ts loads them.
  • scripts/hollow.ts: the actions those screens call looked unreachable. Screen files with an entry now count as loaded, and their exported entries as run.
  • scripts/unused-exports.ts: recoveryEntry, modelCeilingEntry and modelGrantEntry looked uncalled. An export typed PaletteEntry in a screen file now counts as used.

One thing I did not change: running --write on the unused-exports allow-list also pruned three entries (startOfAccount, forgeNeeds-style stale ones on main), so I reverted that file to keep this pull to its own scope.

This commit changes scripts/, so it also satisfies the earlier "pipeline first" rule. The palette roster change and the Direction: line from the earlier commit are unchanged.

commented

I merged main into the branch and pushed it. The one conflict was in scripts/unreached.ts: main had added a rule for the duty roster's directory (#14355), and my branch had added one for the palette screens. I kept both rules.

Tests were run on the merged branch: bun x tsc --noEmit is clean, and the unreached, unused-exports, hollow, palette-entries, palette-roster and tui-new-issue tests all pass (60). I did not run the whole suite, and I haven't seen the forge's check on the merge yet.

The gate notes one comment line in scripts/hollow.ts over 100 columns. It says the nightly rewrap fixes that on main, so I left it.

Changes requested — before the latest push

Changes needed, in one round:

  1. Palette order regressed for users. The hand order was deliberate (bills, payments, sentinel, boards... grouped by purpose); it is now alphabetical by file name, and test/palette-roster.test.ts was rewritten to bless the new order (e.g. claim-start/claim-link/recovery-link move up for members, bugs/health-voice move away from the admin group). Keep the old order: give each entry an explicit rank or group (a field on PaletteEntry, or a numeric prefix), generate the list from it, and put the pinned test lists back as they were on main. Reordering a user-facing menu is not what a roster refactor should do, and the pull says there is no rank to restore it - add one.
  2. The marker is a substring match on ": PaletteEntry = ", repeated in entries.ts, hollow.ts (twice), unreached.ts and unused-exports.ts. A file that spells it in a comment, or declares an entry with another annotation, is silently in or out. Export one MARK/helper from a single module and have the audits use it, or detect entries by loading the module (as entries.ts already does for isEntry).
  3. entries.ts mixes node:fs sync reads of ~300 files with require() at import time; this runs on every boot and on the terminal path. Measure it, and avoid reading every file twice (readFileSync to detect, then require). Also add a blank line before export interface PaletteEntry.
  4. scripts/hollow.ts: a comment line is over 100 columns and the gate flagged it; run gate --fix and commit instead of leaving it for the nightly. The seeds computation also duplicates the loaded scan; do one pass.
  5. The test that the roster equals the exports re-derives the same logic as the implementation and would pass with a wrong implementation; assert instead that a known set of ids (including recovery-link, model ceiling and grant, which are non-default exports) is present and in the pinned order.
  6. Direction: this is a roster refactor ahead of the pipeline items; the Direction: line asserting the owner wanted it in #14248 should be confirmed by a person, not by the builder.
commented

The palette roster is now generated from one file per screen, and the order users see is the old hand order again. test/palette-roster.test.ts is back as it was on main and passes. I ran the palette, roster, hollow, unreached and unused-exports tests plus tsc and the gate; the forge runs the full suite on the push.

  1. Order restored. PaletteEntry has a required rank field, and the roster is every declared entry sorted by rank. Ranks come from the old hand list in steps of ten, so a new entry fits between two. Ties fall back to file name, then export name.
    • I removed the ordered() re-sort. With ranks it shifted entries that name an after anchor, which broke the pinned order. addEntries still places those entries after their anchor, as on main.
  2. One definition of an entry. src/tui/screens/entry_mark.ts exports entryNames(source), which matches only a line starting export const X: PaletteEntry = . entries.ts, scripts/hollow.ts, scripts/unreached.ts and scripts/unused-exports.ts all use it. A comment or another annotation no longer counts, and a test covers that.
  3. Reading cost. The detection scan reads about 300 files in roughly 22 ms. Only the 111 entry files are then required, and I did not find a cheaper way to avoid reading those twice. Importing entries.ts takes about 1.3 s, which is almost all loading the screens. The screens were already imported statically before this change, so I don't expect that to be new cost, but I did not measure main for comparison. I also added the blank line before export interface PaletteEntry.
  4. hollow.ts. The three comment lines over 100 columns were already on main. gate --fix doesn't wrap them and says the nightly rewrap does, so I wrapped them by hand and the gate is quiet. loaded and seeds are now built in one pass over the sources.
  5. Roster test. The test that re-derived the implementation's logic is replaced. It asserts that a fixed list of ids is present and in the pinned relative order: bills, payments, sentinel, boards, drift, model-grant, model-ceiling, claim-start, claim-link, recovery-link and new-issue-anywhere. It also asserts the first three ids and the last. A wrong implementation would fail it.
  6. Direction line. I can't confirm it myself. The owner's ask in #14248 needs a person to check it, so please treat that line as unconfirmed.

To try it, run bun test test/palette-roster.test.ts test/palette-entries.test.ts, or open the terminal's palette and compare its order with main.

commented

The gate failed because of my last push. I had hand-wrapped three comments in scripts/hollow.ts (lines 346, 361 and 456) that this pull didn't write, and the gate's "the diff is the change" rule refuses that. I put the three comments back to main's text, so scripts/hollow.ts now differs from main only in the entry-detection change.

Locally the gate reports no "diff is the change" violations, tsc is clean and test/hollow.test.ts passes. I haven't seen the forge's check re-run on the new push yet.

This reverses part of item 4 in the earlier round. The over-100-column comment lines in hollow.ts were already on main, so they stay for the nightly rewrap rather than being fixed here.

Approved

Clean. The roster is generated from one file per entry with an explicit rank (old order kept, steps of ten, no duplicate ranks), one shared entry_mark.ts definition feeds the roster and the three audits, and the preview answers 200. The files are read from a fixed directory under import.meta.dir, with no user input. No new dependency, no security surface, and the pinned roster test is back as on main. The Direction: line stays a person's call, but this is the child of #14248 and the change is small and single-purpose.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs