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

A template page shows how long its last forge took from the click to a first live change, as one line #13454

Merged opened this

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

Merged

Template pages now show one line, "Last forge from this template reached its first change in ", read from stored spawn events. With no recorded spawn there is no line. The new test/template-timing.test.ts, the "started from" test and the route-marks test pass.

Notes

shipped production is serving it deploy 59903fa

opened this

Template pages now show one line, "Last forge from this template reached its first change in <time>", read from stored spawn events. With no recorded spawn there is no line. The new test/template-timing.test.ts, the "started from" test and the route-marks test pass. bun x tsc --noEmit, bun scripts/design-lint.ts, bun scripts/gate.ts and the MCP-size, feature-orphans, reserved-names and hot-reads tests also pass. I did not run the full suite; the forge's check does that on the push. I did not try the page on a running app.

What changed

  • Pages: /templates/<name> is new for built-in templates (starter; blank has no page). /templates/<owner>/<name> is new for template repositories. It is a 404 unless the repository is marked as a template and the viewer can read it.
  • Where the number comes from: forge.spawn.live already records the milliseconds from the click to the child's first /healthz answer. It now also records the template (spawn/live.ts, spawn/door.ts). src/actions/template_timing.ts reads the newest real, non-drill event for that template, so there is no new table and nothing is measured on the page request.
  • Reaching it: a forge's "Started from" link now goes to the template page instead of the repository. I updated that test's expected href. The terminal Template screen prints the same line.
  • Other edits: I added templates to the reserved names, since /templates/... would otherwise clash with a user of that name. I also added the route mark, docs/features/template-timing.md and its row in the feature index.

Left out

  • Forges made before this change have no template on their event, so they don't count. The line stays empty for a template until its next real spawn goes live.
  • There is no MCP tool; it is a page and a terminal line only. test/mcp-size.test.ts passes untouched.
  • The line shows the single latest spawn, not an average.
  • There is no look picture, because the line only appears after a real spawn. The commit carries No look: and No door: lines saying so.

Try it Open /templates/starter, or /templates/<owner>/<name> for a marked repository, on the preview. The line shows once a forge has been spawned from that template and gone live. Before that, the page shows only the template's description.

🤖 Generated with Claude Code

Closes #13431

4 earlier comments · 1 event
commented

Template pages now show one line, "Last forge from this template reached its first change in <time>", read from stored spawn events. With no recorded spawn there is no line. The new test/template-timing.test.ts, the "started from" test and the route-marks test pass. bun x tsc --noEmit, bun scripts/design-lint.ts, bun scripts/gate.ts and the MCP-size, feature-orphans, reserved-names and hot-reads tests also pass. I did not run the full suite; the forge's check does that on the push. I did not try the page on a running app.

What changed

  • Pages: /templates/<name> is new for built-in templates (starter; blank has no page). /templates/<owner>/<name> is new for template repositories. It is a 404 unless the repository is marked as a template and the viewer can read it.
  • Where the number comes from: forge.spawn.live already records the milliseconds from the click to the child's first /healthz answer. It now also records the template (spawn/live.ts, spawn/door.ts). src/actions/template_timing.ts reads the newest real, non-drill event for that template, so there is no new table and nothing is measured on the page request.
  • Reaching it: a forge's "Started from" link now goes to the template page instead of the repository. I updated that test's expected href. The terminal Template screen prints the same line.
  • Other edits: I added templates to the reserved names, since /templates/... would otherwise clash with a user of that name. I also added the route mark, docs/features/template-timing.md and its row in the feature index.

Left out

  • Forges made before this change have no template on their event, so they don't count. The line stays empty for a template until its next real spawn goes live.
  • There is no MCP tool; it is a page and a terminal line only. test/mcp-size.test.ts passes untouched.
  • The line shows the single latest spawn, not an average.
  • There is no look picture, because the line only appears after a real spawn. The commit carries No look: and No door: lines saying so.

Try it Open /templates/starter, or /templates/<owner>/<name> for a marked repository, on the preview. The line shows once a forge has been spawned from that template and gone live. Before that, the page shows only the template's description.

🤖 Generated with Claude Code

commented

I couldn't reproduce the failure here, so the fix I pushed is a best guess and the next check will show whether it worked. In the forge's check, test/started-from-line.test.ts and test/template-timing.test.ts both threw mark in beforeAll. Run locally, both pass.

The mark error means updateRepoSettings refused to mark the repo as a template in that environment. I found nothing in my source changes that would cause that refusal.

  • Changed: both tests now pass updateRepoSettings a fresh getRepo read instead of the object createRepo returned. That is what test/spawn-template.test.ts does. I think the stale object is the likeliest difference, but I haven't confirmed it.
  • Diagnostics: the thrown error now includes the refusal code (mark: <code>). If the check still fails, its log will say why.
  • Run: the two test files pass, and tsc and scripts/gate.ts --fix are clean. I did not run the full suite.

The feature is as before. A template page shows "Last forge from this template reached its first change in …", read from the newest forge.spawn.live event. The template is now recorded on that event. I did not add a table or any new measurement. /templates/<owner>/<name> is the new page, and templates is now a reserved name. In test/started-from-line.test.ts the "Started from" link is now expected to point at /templates/alice/kit instead of /alice/kit.

🤖 Generated with Claude Code

commented

A template page now shows how long its last forge took, from the click to the first live change. It reads stored events, shows nothing when no forge has been recorded, and is on both the web page and the terminal screen.

This push fixes the failed check, which was a duplicate "/templates" entry in src/http/route_marks.ts. Main already had that mark, so I dropped mine.

Main had also moved, so I merged it into the branch:

  • Conflict in src/tui/screens/template.ts: main added a "Flagged: …" line there. The screen now shows that line first and the timing line below it, each only when it applies.
  • Test change in test/template-timing.test.ts: marking a template now validates its forge.json, which made the test's mark step fail. The test was wrong, not the code, so it now seeds a valid forge.json.

Checks run here:

  • tsc --noEmit is clean.
  • template-timing, templates-page, templates-tui, route-marks and repo-template-flag pass, 37 tests in all.
  • I did not run the rest. scripts/fast.ts named 2,841 of 3,438 test files, which is too broad to run here, so the forge's full check covers the rest.

To try it, open /templates/<owner>/<name> on the preview after a forge has been started from that template.

🤖 Generated with Claude Code

commented

The branch merges cleanly with main again, and I pushed it. Earlier, a merge went into the branch with conflict markers still in test/started-from-line.test.ts, which is what failed the check.

  • Markers: I took main's version of that test and merged main again.
  • Link in the started-from line: the "Started from" line on a forge's home now links to the template's page (/templates/<owner>/<name>) instead of the repository, which is deliberate in this change. I updated test/started-from-line.test.ts to expect that link.
  • Checks: the three template test files (16 tests) and tsc --noEmit pass here. I did not run the full suite.

What the pull does:

  • A template page shows how long its last forge took, from the click to the first live change, as one line read from stored events.
  • Nothing is shown when no forge has been recorded.
  • It appears on /templates/<owner>/<name> and on the terminal template screen. There it sits below main's "Flagged: …" line when both apply.

To try it, open /templates/<owner>/<name> on the preview after a forge has been started from that template.

🤖 Generated with Claude Code

Changes requested — before the latest push

The feature works: /templates/starter answers 200 on the preview, the number comes from stored forge.spawn.live events, and no line shows without a spawn. One change is needed before it lands: the duplicate reserved name below (Clean). Also drop the unrelated comment rewrap in live.ts and simplify the odd now: () => (t += 0) + 12_400 in the test.

commented

All three changes from @sentinel are in and pushed.

  • src/core/reserved.ts: removed my duplicate "templates" entry, since main already reserves it.
  • src/spawn/live.ts: reverted the rewrap of the GIVE_UP_MS comment. gate.ts only notes the long comment line; it doesn't require the rewrap. The comment I added for the template field is still there, and it wraps within 100 columns.
  • test/template-timing.test.ts: the clock is now now: () => 13_400 and the unused t is gone.

tsc --noEmit is clean. test/template-timing.test.ts and the reserved-name tests pass (28 tests). I did not run the rest of the suite.

🤖 Generated with Claude Code

Approved

All three earlier asks are met in this head: the duplicate reserved-name entry is gone, the GIVE_UP_MS comment rewrap is reverted, and the test clock is now 13_400 with no unused variable. /templates/starter answers 200 on the preview. The line is read from stored forge.spawn.live events and drills are excluded. A terminal screen and docs/features/template-timing.md are in place, and README is untouched. Tests cover both with and without a recorded spawn. I found nothing new to raise.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs