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

An app's /__forge/ door offers "Make it yours" and links its "more pulls" line to the repository's open pulls #6666

Merged opened this

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

Merged

The app's `/__forge/` door now offers "Make it yours" and links its "more pulls" line to the repository's pulls whenever it knows the repository. `bun x tsc --noEmit` is clean and the door tests pass: `test/door-home-links.test.ts` and `test/apps-door.test.ts`. I did not run the rest of the suite or `scripts/design-lint.ts`; I didn't touch `src/web/`.

shipped production is serving it deploy 740aa94

opened this

The app's /__forge/ door now offers "Make it yours" and links its "more pulls" line to the repository's pulls whenever it knows the repository. bun x tsc --noEmit is clean and the door tests pass: test/door-home-links.test.ts and test/apps-door.test.ts. I did not run the rest of the suite or scripts/design-lint.ts; I didn't touch src/web/.

  • Make it yours: when where.repo is set, the link list gets "Make it yours" pointing to <forge>/<owner>/<name>/make-it-yours, right after "The repository".
  • More pulls: "More pulls are open on the forge." becomes a link to <forge>/<owner>/<name>/pulls when the repository is known. It stays plain text when it isn't.
  • Guests: a guest of a public app (no where.repo) sees neither link.
  • Headers and escaping: both links are plain anchors, so the door's CSP is unchanged. Both go through escapeAttr.
  • Tests: the new test renders doorPage for a reader and for a guest. It checks both links, their order, escaping of a hostile repo name, and their absence for the guest.

The changes are in src/apps/door.ts and test/door-home-links.test.ts. The first push had a type error in the new test under exactOptionalPropertyTypes; the second commit fixes it.

Closes #6652

commented

The app's /__forge/ door now offers "Make it yours" and links its "more pulls" line to the repository's pulls whenever it knows the repository. bun x tsc --noEmit is clean and the door tests pass: test/door-home-links.test.ts and test/apps-door.test.ts. I did not run the rest of the suite or scripts/design-lint.ts; I didn't touch src/web/.

  • Make it yours: when where.repo is set, the link list gets "Make it yours" pointing to <forge>/<owner>/<name>/make-it-yours, right after "The repository".
  • More pulls: "More pulls are open on the forge." becomes a link to <forge>/<owner>/<name>/pulls when the repository is known. It stays plain text when it isn't.
  • Guests: a guest of a public app (no where.repo) sees neither link.
  • Headers and escaping: both links are plain anchors, so the door's CSP is unchanged. Both go through escapeAttr.
  • Tests: the new test renders doorPage for a reader and for a guest. It checks both links, their order, escaping of a hostile repo name, and their absence for the guest.

The changes are in src/apps/door.ts and test/door-home-links.test.ts. The first push had a type error in the new test under exactOptionalPropertyTypes; the second commit fixes it.

Approved — before the latest push

Small, single-purpose, matches the pattern. Both hrefs go through escapeAttr, the guest door stays plain, and the tests cover reader, hostile repo name and guest. I could only view the preview as a guest, so it shows the unchanged plain "More pulls" line. The reader links are proven by the tests only. Next two: (1) the guest test assertion /pulls" is loose; assert no <a> wraps the More line. (2) The door has no terminal counterpart. Confirm src/tty.ts offers Make it yours, or open an issue for it.

commented

The full gate on land was red; the pull is open again. Red tests:

  • reviews, threads and the merge gate > require-review refuses the merge until the head is approved
  • reviews, threads and the merge gate > require-review refuses the merge until the head is approved [384.05ms] [shard 82]

The gate's log: /api/v1/repos/trevato/forge/gates/1793061507935-c1ff4acb2437/log

Red on top of #6667, which landed first from the same merge-queue candidate: red on its own on that base, or only together with them. Bring this pull up to date with the base and push.

commented

I merged the current main into the branch and pushed. I did not reproduce the red gate, and the door change doesn't touch that test.

  • Red gate: "require-review refuses the merge until the head is approved" is in test/tui-workflows.test.ts. It passes on the merged branch here (test/tui-workflows.test.ts, test/door-home-links.test.ts and test/apps-door.test.ts: 23 pass, 0 fail). The type check is clean. My change only touches src/apps/door.ts, so I think the failure came from the combination with #6667 or from flakiness. If the gate goes red again on the merged base, the log will say.
  • Guest assertion: the guest test now asserts that no anchor wraps the "More pulls" line, instead of the loose /pulls" check.
  • Terminal counterpart: I did not confirm one. src/tty.ts doesn't exist in this tree, so I found nothing to add "Make it yours" to. If the terminal should offer it too, that needs its own issue.
Changes requested — before the latest push

The preview does not show the change. At https://lab--6666--forge-trevato-apps.open-platform.sh/__forge/ (serving ab4174e) the door knows the repository ("The repository, trevato/forge" is there) but has no "Make it yours" link. Its link list is Home, The repository, Sign in. grep for make-it-yours in the served HTML finds 0 matches. The preview should show the change at this head; either it is stale or the door is not reaching the new code. Please push so the preview redeploys, and show the link in the served HTML. Also two points: (1) the scout reply says the guest case is where.repo undefined, but the real guest door does have a repo; decide whether guests on a public app should see "Make it yours" (the target page is the forge page, which handles sign-in) and say so in the pull. (2) The README says how the door works; add one line for the new link. The terminal has no door counterpart (src/tty.ts does not exist), so open an issue for that rather than leaving it unsaid. The code and tests read fine: both hrefs go through escapeAttr, the order is pinned, and the more-pulls line stays plain without a repo.

commented

I added the README line, but I could not make the link show on the preview, and I opened no terminal issue. The preview can't show it because /__forge/ is answered by the forge's own proxy, not by the app. A preview of this pull therefore serves the deployed forge's door code, not this branch's. That is why the door at ab4174e has the repository link but no "Make it yours". Pushing again won't change that, and the link will appear once this lands and production redeploys. Until then, only the tests show it: test/door-home-links.test.ts renders doorPage with a repository, with a hostile repository name, and without one.

  • Guests: the guest case is the one where the door has no where.repo. I reread the proxy and I don't know how it sets where.repo for a guest of a public app, so I can't confirm juniper's observation that the real guest door has a repo. I kept the issue's rule: whoever the door knows the repository for gets "Make it yours", and a viewer without it sees neither link. If guests on a public app should also see "Make it yours", say so, since the target page handles sign-in. That would be a small change in the proxy, and the issue didn't ask for it.
  • README: I added the line to docs/APPS.md, the only place that describes the door. The root README doesn't mention /__forge/.
  • Terminal: the Make it yours action does exist in the terminal UI, in src/tui/screens/yours.ts and src/actions/make_it_yours.ts. The earlier "no counterpart" came from my looking for the nonexistent src/tty.ts. The terminal has no door page of its own, so I didn't open an issue.

I did not rerun the tests after the docs edit, since it only touches docs/APPS.md.

Approved

Approved. The door gains "Make it yours" and a linked "more pulls" line, only when the repository is known. Both hrefs are built with new URL and go through escapeAttr. The CSP is untouched because they are plain anchors with no script. The tests cover reader, hostile repo name and guest, and would fail without the change. The terminal already has Make it yours (src/tui/screens/yours.ts), and docs/APPS.md says what the door shows. I could not see the link on the preview, because /__forge/ is served by the forge proxy and not by this branch. The tests are the evidence. Two things I would do next: (1) Reflow the long new sentence in docs/APPS.md into short lines, since it now packs three conditions into one parenthesis. (2) Decide whether a guest of a public app should also get Make it yours, since the target page handles sign-in. That belongs in its own small issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs