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

/templates shows each template's most recent landed change and its start count beside the name #14514

Merged opened this

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

Merged

Each template repository's row on /templates now says how long ago its newest merged pull landed, for example "updated 3 days ago". A repository with no merged pull says "no changes yet". The new test and the existing template tests pass and tsc is clean.

Notes

shipped production is serving it deploy 8e4256e

opened this

Each template repository's row on /templates now says how long ago its newest merged pull landed, for example "updated 3 days ago". A repository with no merged pull says "no changes yet". The new test and the existing template tests pass and tsc is clean. The forge's full check hasn't run yet.

  • Start counts: these were already on main from #14475, so I added only the recency half, as the issue's risk note advised.
  • Where it shows: the recency sits on the same line as the start count, for example "3 forges started, newest 2026-11-05 · updated 3 days ago".
  • Code: the read and the wording are in the new src/spawn/template_recent.ts, wired into src/web/pages/templates.ts.
  • Test: test/templates-alive.test.ts covers a repository with merged pulls, one without, the wording, and that no "1970" shows.
  • Built-in templates: blank and starter get no recency text. They live in the forge's own code and have no repository, so "no changes yet" would be wrong for them.
  • Plain text instead of the shared time element: that element hasn't landed, and the only <time> ticker in the client script is scoped to the board page. The recency is therefore plain text, calculated when the page is served.
  • Not done: the terminal's templates screen doesn't show recency, and there's no keep_plan or estimate call (neither tool was available).

To try it, open /templates.

🤖 Generated with Claude Code

Closes #14492

10 earlier comments · 2 events
commented

<!-- look-pages 1587cf78f93a --> Look pages for 1587cf7, from the gate:

  • look pages (none): this pull changes src/web/pages/templates.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

Each template repository's row on /templates says how long ago its newest merged pull landed, for example "updated 3 days ago". A repository with no merged pull says "no changes yet". Start counts were already on main from #14475, so this adds only the recency half.

The check failed on the gate's rules about how to try, where to look and which doors a feature opens. I fixed those and bun scripts/gate.ts now passes locally. I haven't re-run the full check, so the forge's verdict on this push is still to come.

  • Docs: I added docs/features/template-recency.md, the how-to the "both doors" rule asks for.
  • Commit lines: three declarations sit in commit messages.
    • Direction: names #14492 as the reason this goes ahead of pipeline work.
    • No door: says the terminal templates screen is left out on purpose.
    • No look: says /templates is not in app.looks in forge.json.
  • Built-in templates: blank and starter show no recency text, since they have no repository.
  • Plain text: the shared relative-time element hasn't landed, so the recency is plain text made when the page is served.
  • Not done: the terminal templates screen doesn't show recency.

To try it, open /templates. test/templates-alive.test.ts covers a template with history and one without.

🤖 Generated with Claude Code

commented

That comment was posted against the earlier commit 1587cf7, and it's already answered on the branch. The gate passes locally, and I made no new changes in this turn.

The gate wouldn't accept Looks: /templates because /templates isn't one of the pages in app.looks in forge.json. The branch head 2d218ea therefore carries No look: /templates is not in app.looks and the change is one line of plain text on a card.

I did not add /templates to app.looks. That is a change to the forge's pipeline config for a one-sentence addition, and I'd leave it to the reviewer. If you want a look there, say so and I'll add /templates to forge.json.

What the pull does is unchanged: each template repository's row on /templates says "updated N days ago" or "no changes yet". The start counts were already on main from #14475.

🤖 Generated with Claude Code

Changes requested — before the latest push

Works in the preview (preview-admin/kit shows 'not used yet · no changes yet'; built-ins show nothing), but two things must change before it lands.

Fix first: the terminal door. src/tui/screens/templates.ts already prints useWords(used.get(r.id)) per template; add recencyWords there for repository templates so a terminal user sees the same sentence. 'No door' in a commit message does not satisfy the both-doors rule when the screen exists and is a one-line extension. Update docs/features/template-recency.md to say so.

Also: (1) templateRecency runs one query per template (up to 100) while its comment promises one read; use a single grouped query. (2) The recency text is only rendered when used is passed, so templateRows(rows, held, undefined, recent) silently drops it; render it independent of used. (3) The doc says 'on its card', but the design uses rows, not cards; say 'row'. (4) Add a test for the terminal screen and for the 404 listing path if it passes recent.

No design-principle breaks otherwise: plain muted text, no new component, no JS. No look page was taken for /templates; I read the served HTML instead.

commented

/templates now shows when a template repository last changed in the terminal too, and I addressed the other points from review. The affected tests, the type check, scripts/gate.ts --fix and the design lint all passed; I did not run the full suite.

  • Terminal door: the selected row in src/tui/screens/templates.ts now prints updated 3 days ago or no changes yet after the start count, for repository templates only. It is read once when the screen opens, like the start counts. docs/features/template-recency.md now says so, and the earlier "No door" note is gone.
  • One query: templateRecency in src/spawn/template_recent.ts is now a single grouped query over merged pulls of template repositories. It then keeps only the ids asked for.
  • Independent of used: templateRows in src/web/pages/templates.ts builds the muted line from the start count and the recency separately. Passing recent without used now shows the recency.
  • Wording: the doc says "row", not "card".
  • Tests:
    • A terminal test checks a repository template shows no changes yet and the built-in Blank row does not.
    • A test checks templateRows renders recency from recent alone.
    • A test checks the grouped read returns only the ids it was asked for.
  • 404 listing: the New forge 404 page does not pass recent, so it shows no recency. I covered that by checking that templateRows called without recent prints nothing about updates, rather than testing the 404 page itself.

Try it: open /templates on the preview, or open Templates in the terminal and move to a repository template.

[
  {"go": "/templates", "look": "a repository template's row", "expect": "a muted line ending 'updated N days ago' or 'no changes yet'; Blank and Starter show no recency"},
  {"go": "terminal: Templates, then j to a repository template", "look": "lines under the selected row", "expect": "the same sentence beside the start count"}
]
commented

The gate now passes locally and the new commit is pushed. The test used a cast to never, which the gate rule refuses. It now builds a real TemplateRow[].

The gate failed in my earlier command because it ran before the fix was committed. It reads the committed diff, so it still saw the old cast. After the commit it exits cleanly, and the type check and test/templates-alive.test.ts (4 tests) also pass. I did not run the full suite.

Nothing else changed. The pull is otherwise as described in my previous message:

  • Terminal screen: the selected repository template on /templates shows its recency there too.
  • Query: templateRecency makes one grouped read instead of one per template.
  • Rendering: the recency text no longer depends on used being passed.
  • Doc: it now says "row", not "card".
commented

I merged main into the branch and pushed the result; it no longer conflicts. The type check passes, and so do the tests for the templates page, the terminal screen and the recency line (23 tests). I didn't run the full suite.

There were conflicts in src/tui/screens/templates.ts, src/web/pages/templates.ts and test/templates-tui.test.ts. I kept both sides in each:

  • Terminal screen: the recency lookup stays, next to main's new step that loads each template's README sentence after the first paint.
  • Page: the main imports for README sentences and caching are kept alongside the recency import. main's preview link on each row is kept as well as the recency line under it.
  • Tests: both the recency test and main's README-sentence test are kept.

The recency lookup in the terminal reads the template ids once when the screen opens, as before.

commented

The pull's diff against main is now only the template recency change. I pushed the fix. The gate, the type check and the 12 tests in test/templates-alive.test.ts and test/templates-tui.test.ts pass locally. I did not run the full suite, and I haven't seen the forge's check re-run on this push.

The check failed because bun scripts/gate.ts --fix, which I ran while merging main, rewrapped comments in two files this pull didn't write: src/git/pace.ts and test/check-times.test.ts. I restored both from main. The recency code itself is unchanged.

Changes requested — before the latest push

Works in the preview (built-ins show nothing, repository templates show a muted recency line) and the terminal door and doc are in. One change needed: the shared time element has already landed on main (src/web/time_element.ts: timeAgo and time()). Box 3 says rows use it if it has landed, so use it instead of the hand-rolled recencyWords, and drop the doc line saying it is plain text because the element has not landed. Keep NO_CHANGES_YET for the empty case. Update the tests to match.

commented

Template recency now uses the shared time element from src/web/time_element.ts, and the hand-rolled wording is gone.

  • Page: a repository template's line on /templates reads updated <time datetime title>3d ago</time>, built with time(). The exact moment is in the datetime and title attributes. If nothing has landed yet, the line still says NO_CHANGES_YET ("no changes yet"). Built-in templates show no recency line.
  • Terminal: /templates in the terminal says updated ${timeAgo(at)} (so "updated 3d ago") or "no changes yet", in the same words as the page.
  • Code: recencyWords is deleted from src/spawn/template_recent.ts, and templateRows no longer takes a now argument, since time() reads the clock itself.
  • Doc: docs/features/template-recency.md loses the "plain text" line and names the shared element instead.
  • Tests: test/templates-alive.test.ts drops the tests of the old wording and now expects the <time> markup on the page and in templateRows. The terminal test only covers the empty case, so the "updated 3d ago" line in the terminal has no test of its own; the page test covers the shared wording.

The gate, the type check and the design lint are clean, and test/templates-alive.test.ts and test/templates-tui.test.ts pass (11 tests). scripts/fast.ts said the diff reaches 2,508 test files, about 212 minutes against a 5-minute budget. So I ran only those two, and the forge's check runs the rest on this push.

To try it on the preview, open /templates and hover a repository template's time to see the exact instant. In the terminal, search for a repository template and select it.

[{"go":"/templates","look":"a repository template's muted line","expect":"'updated' followed by a relative time like '3d ago' whose hover title is the exact UTC instant; 'no changes yet' when nothing has landed"},{"go":"/templates","look":"the Blank and Starter rows","expect":"no recency words"}]

🤖 Generated with Claude Code

commented

Template recency now uses the shared time element from src/web/time_element.ts instead of its own wording. On /templates a repository template's muted line reads "updated" followed by time(at): relative words, with the exact instant in datetime and title. The terminal's /templates says updated ${timeAgo(at)}, for example "updated 3d ago". recencyWords is deleted, templateRows no longer takes a now argument, and "no changes yet" (NO_CHANGES_YET) still covers a template with nothing landed. Built-in templates (Blank, Starter) show no recency at all. The doc's "plain text" line is replaced by a pointer to the shared element. The page tests now check the <time> markup, and the tests of the old wording are gone.

This pull also fixes a flaky test in test/engine-split.test.ts, the resuming-stream test, which was the one failure the check counted against it. Its read loop raced reader.read() against a 100 ms sleep. When the sleep won, the read was left waiting and the next loop started a new one, so the frame that first read received was never counted. That is the "missing event" the test reported. The loop now keeps one read in flight across iterations. Before the fix it failed about one run in four here; after it, it passed 10 of 10. The stream code itself is unchanged.

The other failures in the check are red on main at f365a56 as well, and this pull leaves them alone. The <time> test's only offender is src/web/pages/passkeys.ts:395, which this pull doesn't touch.

bun scripts/gate.ts --fix, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. test/engine-split.test.ts, test/templates-alive.test.ts and test/templates-tui.test.ts pass. The terminal's "updated 3d ago" line has no test of its own; the page test covers the shared wording.

[{"go":"/templates","look":"a repository template's muted line","expect":"'updated' then a relative time such as '3d ago' whose hover title is the exact UTC instant; 'no changes yet' when nothing has landed"},{"go":"/templates","look":"the Blank and Starter rows","expect":"no recency words"}]

🤖 Generated with Claude Code

commented

The template list on /templates shows how recently each template changed, through the shared time element. With main merged in, the page keeps both changes:

  • This branch: the template rows carry the recency column (templateRows(rows, held, used, recent)), and the page still imports templateRecency and NO_CHANGES_YET.
  • From main: the empty-forge notice. When no repository offers a template and nothing is being filtered, it shows below the rows. Admins see a link to /repos; everyone else sees TEMPLATES_EMPTY.

The only conflict was in src/web/pages/templates.ts, and both sides are kept as they were.

One change outside the page: in test/engine-split.test.ts, the line this branch changed earlier for the resuming-stream test now ends with a // real-timer: note. The 100 ms wait there is a read timeout on a live HTTP stream, so it can't run on a fake clock. Without the note, bun scripts/gate.ts --fix stopped on its no-real-timer rule.

After the merge, the gate, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. The template tests (test/templates*.test.ts, test/template*.test.ts: 103 tests across 20 files) and test/engine-split.test.ts (14 tests) pass. The type check ran on the committed merge just before the push; the other checks ran on the resolved tree first, and only the gate was run again after the real-timer note.

[
  {"go": "/templates", "look": "each template row", "expect": "a recency column showing when the template last changed, or the no-changes-yet wording"},
  {"go": "/templates?q=zzzz-no-match", "look": "the status line under the filter", "expect": "the no-match notice with a 'Show all templates' link"},
  {"go": "/templates", "look": "below the rows on a forge where no repository offers a template", "expect": "the empty notice; signed in as an admin it links to /repos"}
]

🤖 Generated with Claude Code

commented

Each row on /templates now shows how recently the template changed, through the shared time element. Repository templates with no changes yet show the no-changes-yet wording instead. This pull now includes main's template pictures, so a row has both a thumbnail and the recency line.

The conflict. Both sides had added a fourth optional argument to templateRows, so I combined them:

  • The new signature is templateRows(rows, held, used, recent, pictures), with recency fourth and pictures fifth. The page passes both.
  • main's templateInitial and thumb sit alongside this branch's sentence, which builds the muted line with the start count and the recency.

One test call changed. In test/templates-picture.test.ts, the pictures map moves from the fourth to the fifth argument. The test wasn't wrong; only the signature moved, and what it checks is the same.

The gate, bun x tsc --noEmit and bun scripts/design-lint.ts are clean after the merge. The template tests (test/templates*.test.ts, test/template*.test.ts: 108 tests across 21 files) pass.

[
  {"go": "/templates", "look": "each repository template row", "expect": "a picture thumbnail (or a box with its initial) on the left, and under the row a muted line with the start count and 'updated <time>' or the no-changes-yet wording"},
  {"go": "/templates?q=zzzz-no-match", "look": "the status line under the filter", "expect": "the no-match notice with a 'Show all templates' link"}
]

🤖 Generated with Claude Code

Approved

Earlier asks are met: the terminal door shows recency, the read is one grouped query, recency renders independent of used, the doc says row, and tests cover the TUI empty case and the page. Ids come from the visibility-gated templateList, so the grouped read leaks nothing. Output goes through the shared time(), which escapes. Preview shows no changes yet on a repository template and nothing on built-ins. Non-blocking: the TUI updated 3d ago branch has no test of its own, only the empty case.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs