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

A forge made from a template says so on its home in one line: Started from <template> #13345

Merged opened this

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

Merged

A forge made from a template now shows one muted line on its home, "Started from ", under its "Your forge: " line. Changes It reads the template entry of the forge's own parent.json. The stored name is printed and HTML-escaped.

Notes

shipped production is serving it deploy 59903fa

opened this

A forge made from a template now shows one muted line on its home, "Started from <template>", under its "Your forge: <address>" line.

Changes

  • It reads the template entry of the forge's own parent.json. The stored name is printed and HTML-escaped.
  • A built-in template prints its title, for example "Starter app". A template repository prints its owner/name.
  • The name links to /<owner>/<name> only while that repository is still marked as a template in this forge and the viewer can read it. If it was unmarked or isn't readable, the name stays as plain text.
  • No template, blank, or a malformed record shows no line.
  • The line appears on both homes: the lean first-apps home and the full lanes home. The new module is src/web/started_from.ts; the validated reader, startedFromOf, is in src/spawn/template_record.ts.

Tests

  • test/started-from-line.test.ts covers the linked case, the unmarked case (named, not linked), a built-in template, and no line for no template, blank or a bad record. It also requests / and checks the line is present or absent.
  • That file and spawn-template-record pass.
  • tsc, gate.ts --fix and design-lint are clean.
  • I did not run the full suite. The forge's check does that on push.

Left out

  • Built-in templates have no page, so they are never linked.
  • No commit or version is shown. The existing "Made from … at <sha>" row on settings still carries that.
  • The escaping test is weak. It shows that malformed names are rejected, so an unsafe name never reaches the page. It does not feed a hostile name through the renderer, which I rely on the html helper to escape.

Try it: spawn a forge with template: starter or a marked template repository, sign in as its owner, and open /.

Closes #13322

4 earlier comments · 1 event
commented

A forge made from a template now shows one muted line on its home, "Started from <template>", under its "Your forge: <address>" line.

Changes

  • It reads the template entry of the forge's own parent.json. The stored name is printed and HTML-escaped.
  • A built-in template prints its title, for example "Starter app". A template repository prints its owner/name.
  • The name links to /<owner>/<name> only while that repository is still marked as a template in this forge and the viewer can read it. If it was unmarked or isn't readable, the name stays as plain text.
  • No template, blank, or a malformed record shows no line.
  • The line appears on both homes: the lean first-apps home and the full lanes home. The new module is src/web/started_from.ts; the validated reader, startedFromOf, is in src/spawn/template_record.ts.

Tests

  • test/started-from-line.test.ts covers the linked case, the unmarked case (named, not linked), a built-in template, and no line for no template, blank or a bad record. It also requests / and checks the line is present or absent.
  • That file and spawn-template-record pass.
  • tsc, gate.ts --fix and design-lint are clean.
  • I did not run the full suite. The forge's check does that on push.

Left out

  • Built-in templates have no page, so they are never linked.
  • No commit or version is shown. The existing "Made from … at <sha>" row on settings still carries that.
  • The escaping test is weak. It shows that malformed names are rejected, so an unsafe name never reaches the page. It does not feed a hostile name through the renderer, which I rely on the html helper to escape.

Try it: spawn a forge with template: starter or a marked template repository, sign in as its owner, and open /.

commented

The home page now shows "Started from <template>" on a forge made from a template. The check failed because the pull's commits were missing two gate lines, and I've added them in a new commit.

  • Looks: / is already in app.looks, so the forge can take the before/after pictures of the home page on the preview.
  • No door: the note is a muted provenance line with nothing to act on, so I didn't add a terminal screen or a how-to.

No code changed. bun scripts/gate.ts now passes with no output. I didn't run tsc or the tests again.

Changes requested — before the latest push

The line itself is right: one muted p, plain words, escaped by the html helper, no JS needed, and it shows on both homes. Two things to fix in one round. (1) First: the escaping test never runs a hostile name through the renderer (box 3). (2) The change has no how-to under docs/features/ and no terminal counterpart. A one-line provenance note may not need a TUI screen, but then say so in a docs/features/started-from.md (not README) and have the TUI home show the same line from startedFromOf, so both doors agree. Smaller: the unrelated comment rewraps in home_flow.ts bury the real diff; keep them only if gate.ts --fix demands them, and put the new import with the other ../ imports.

commented

Both of juniper's points are fixed and pushed, and the home_flow.ts rewraps are gone from the diff.

  • Hostile name test: I split startedFromLine so a StartedFrom value can go straight to the renderer as startedFromHtml. The new test passes it alice/<b>x</b> and <img src=x onerror=1>. It asserts the output contains &lt;b&gt; and &lt;img and never the raw tags, so it fails if escaping is removed. I did this through the renderer because the stored-name regex can't hold a <, so a hostile name can't come from parent.json.
  • Terminal home: the dashboard (src/tui/screens/dashboard.ts) now shows the same muted "Started from <name>". It reads the same record through startedFromOf, via startedFromText. It is shown to signed-in users and hidden from guests, like the web page. A test checks the terminal text against the record.
  • How-to: added docs/features/started-from.md, not in the README.
  • home_flow.ts: it is restored from main and now carries only the new import and the one line. The new import sits with the other ../ imports there and in studio/home.ts. gate.ts only notes the over-long comment lines and says the nightly rewrap handles them, so I did not run --fix.
  • Gate lines: the new commit message carries Looks: /. I dropped the earlier No door: line because the pull now has both doors.

Checks I ran:

  • bun scripts/gate.ts: passes (it prints only the rewrap note above).
  • bun x tsc --noEmit: clean.
  • The started-from, features and TUI dashboard/pins tests: 58 pass, 0 fail.
  • bun scripts/fast.ts reported 2213 files for this diff, too many to run here, so I ran the 5 files above and left the full check to the forge.

The terminal line is not drawn when the owner has not yet made their first tell, as everydayHead does. Say if you want it hidden then too.

commented

A forge made from a template now says so under its address on / and on the terminal home: "Started from <template>". The "pipeline first" gate had refused the first push of this pull, and the fix for that is now pushed.

  • What I changed this round: this feature touches no pipeline files, so I added a Direction: line to the commit message, which is the gate's own way past that rule. The line says the feature is small and self-contained, and that no pipeline item blocks it or depends on it. That justification is my own wording, so please confirm it holds.
  • Comments: I ran bun scripts/gate.ts --fix, which rewrapped long comments in dashboard.ts, home_flow.ts and started_from.ts. That is the only code change.
  • Checks run: bun x tsc --noEmit ran, but its output was lost in a timed-out command, so I did not see its result. The started-from tests pass (6 of 6). scripts/fast.ts named 2213 files, so I did not run them and left the full check to the forge.
  • What I left out: nothing new. The feature's scope is unchanged from the earlier push.
  • To try it: open / on a forge made from a template and read the muted line under its address.
commented

Fixed the two failures this pull caused: docs/features/started-from.md had no row in the feature index. I added one to docs/features/README.md, and both test/feature-orphans.test.ts tests now pass. I pushed it.

I did not fix the other three failures. I think they are timing flakes unrelated to this change:

  • The card test: it passes here when run alone (test/og-map.test.ts), though it took 10 s and the check reported it failing at 468 ms.
  • The standby test: it failed at 5.03 s in the check, over the 2 s per-test budget the check applies. I did not run it here.
  • The concurrent-runs test: it hit a 120 s timeout in the check. I did not run it here.

The check's own comparison against main only covered test/feature-orphans.test.ts and test/quotas-running.test.ts, and found the first green on main.

bun scripts/gate.ts --fix and bun x tsc --noEmit came back clean. If the check goes red again on those three, they are the ones to look at.

Approved

Earlier asks: the hostile-name test now runs through startedFromHtml (met); the terminal home shows the same line via startedFromText, hidden from guests (met); docs/features/started-from.md is added with an index row and README is untouched (met). The line is a plain muted p.small.muted with no box, no new accent, and a link only where the template is still offered and readable, so it works with JavaScript off. It reads the forge own parent.json and validates the shape, so nothing user-typed reaches the page unescaped.

Two things I would do next:

  1. Non-blocking: test the dashboard screen itself (the strip drawn, absent for a guest). Only startedFromText is covered now.
  2. Non-blocking: the gate --fix rewraps of unrelated comments in dashboard.ts and home_flow.ts bury a small change. Next time commit them separately, and import getRepo at the top of the test instead of dynamically.

Direction: this is a feature ahead of the pipeline list. It is small, touches no pipeline files, and the commit carries the gate Direction line, so I let it land.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs