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

Ship, decline and say stay on the page they were taken from #15096

Merged opened this

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

Merged

Ship, decline, say and decide now return to the page they were taken from, and the inbox lands on its decisions. Remaining gate warning: it flags openTopicPull (my new test helper) as 0.79 similar to green in test/studio.test.ts. It did not block the push, and I left it.

Notes

shipped production is serving it deploy 4b3eb63

opened this

Ship, decline, say and decide now return to the page they were taken from, and the inbox lands on its decisions. Remaining gate warning: it flags openTopicPull (my new test helper) as 0.79 similar to green in test/studio.test.ts. It did not block the push, and I left it.

What changed

  • New src/web/come_back.ts (comeBack). The return target is the form's back field when it is a local path (already used by the inbox's forms), otherwise a same-origin Referer (via the existing safeBack), otherwise the old fallback. A cross-origin Referer and a //evil back are ignored. /asks becomes /asks#needs-you, so the next decision is the first thing Tab reaches.
  • Wired into pull ship, pull say (which always went to the app home before), state for pull close/decline and issue close/reopen, and issue comments.
  • test/come-back.test.ts asserts the Location header per action, with a cross-origin Referer ignored for each. The Referer tests all pass.
  • A shared test/helpers/open-pull.ts, now also used by test/asks-one-pull.test.ts, to satisfy the gate's duplicate check.

Not done

  • "Next decision focused" is the #needs-you anchor plus Tab order, not scripted focus on the next row's button. That would need new client JS, which I judged more than this issue needs.
  • Not run: test/studio.test.ts timed out here, and scripts/fast.ts said the diff was too broad to name. Ran come-back, asks-one-pull, local-path and handover-give-back, which pass, plus tsc (clean) and scripts/gate.ts. The forge's check runs the rest.
  • No screenshots or review block: no rendered page changed, only redirect targets.

Try it: on the preview, open /asks and press Ship or Decline on a row. You land back on /asks at the decisions. Say on a pull or close an issue from /asks and you return there too.

Commit lines Try:, Direction:, No look: and No door: are in the commits for the gate.

Closes #15069

1 earlier comment · 1 event
commented

Ship, decline, say and decide now return to the page they were taken from, and the inbox lands on its decisions. Remaining gate warning: it flags openTopicPull (my new test helper) as 0.79 similar to green in test/studio.test.ts. It did not block the push, and I left it.

What changed

  • New src/web/come_back.ts (comeBack). The return target is the form's back field when it is a local path (already used by the inbox's forms), otherwise a same-origin Referer (via the existing safeBack), otherwise the old fallback. A cross-origin Referer and a //evil back are ignored. /asks becomes /asks#needs-you, so the next decision is the first thing Tab reaches.
  • Wired into pull ship, pull say (which always went to the app home before), state for pull close/decline and issue close/reopen, and issue comments.
  • test/come-back.test.ts asserts the Location header per action, with a cross-origin Referer ignored for each. The Referer tests all pass.
  • A shared test/helpers/open-pull.ts, now also used by test/asks-one-pull.test.ts, to satisfy the gate's duplicate check.

Not done

  • "Next decision focused" is the #needs-you anchor plus Tab order, not scripted focus on the next row's button. That would need new client JS, which I judged more than this issue needs.
  • Not run: test/studio.test.ts timed out here, and scripts/fast.ts said the diff was too broad to name. Ran come-back, asks-one-pull, local-path and handover-give-back, which pass, plus tsc (clean) and scripts/gate.ts. The forge's check runs the rest.
  • No screenshots or review block: no rendered page changed, only redirect targets.

Try it: on the preview, open /asks and press Ship or Decline on a row. You land back on /asks at the decisions. Say on a pull or close an issue from /asks and you return there too.

Commit lines Try:, Direction:, No look: and No door: are in the commits for the gate.

Changes requested — before the latest push

Redirect targets work and the tests pass, but one box is unmet and two cases are inconsistent.

Fix first: box 1 asks for the next decision focused. #needs-you scrolls to the section; it does not focus the next row. Either put tabindex=-1 and focus on the first decision (CSS :target plus a small autofocus-free anchor on the first row, e.g. #needs-you pointing at the first decision's heading), or narrow the issue with the owner. Without JS, a fragment on the first row's button is the honest no-JS route.

Also: (1) the inbox rule matches only the exact string /asks, so /asks?x=1 lands without the anchor; your own test pins that inconsistency. Compare the path, keep the query, add the fragment. (2) A POST that fails (ship refused) also redirects through back; confirm that is intended and test it. (3) The direction is pipeline-first; this is UX polish, so keep it small and do not widen it.

Tests: the Location and cross-origin Referer assertions are good. The ship cross-origin case should also assert the pull still merged.

commented

Ship, decline, say and decide now return to the page they began on. The inbox, with or without a query, lands focused on its first decision.

  • Focus (box 1): the inbox's first decision row is wrapped in a tabindex="-1" element with id next-ask. comeBack now appends #next-ask instead of #needs-you. Following a fragment to a focusable target focuses it, so no JavaScript is needed. The id is the exported NEXT_ASK constant in asks_page.ts.
  • Query (1): comeBack compares the path, keeps the query and sets the fragment, so /asks?x=1 becomes /asks?x=1#next-ask. Any other fragment on an inbox target is replaced. The test that pinned the old behaviour now expects the anchor.
  • Failed ship (2): a refused ship does go through back on purpose, so the person stays where they were and the danger flash is shown there. A new test ships an already-merged pull from /asks?x=1 and checks the redirect and the "already merged" flash.
  • Cross-origin ship: that test now also asserts the pull merged.
  • Not done (3): the direction stays as it was. When the forge's own needs or sleeping asks sit above the rows, next-ask is the first decision row, not the first card on the page.

Checks: tsc is clean and design-lint passes. The ask, inbox and come-back tests pass (70 tests). scripts/fast.ts named 2,290 files, so I ran only those ask and inbox tests, not everything it named.

Gate: bun scripts/gate.ts --fix reported rewrapping comments in 2 files, but git status showed only my three files changed, so nothing extra was committed. It also flagged test/helpers/open-pull.ts#openTopicPull as 0.79 similar to test/studio.test.ts#green, which I did not act on.

Try it: open /asks, ship or decline a row, and the next decision has focus. Tab and Enter act on it.

[
  {"go": "/asks", "look": "Ship or decline the first row", "expect": "URL ends #next-ask and the next decision row has focus"},
  {"go": "/asks?x=1", "look": "Decline a row", "expect": "URL is /asks?x=1#next-ask"}
]
Approved

Earlier asks are met: the inbox target now lands on #next-ask (a tabindex=-1 wrapper, so focus needs no script), the query is kept, a refused ship stays on the page it began on with its flash, and the cross-origin ship test also asserts the merge. Cross-origin Referer and //evil back are ignored, each with a Location test. Redirect targets only, no new page and no new door. Two things I would do next, non-blocking: 1) give #next-ask a visible :focus-visible treatment so the landing is seen, not only announced; 2) when the forge cards sit above the rows, say in docs which row next-ask is.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs