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

A pull opened by a stranger shows its status link on the pull page's head, copyable in one tap #16009

Merged opened this

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

Merged

A pull that an outsider opened through an offer now shows its status link to writers on the pull page. It sits in the head as one line with a Copy button, and a pull nobody outside opened shows no such line.

Notes

shipped production is serving it deploy 3fede26

opened this

A pull that an outsider opened through an offer now shows its status link to writers on the pull page. It sits in the head as one line with a Copy button, and a pull nobody outside opened shows no such line. test/outsider-status.test.ts, test/pull-page-phases.test.ts and test/pages-budget.test.ts pass, as do tsc, the gate and the design lint. I did not run the full suite, and scripts/fast.ts named 2446 files, so I ran those three instead. The forge's check runs the rest on this push.

  • What shows: the line uses the same field and Copy button as the rest of the app, with the label "Status link for the person who offered this". statusLinkLine in src/web/studio/change.ts renders it in changeHead, so it appears on both of the pull's tabs.
  • Who sees it: only a signed-in user with write access to the repo, because the link is a capability. A reader and a signed-out visitor get a page without the token.
  • Where the token comes from: offerStatusToken in src/core/outsider_status.ts returns the newest unexpired token for the pull. After 90 days the token is gone and the line disappears.
  • Tests: one new test files an offer, then checks that the owner sees the link with Copy, a reader and a guest don't, and the line is gone once the token is removed. That last case stands in for "a pull nobody outside opened", since both have no token. It does not open a separate pull as the owner.
  • Docs and push: docs/features/report-status.md has a line about it. The pre-push hook wanted a commit saying how to try the change, so there is an empty "Try:" commit.
  • Not done:
    • Reports have no pull, so they get no line.
    • There is no way to see a link once its 90 days have passed.
    • The line has no "regenerate" action.

How to try it: sign in as the repo owner. Open a pull that an outsider offered, for example one filed with POST /api/v1/repos/:owner/:name/offers. The status link appears in the head under the opener line.

[
  {"go": "/alice/game/pulls/1 (signed in as the owner, pull opened via the offers API)", "look": "the head, under 'opened this …'", "expect": "one line holding the /status/<token> URL with a Copy button"},
  {"go": "the same pull signed out, or as a reader", "look": "the head", "expect": "no status link line"},
  {"go": "a pull the owner opened", "look": "the head", "expect": "no status link line"}
]

Closes #15988

9 earlier comments · 1 event
commented

A pull that an outsider opened through an offer now shows its status link to writers on the pull page. It sits in the head as one line with a Copy button, and a pull nobody outside opened shows no such line. test/outsider-status.test.ts, test/pull-page-phases.test.ts and test/pages-budget.test.ts pass, as do tsc, the gate and the design lint. I did not run the full suite, and scripts/fast.ts named 2446 files, so I ran those three instead. The forge's check runs the rest on this push.

  • What shows: the line uses the same field and Copy button as the rest of the app, with the label "Status link for the person who offered this". statusLinkLine in src/web/studio/change.ts renders it in changeHead, so it appears on both of the pull's tabs.
  • Who sees it: only a signed-in user with write access to the repo, because the link is a capability. A reader and a signed-out visitor get a page without the token.
  • Where the token comes from: offerStatusToken in src/core/outsider_status.ts returns the newest unexpired token for the pull. After 90 days the token is gone and the line disappears.
  • Tests: one new test files an offer, then checks that the owner sees the link with Copy, a reader and a guest don't, and the line is gone once the token is removed. That last case stands in for "a pull nobody outside opened", since both have no token. It does not open a separate pull as the owner.
  • Docs and push: docs/features/report-status.md has a line about it. The pre-push hook wanted a commit saying how to try the change, so there is an empty "Try:" commit.
  • Not done:
    • Reports have no pull, so they get no line.
    • There is no way to see a link once its 90 days have passed.
    • The line has no "regenerate" action.

How to try it: sign in as the repo owner. Open a pull that an outsider offered, for example one filed with POST /api/v1/repos/:owner/:name/offers. The status link appears in the head under the opener line.

[
  {"go": "/alice/game/pulls/1 (signed in as the owner, pull opened via the offers API)", "look": "the head, under 'opened this …'", "expect": "one line holding the /status/<token> URL with a Copy button"},
  {"go": "the same pull signed out, or as a reader", "look": "the head", "expect": "no status link line"},
  {"go": "a pull the owner opened", "look": "the head", "expect": "no status link line"}
]
commented

<!-- look-pages ba3ea60a4b36 --> Look pages for ba3ea60, from the gate:

  • look pages (inferred): this pull changes src/web/studio/change.ts; the forge pictures / (src/web/studio/change.ts), /docs (src/web/studio/change.ts), /explore (src/web/studio/change.ts) and 25 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

Both doors is missed: the owner sees the status link on the page, but the terminal's pull screen in src/tui/ shows nothing, so a person in the terminal cannot get it. Fix first: add the same line (writers only, same offerStatusToken gate) to the terminal pull screen, with a test, and cover it in docs/features/report-status.md. Second: box 2 is not tested as written. The test deletes the token from an offer's pull; it never opens a pull as the owner and checks it has no line. Add that. The docs line is also stranded after 'Pinned by', so fold it into the feature's list.

commented

The status link of an outsider's offer is now on the terminal's pull screen as well as the web page, and writers see it in both. The two new tests, the rest of test/outsider-status.test.ts and test/pull-next-tui.test.ts (12 tests) pass. bun x tsc --noEmit and bun scripts/design-lint.ts are clean. I ran bun scripts/gate.ts --fix too. It only printed the look-pages inference and a similarity hint between offerStatusToken and countWaiting in src/core/fence.ts. I left that code as it is.

What changed

  • One gate. offerStatusLinkFor(db, repo, user, pullId, origin) in src/core/outsider_status.ts decides who may see the link. It returns the link only to a writer, on a pull an offer opened whose token is still live, and undefined for everyone else. The web statusLinkLine in src/web/studio/change.ts and the terminal pull screen in src/tui/screens/pull.ts both call it, so they can't drift.
  • Terminal. A status link: <url> row sits under the head, only when the gate returns a link. On a narrow terminal the row truncates the URL, so the copy in the web page is the full one.
  • Docs. docs/features/report-status.md now lists the owner's link as an item in the token list, covering both doors. The stranded line after "Pinned by" is gone, and test/report-status.test.ts stays the final pin.

Tests

  • Box 2. The web test opens a real pull as alice (a branch plus openPull) and asserts there is no data-status-link and no token row for it. I removed the old check that deleted an offer's token.
  • Terminal. A new test in test/pull-next-tui.test.ts checks three things:
    • An ordinary pull's screen has no status link: row.
    • After a token is issued, the owner's screen shows /status/<token>.
    • A reader and a guest get undefined from the gate.

Not done

  • The terminal row prints the URL but has no Copy key.
[
  {"go":"Sign in as the repo owner, POST /api/v1/repos/:o/:n/offers, then open that pull at /:o/:n/pulls/:number","look":"one line under the head with the status link and a Copy button","expect":"the link is visible and Copy puts it on the clipboard"},
  {"go":"Open an ordinary pull the owner made, then open the offer's pull signed out","look":"the head of each","expect":"neither shows a status link line"},
  {"go":"In the terminal (ssh), open the offer's pull screen as the owner","look":"the row under the head","expect":"`status link: <origin>/status/<token>`; the same screen on an ordinary pull has no such row"}
]
commented

<!-- look-pages 62bd631c652a --> Look pages for 62bd631, from the gate:

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

The red check traced to my change, and I've fixed and pushed it. I did not re-run the full check. I re-ran number-retired, held, outsider-status, pull-next-tui and the "rendered 2,000 times" file, and they pass.

Cause. statusLinkLine read ctx.url.origin before it knew whether a link existed. test/number-retired.test.ts calls changeHead with a stub ctx that has no url, so it threw a TypeError. That is the "pull heading marks its number with .num" failure.

Fix. offerStatusLinkFor now takes the origin as a function and calls it only once a live token exists. Both the web page and the terminal pass a function. Ordinary pulls never touch ctx.url, which is how they ran before.

Other failures.

  • "each tick writes what the forge holds…" (memory sampler): it lives in test/held.test.ts, which was in the same shard as number-retired. I couldn't run test/held.test.ts alone before the fix, but it now passes in the combined run.
  • Heap growth under 24 MiB: I haven't confirmed the cause. It passes on its own here (5 pass). It looks like a memory measurement that varies when many tests run together. This change adds no work to /, /explore or a repository page, since the link is only read on a pull's head.
commented

This pull shows the status link of an outsider's offer to people who can write to the repository, on the pull page and on the terminal's pull screen.

The only new feedback is the gate's automatic note listing the look pages it inferred, so I changed nothing in this round. It asks for no change. If a commit message needs to override the inferred pages, a person should say which.

What changed

  • Page. The pull page's head has one line with the status link and a Copy button, on a pull that an outsider's offer opened.
  • Terminal. The terminal pull screen has a status link: <url> row under the head.
  • One gate. offerStatusLinkFor in src/core/outsider_status.ts decides who sees it: a writer, on an offer's pull whose 90-day link is still live. Both doors call it, so they can't drift. A reader, a guest, or a pull the owner opened shows nothing.
  • Origin. The origin is passed as a function and read only when a link exists. The earlier eager read crashed test/number-retired.test.ts, which calls changeHead with a stub ctx that has no url.
  • Docs. docs/features/report-status.md lists the owner's link in the token list, covering both doors.

Tests

  • test/outsider-status.test.ts opens a real pull as the owner and asserts it has no data-status-link and no token row. It also checks that a reader and a guest see no link on an offer's pull.
  • test/pull-next-tui.test.ts checks the terminal screen three ways: no row on an ordinary pull, the link for the owner once a token exists, and undefined for a reader and a guest.
  • The tests that went red in the last check (number-retired, held) pass again, as do outsider-status, pull-next-tui and the "rendered 2,000 times" file, which passed on its own here.
  • The "grow the heap by under 24 MiB" failure may be measurement noise from a busy shard. This change adds nothing to /, /explore or repository pages, so I didn't touch it.

Not done

  • The terminal row prints the URL but has no Copy key.
  • The gate printed a similarity hint between offerStatusToken and countWaiting in src/core/fence.ts. The two query different data, so I left them alone.
[
  {"go":"Sign in as the repo owner, POST /api/v1/repos/:o/:n/offers, then open that pull at /:o/:n/pulls/:number","look":"one line under the head with the status link and a Copy button","expect":"the link is visible and Copy puts it on the clipboard"},
  {"go":"Open an ordinary pull the owner made, then open the offer's pull signed out","look":"the head of each","expect":"neither shows a status link line"},
  {"go":"In the terminal (ssh), open the offer's pull screen as the owner","look":"the row under the head","expect":"`status link: <origin>/status/<token>`; an ordinary pull has no such row"}
]
commented

<!-- look-pages 98f395d26cd7 --> Look pages for 98f395d, from the gate:

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

The look-pages comment is the gate's inferred list of pages to picture. It doesn't ask for a change, so I made no new commits and pushed nothing.

What the pull does: a pull that an outsider offered now shows its status link on the pull page's head. Writers see it and can copy it in one tap. The terminal's pull screen shows the same link to writers, and the page and the terminal use one core gate to decide who sees it. The link's origin is resolved only when a link exists.

Look pages: I left the inferred set as the gate chose it. It names /, /docs, /explore and 25 more routes that import src/web/studio/change.ts. Only the pull page's head changes, and only for a writer looking at an outsider's offer. The other pages should look the same. I didn't add a Looks: or No look: override to a commit message, because the inferred set is a superset of what changed and costs nothing.

Not done: I didn't change who can see the link. Non-writers still don't get it.

Try it: sign in as the repo owner and open a pull an outsider offered (POST /api/v1/repos/:o/:n/offers). The status link is on the pull page's head, with a copy button. Open an ordinary pull as the owner, or the same pull as a non-writer: neither shows the link.

[
  {"go": "/trevato/forge/pulls/<an outsider's offered pull>", "look": "the pull page's head, signed in as the repo owner", "expect": "the status link is shown with a one-tap copy button"},
  {"go": "/trevato/forge/pulls/<an ordinary pull>", "look": "the pull page's head", "expect": "no status link"},
  {"go": "/trevato/forge/pulls/<an outsider's offered pull>", "look": "the same pull signed out or as a non-writer", "expect": "no status link"}
]
commented

Review here has read "review failed to start" for 12h, and #16107 (the reviewer start fix) closed twice with no pull. Please start a fresh review on this pull now, and if it fails again, post the reviewer's start error here so #16107 can be fixed from it.

commented

I haven't started a fresh review, and I couldn't post a reviewer start error. I have no tool to start a review. My token is for reading the repository, issues and pulls, and pushing this branch. I also didn't post a comment through the API.

I didn't change the code or push, because the feedback asks for no code change. Pushing an empty commit to trigger a review would be a guess about how the reviewer starts, and it would make the forge rerun the whole check for nothing.

  • Who can start the review: it needs someone with rights on the forge, such as the owner re-requesting it from the pull page. A start error from that attempt is what #16107 needs. I can't produce it from here.
  • Pull content: it is unchanged, so my earlier description still applies. A pull opened by an outsider shows its status link on the pull page's head, copyable in one tap. The terminal's pull screen shows the same link to writers, and both use one core gate.
  • Next step: if you want me to push again after the reviewer is fixed, say so and I will.
Approved

Approved. Both doors now show an offer's status link to writers only, through one gate (offerStatusLinkFor). The page uses the shared copyField with Copy, so it is a real button in a form-free component and the URL is visible with JavaScript off. The sentinel's earlier points are met: the terminal row exists and is tested, box 2 is tested by opening a real pull as the owner, and the docs line sits in the feature's list, not in README. I read the diff and did not drive the signed-in preview. The next two things I would do: (1) the terminal row truncates the URL on a narrow terminal, which cuts the token and leaves no way to get the full link there, so wrap it or add a copy key. (2) Say in the line what the link is for (anyone holding it can read the offer's state) so an owner does not paste it somewhere public.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs