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

A forge started from a template names the template and its commit on its settings page #13959

opened this

Merged 17d 22h ago, live in production

Settings now reads "Started from at ", and the template name links to its page. The settings test file and tsc pass; design-lint printed no findings. The full suite wasn't run here.

Notes

opened this

Settings now reads "Started from <template> at <short id>", and the template name links to its page. The settings test file and tsc pass; design-lint printed no findings. The full suite wasn't run here.

Most of this was already on main. #13038 and #13064 store the template and its commit at creation, so older forges and forges started from nothing already show no row. #13064 also added the settings row, but it read "Made from" and had no link. This change only fixes that row.

  • Link: the name links to /templates/<owner>/<name> only while that repository is still marked as a template and the viewer can read it. Otherwise the name is plain text, with the same rule as the home-page line.
  • Code: the row is in src/web/pages/account.ts, built by a new madeFromHtml in src/web/started_from.ts.
  • Tests: I updated the existing assertion in test/spawn-template-record.test.ts for the new label and link. I added a test that the name stays unlinked once the template is unmarked. I did not create the test/settings-template-source.test.ts the issue lists, since the existing file already starts from a template and reads the line.
  • Not changed: the terminal screen still says "Made from", and the docs/features/made-from.md edit was a plain find-and-replace, not reviewed.

To try it, start a forge from a marked template repository and open /settings.

Closes #13946

7 earlier comments
commented

Settings now reads "Started from <template> at <short id>", and the template name links to its page. The settings test file and tsc pass; design-lint printed no findings. The full suite wasn't run here.

Most of this was already on main. #13038 and #13064 store the template and its commit at creation, so older forges and forges started from nothing already show no row. #13064 also added the settings row, but it read "Made from" and had no link. This change only fixes that row.

  • Link: the name links to /templates/<owner>/<name> only while that repository is still marked as a template and the viewer can read it. Otherwise the name is plain text, with the same rule as the home-page line.
  • Code: the row is in src/web/pages/account.ts, built by a new madeFromHtml in src/web/started_from.ts.
  • Tests: I updated the existing assertion in test/spawn-template-record.test.ts for the new label and link. I added a test that the name stays unlinked once the template is unmarked. I did not create the test/settings-template-source.test.ts the issue lists, since the existing file already starts from a template and reads the line.
  • Not changed: the terminal screen still says "Made from", and the docs/features/made-from.md edit was a plain find-and-replace, not reviewed.

To try it, start a forge from a marked template repository and open /settings.

commented

<!-- look-pages 08230f493fc3 --> Look pages for 08230f4, from the gate:

  • look pages (inferred): this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The terminal now shows the same line as the settings page, which clears the "both doors" gate failure. I haven't seen the forge's check re-run on this push.

  • Terminal change: src/tui/screens/madefrom.ts now says "Started from <template> at <short id>". Its screen title and palette entry are renamed to match.
  • Test: I updated the terminal assertion in test/spawn-template-record.test.ts to the new wording.
  • Local checks: tsc is clean. test/spawn-template-record.test.ts and test/templates-tui.test.ts pass (13 tests). gate.ts --fix rewrapped one comment, and that is committed.
  • Gate output: the local gate.ts run still printed the "both doors" message, but that ran before the terminal change was committed, so it was reading the old diff.

The terminal line is plain text with no link, since the terminal has no link to follow.

commented

<!-- look-pages 6bb74a88c6be --> Look pages for 6bb74a8, from the gate:

  • look pages (inferred): this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The gate's look-page list was too wide, so I narrowed it to /settings with a Looks: /settings line in a new commit message and pushed. No code changed in this round.

The gate listed about 29 pages because src/web/started_from.ts is imported by many routes, including home. The only page whose output changed is /settings, which now says "Started from <template> at <short id>". The other routes that import that file use its existing home-page function, which this pull didn't touch.

If you want a different page pictured as well, name it and I'll add it.

commented

<!-- look-pages cc4cb5852dc2 --> Look pages for cc4cb58, from the gate:

  • look pages (inferred): "Looks: /settings" is not a page of app.looks in forge.json; this pull changes src/web/pages/account.ts, src/web/started_from.ts; the forge pictures / (src/web/started_from.ts), /docs (src/web/started_from.ts), /explore (src/web/started_from.ts) and 23 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The look-pages feedback was about a commit message, so I fixed it with a new commit that carries a No look: line. No code changed. I didn't run the type check or tests, and gate.ts wasn't run either.

The gate said Looks: /settings isn't a page in app.looks in forge.json, and it fell back to guessing 26 pages from the routes that import src/web/started_from.ts. Only the /settings row changes, and the other pages just import the shared module without their output changing.

I didn't add /settings to app.looks. The Started from row only shows for a forge started from a template, and I don't think any look page is one, so a look of it wouldn't show the change. I haven't confirmed that against the look fixtures. If you want a look of it anyway, say so and I'll add /settings to app.looks.

commented

I've fixed all three points and pushed. Type check passes and gate.ts --fix ran with nothing to rewrap. The two test files covering this change pass (14 tests).

  • Doc: docs/features/made-from.md now says the terminal prints Started from <template> at <short sha>. The Settings line says the name links to /templates/<owner>/<name> only while that repository is still marked as a template and the viewer can read it. Otherwise it is plain text.
  • Shared wording: shortCommit() in src/spawn/template_record.ts now owns the 7-character short id. madeFromLine (the terminal) and madeFromHtml (the settings row) both call it, so the length can't drift. I did not merge the <template> at <short id> phrase itself. The web side still writes the at around a linked name, and the tests pin both outputs.
  • Test: the template-flag restore in test/spawn-template-record.test.ts is now in a finally, so a failed assertion can't leak state into later tests.

The test run printed a sandbox denial for an outbound request to kid--localhost:80. The tests still passed.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs