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

Clear what is on you in one move: close, decline, mute or decide many at once, undoable #1320

opened this in answer to

Merged 52d 15h ago, live in production

The On you card and the asks section now take a whole set: tick boxes, or Select all, a kind, or a repository, then one verb for all of it. Type check and the two pinned test files pass here. I ran them with a preload that stubs the unix-socket listener, because the sandbox refuses to bind it.

Notes

opened this

The On you card and the asks section now take a whole set: tick boxes, or Select all, a kind, or a repository, then one verb for all of it. Type check and the two pinned test files pass here. I ran them with a preload that stubs the unix-socket listener, because the sandbox refuses to bind it. Other suites that fail here (look, apps, accounts, mirror reconnect) fail the same way on the unchanged base, so they were not checked against this change.

What changed

  • Verbs on POST /api/v1/asks/bulk: decline (same as dismiss), mute and close with one reason. The reason is at most 300 characters and is written as "Closed: …" on each pull before it closes. It is refused on any other verb. ship, dismiss and replan were already there.
  • mute: it silences a repository in the person's own feed and On you card. Asks are not hidden by it, because the feed's rule is that something waiting on a person is never muted away. So the asks section does not offer mute; only the card does.
  • Items: besides ask ids, items may be issue:<id> for something assigned to you. That is how the On you card, which lists assigned items, reaches the same endpoint. Only items assigned to the caller are accepted.
  • Undo: one undo link per set, kept for a day. After 24 hours the link is gone and the endpoint answers 409. The card shows the latest undoable set, so the link survives refreshes.
  • Card: with two or more rows, onYouCard gets a checkbox per row, Select all, by-kind buttons, a by-repository chooser, a verb chooser (close, mute, ship), a reason field and one request. The /asks section gets the same pickers plus a reason on close, and keeps its preview-then-apply flow.
  • In place: the card's form posts through fetch and swaps the On you region and the top bar's Asks count (the link now has id="asks-link"). Without script it falls back to the plain post and the existing receipt page. The live region now also refreshes on fleet.operated.
  • MCP: there is no decide tool in the repository. The bulk tool is asks_act, so I extended that one with the new verbs and reason.
  • Docs: a short section in docs/FEED.md.

Tests

  • test/asks-bulk.test.ts: decline and its undo; close with a reason, including the 300-character limit and the refusal on other verbs; mute for the caller only, with undo; the card's in-place answer; the one-day undo expiry.
  • test/home-feed.test.ts: the selection UI on the card.
  • I changed one old assertion in asks-bulk.test.ts, the ticked-box regex, because the checkboxes now carry data-repo and data-kind.

Left out

  • Selection is script-only; there is no no-JS select-by-kind.
  • The card has no preview step (undo is the safety net).
  • A row on the card is no longer a whole-row link when there are two or more; the title is the link.
  • Nothing was added for pulls that belong to other people.

Try it: assign yourself two pulls in different repositories, open /, pick them with Select all or By repository…, choose Close, type a reason, and press Do it. Then press Undo.

Closes #1111

commented

This update fixes all four points from @sentinel's review. I couldn't run the new tests here. bun test needs sockets, and the sandbox refuses them (EPERM). tsc --noEmit passes, and I'm relying on the forge's check for the suite.

Changes

  • Card errors (src/web/studio/asks_page.ts): when x-forge-fragment is set and the operation fails, the response is now a 422 carrying the message. The script already falls back to the plain post on a non-2xx, so a non-admin pressing Close or Ship, or anyone sending a reason with Mute, now sees the "Nothing done: …" banner.
  • Partial results: when the receipt has refused or skipped rows, onYouAnswer (src/web/studio/home.ts) puts a one-line "N not done: why" inside #live-on-you, above the card. The line is escaped and carries the distinct reasons.
  • Close order (src/fleet/verbs.ts): the state change runs first, and "Closed: …" is posted only if it succeeded. A refused close leaves no comment behind.
  • Mute undo: removeMutes now deletes by item_id, and the verb passes repo:<id>. A mute made from the feed, under another item id, survives the undo.

Tests (test/asks-bulk.test.ts)

  • A reason sent with mute on the card path returns 422 and mentions the reason.
  • A non-admin closing via the card changes nothing and gets either a 422 or the "not done" line.
  • Undoing a bulk mute keeps a separate event: mute on the same repository.

Left out: the "N not done" line is not persisted. It shows once, in the swapped region.

commented

Both of sentinel's points are fixed and pushed.

What changed

  • The one-day undo now holds on every door. undoFleetOp (src/actions/fleet.ts) refuses an asks receipt older than a day with expired. /api/v1/fleet/ops/:id/undo, the MCP limb undo and the asks' own undo all go through it, so the copy in undoAsksBulk is gone.
  • The window moved to fleet.ts. UNDO_WINDOW_MS and isAsksOperation now live there, because asks_bulk already imports fleet. asks_bulk imports them back.
  • expired now answers 409 on the fleet API. respondFleet in src/http/api.ts returned 422 for it before.
  • A mute is no longer invisible.
    • The On you card says "N repositories muted" and offers Listen again. The line shows whenever muted repositories hold work assigned to the viewer. It stays even when every assigned item is muted, so the card doesn't disappear.
    • Listen again posts to a new POST /asks/listen. It is same-origin and rw-scoped, takes at most 100 repository ids, and removes only the viewer's own repo:<id> mutes.
  • Tests.
    • The existing expiry test now also checks that /api/v1/fleet/ops/<id>/undo on an expired receipt returns 409 and the issue stays closed.
    • A new test covers the muted line and the listen-again round trip.

What I left out

  • MCP unmute: I didn't add a way to list or unmute repositories in MCP. The card is the one place a mute is shown and reversed. Say if you want it as its own issue.
  • Hover tooltip: The muted line names the repositories only in a hover tooltip, to keep the card quiet.

Testing note

  • What ran: The asks, asks-bulk and fleet tests pass (52). I did not run the whole suite or a type check: tsc fails here because it can't find the bun type definitions.
  • Sandbox socket: In this sandbox FORGE_TEST_SOCKET=port isn't read by src/http/server.ts, which always listens on a unix socket, so server tests failed with EPERM. I shimmed the server to listen on a loopback port for the run and reverted the shim before committing.

Try it Assign yourself two items in a repository and mute them from the On you card. The "1 repository muted" line stays after the undo link is gone. Listen again brings the items back.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs