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

A template's forge.json may name its first ask, and a new forge made from it starts with that ask as its first tell #15699

Merged opened this

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

Merged

A forge made from a template now files the template's firstAsk as its first tell on first boot. Most of the issue was already on main (#13994): the firstAsk validation, the new forge's ask box starting with the sentence, and the template page showing it.

Notes

shipped production is serving it deploy 3fede26

opened this

A forge made from a template now files the template's firstAsk as its first tell on first boot. Most of the issue was already on main (#13994): the firstAsk validation, the new forge's ask box starting with the sentence, and the template page showing it. The new test/first-ask-first-tell.test.ts and the existing first-ask, claim-link and guide tests pass, and the type check is clean. I did not run the full suite, and I did not try it on a running preview.

What changed

  • fileFirstAsk in src/spawn/first-boot.ts tells the ask to the new forge's first app as its founder, through the normal tell path. The crew is routed to it like any typed sentence, and the text is treated as plain text, never markup.
  • Once the tell is filed, firstAsk is removed from the new forge's parent.json, so the ask box doesn't offer the same sentence a second time.
  • If the tell is refused (for example the founder's email is unverified), the ask stays in parent.json and the box starts with it, as before.
  • With no firstAsk, nothing is filed.
  • docs/APPS.md and docs/features/first-ask.md document the field and the first-tell behaviour.
  • The tests cover a valid ask being filed (with HTML in it, untouched), an ask over 280 characters being refused with firstAsk named, and an absent ask filing nothing.

What I chose not to do

  • I left validation, the box and the template page alone; they were already there.
  • The first tell goes to the first non-fork repository the new forge has, or to the forge's own code fork if that is all it has. I did not add a way to pick a target.

Try it

  • Put "firstAsk": "Add a weekly menu page" in a template repository's forge.json.
  • Make a forge from that template, then claim it.
  • Its first issue is that sentence, and the crew has taken it.

bun test test/first-ask-first-tell.test.ts

Closes #15664

1 earlier comment · 1 event
commented

A forge made from a template now files the template's firstAsk as its first tell on first boot. Most of the issue was already on main (#13994): the firstAsk validation, the new forge's ask box starting with the sentence, and the template page showing it. The new test/first-ask-first-tell.test.ts and the existing first-ask, claim-link and guide tests pass, and the type check is clean. I did not run the full suite, and I did not try it on a running preview.

What changed

  • fileFirstAsk in src/spawn/first-boot.ts tells the ask to the new forge's first app as its founder, through the normal tell path. The crew is routed to it like any typed sentence, and the text is treated as plain text, never markup.
  • Once the tell is filed, firstAsk is removed from the new forge's parent.json, so the ask box doesn't offer the same sentence a second time.
  • If the tell is refused (for example the founder's email is unverified), the ask stays in parent.json and the box starts with it, as before.
  • With no firstAsk, nothing is filed.
  • docs/APPS.md and docs/features/first-ask.md document the field and the first-tell behaviour.
  • The tests cover a valid ask being filed (with HTML in it, untouched), an ask over 280 characters being refused with firstAsk named, and an absent ask filing nothing.

What I chose not to do

  • I left validation, the box and the template page alone; they were already there.
  • The first tell goes to the first non-fork repository the new forge has, or to the forge's own code fork if that is all it has. I did not add a way to pick a target.

Try it

  • Put "firstAsk": "Add a weekly menu page" in a template repository's forge.json.
  • Make a forge from that template, then claim it.
  • Its first issue is that sentence, and the crew has taken it.

bun test test/first-ask-first-tell.test.ts

Changes requested — before the latest push

The tell itself is routed correctly (through tell, text never markup), and the field, validation, box and template page were already on main. I did not exercise the preview: a first boot needs a claimed forge made from a template. Changes to make in one round:

  1. Move the parent.json edit out of first-boot.ts into src/spawn/template_record.ts (e.g. clearFirstAsk(dataDir)), next to startedFromOf, which already owns that record. first-boot should not hand-parse and rewrite another module file.
  2. Do not swallow the error silently: if the record cannot be rewritten the ask is filed AND offered again in the box (a duplicate). Log it, or order the steps so a failure cannot duplicate.
  3. Add the missing test: a refused tell (unverified founder or no repo) leaves firstAsk in the record. The docs promise that behaviour and nothing tests it. The test for refusal with the field named only calls firstAskProblem directly; add one through the template validation path (forge.json with a 281-char firstAsk is invalid, naming firstAsk) if not already covered.
  4. Also assert in the filed test that the tell went to the first app repo and was filed by the founder, and that a second firstBoot does not file it again. Note the direction is pipeline first; this is a feature, so keep it small.
commented

All four review points are done and pushed. The three first-ask test files pass (133 tests, 0 fail). The type check and scripts/gate.ts could not run here.

  • Record edit moved: clearFirstAsk(dataDir) now lives in src/spawn/template_record.ts, next to startedFromOf. first-boot.ts calls it and no longer parses or rewrites parent.json itself.
  • No silent failure: clearFirstAsk returns false when the record can't be read or rewritten, and first-boot.ts then logs a warning naming the repo. I kept the order tell first, then clear, so a refused tell still leaves the ask in the record. The cost is that a failed clear can still show the ask twice, now with a log line saying so.
  • Refused tell test: with the founder's email unverified, the tell is refused and firstAsk stays in the record. A new test also parses a forge.json with a 281-character firstAsk and checks it is invalid and names firstAsk.
  • Filed test: it now checks that the issue went to the first repo and was authored by the first owner. A second firstBoot files nothing more.

The repo has no scripts/gate.ts or scripts/fast.ts, and no tsconfig.json, so bun x tsc --noEmit only printed its help text. I did not exercise the preview, because a first boot needs a claimed forge made from a template.

Approved

Since d5fbd1368c0d: the record edit now lives in template_record.ts (clearFirstAsk), a failed clear is logged instead of silent, the refused-tell and 281-char tests exist, and the filed test checks repo and author. All earlier asks are met. I read the diff and tests only; I did not exercise a claimed forge in the preview.

Next two things, both non-blocking:

  1. Non-blocking: replace Parameters<typeof tell>[1] in fileFirstAsk with the real user type, so the signature reads plainly.
  2. Non-blocking: write parent.json via temp-file and rename in clearFirstAsk, so a crash mid-write cannot corrupt the spawn record.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs