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

A preview's /__forge/ door links the pull it previews, with its title #6052

Merged opened this

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

Merged

A preview's `/__forge/` door now turns "pull #N" into a link to `<forge>/<owner>/<name>/pulls/N` and adds the pull's title after it, escaped. `test/apps-door.test.ts` passes (10 tests) and the type check is clean. I did not run the whole suite or `design-lint` (no `src/web/` change). The forge runs the full check on the push.

shipped production is serving it deploy 9e284d9

opened this

A preview's /__forge/ door now turns "pull #N" into a link to <forge>/<owner>/<name>/pulls/N and adds the pull's title after it, escaped. test/apps-door.test.ts passes (10 tests) and the type check is clean. I did not run the whole suite or design-lint (no src/web/ change). The forge runs the full check on the push.

  • Change: only the "where" line in src/apps/door.ts changed, so it should not collide with #5988. src/apps/proxy.ts needed no change, because pillWhere already gates the repo name and the title on the viewer's rights.
  • Who sees what: the link and title show only when the viewer may read the repository and the pull. Anyone else gets the plain "preview of pull #N" with no title. Production's door is unchanged.
  • Tests: a new test covers a guest on a public repo, who sees the link and the escaped title. For a private repo it runs the door page directly with the facts a non-reader would get, and checks that the number is unlinked and the title absent. It does not make a real request as a guest on the private preview, which stays hidden behind the 404 that test already checks. I also edited one existing assertion in the same file. It expected the old unlinked text, so I changed it to the new markup.
  • Not done: the link has no link-text styling beyond the browser default, and the issue didn't ask for any.

Closes #6046

commented

A preview's /__forge/ door now turns "pull #N" into a link to <forge>/<owner>/<name>/pulls/N and adds the pull's title after it, escaped. test/apps-door.test.ts passes (10 tests) and the type check is clean. I did not run the whole suite or design-lint (no src/web/ change). The forge runs the full check on the push.

  • Change: only the "where" line in src/apps/door.ts changed, so it should not collide with #5988. src/apps/proxy.ts needed no change, because pillWhere already gates the repo name and the title on the viewer's rights.
  • Who sees what: the link and title show only when the viewer may read the repository and the pull. Anyone else gets the plain "preview of pull #N" with no title. Production's door is unchanged.
  • Tests: a new test covers a guest on a public repo, who sees the link and the escaped title. For a private repo it runs the door page directly with the facts a non-reader would get, and checks that the number is unlinked and the title absent. It does not make a real request as a guest on the private preview, which stays hidden behind the 404 that test already checks. I also edited one existing assertion in the same file. It expected the old unlinked text, so I changed it to the new markup.
  • Not done: the link has no link-text styling beyond the browser default, and the issue didn't ask for any.
Approved — before the latest push

Read the diff and door.ts/proxy.ts pillWhere: the link and title are gated on canRead plus mayView, the title and href are escaped, the change is one small function, and production is untouched. Caveat: the preview at this head still serves the pre-#5969 door (no pre style, plain "preview of pull #6052"), so I could not see the link live. It looks like a stale deploy, not this code. Next: (1) the private-repo test builds DoorFacts by hand, so it checks the renderer and not the proxy; add a real guest request against the private preview that asserts the 404 or the number-only line. (2) whereLine uses string replace on the escaped words; build the line from where.pull directly so it cannot drift from doorWhere.

commented

I merged main into this branch and pushed it. The only conflict was in src/apps/door.ts.

  • Resolution: I kept both changes. The "where" line still links the pull number and shows its title for a viewer who may read it. The page also still shows the serving and release history that came from main.
  • Checks: bun test test/apps-door.test.ts passes (10 tests) and bun x tsc --noEmit reports no errors. I did not run the full suite or open the preview. The forge will run its check on the push.
commented

I merged main into the branch, resolved the one conflict in src/apps/door.ts, and pushed. The type check is clean and the 12 door tests pass. I did not run the full suite; the forge's check does that on the push.

The conflict was in the door page's body line. Both sides had changed it, so the merged line keeps both changes:

  • From this pull: whereLine(where, forgeUrl), which carries the link to the pull.
  • From main: the "Open pulls" list, pullsHtml(facts.pulls), placed after the serving block.
Approved

Approved. The where line links the pull number and shows the escaped title only when pillWhere carries them (the viewer may read the repo). Everything is escaped and the CSP is intact. The preview door for a guest on this private repo correctly shows the plain "preview of pull #6052", with no title or link and the rest of the page intact. Two things I would do next: (1) the private-repo test builds doorPage facts by hand, so add one request-level test that a signed-out guest on a private preview gets no title; (2) the link text sits next to the "Preview of #N at <sha>" line, so consider dropping that duplicate once the title shows.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs