oficina / equipo Public

Merge branch 'ships-buttons' into main

Merge ships-buttons: the ship question applies at once

Yes, it ships / No, main is not a release are two buttons on the
project page with a Saved tick and Undo. The stored policy and gate
are unchanged; a stale revision on a page post is now a 409. Hosted
CI passed on d906a8f.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 42a31cbe4bce6a047ed27b9e4b39d5ec9e971288 parent 03f8a91parent d906a8f
11 files changed, +447 −95
  • .rastrillo/budgets.txt +1 −1
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +32 −1
  • internal/equipo/chat_page.go +1 −1
  • internal/equipo/copy.go +81 −82
  • internal/equipo/merge_policy_page.go +30 −6
  • internal/equipo/static/equipo.css +9 −0
  • internal/equipo/static/merge-ships.js +84 −0
  • internal/equipo/templates/chrome.html +1 −1
  • internal/equipo/templates/merge_policy.html +10 −3
  • internal/thintest/ships_buttons_browser_test.go +67 −0
  • internal/thintest/ships_buttons_test.go +131 −0

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index dd905800..6d38d07c 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -62,5 +62,5 @@ perf GET /conversation/attachments/{id}/preview skip Composer attachments: an im
perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section.
time cmd/equipo-runner 60s Mac runners slice B: TestReleaseRunnerHasNoFakeWorker builds the release runner exactly as make release-runner does and the thin package under the testbuild tag (measured 11.9s locally with a warm cache).
size internal/headless - 8400 Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090.
-size internal/thintest - 13070 Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
+size internal/thintest - 13196 The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index f2a65837..2c7fd9e6 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5964,7 +5964,6 @@ records remain unchanged.
| `work.merge_policy.max_lines` | Maximum lines changed | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.merge_policy.max_files` | Maximum files changed | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.merge_policy.ships` | Does merging to main ship to users? | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
-| `work.merge_policy.ships_opt_unknown` | Not answered | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.merge_policy.ships_opt_yes` | Yes, it ships | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.merge_policy.ships_opt_no` | No, main is not a release | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `work.merge_policy.extra_label` | Paths I should always ask about, one per line | Merge authority thin v1 (2026-11-11) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
@@ -6889,3 +6888,35 @@ Verification (targeted, niced):
- `go test ./internal/equipotest -run 'TestEnrolment|TestMacEnrolment|TestRunnerRemovalRevokes|TestRunnerAppCSRF|TestRunner.*HistoryLabel'`: ok.
- `go test ./internal/plan3test -run 'TestPlan3ReleaseBoundaries|TestOnboarding|TestCoordinatorAcceptance3B|TestInviteSignInPendingMember|TestInviteCurrentAuthority'`: ok.
- `go test -tags perf ./internal/equipotest -run '^TestPerfScreens$'`: ok. `make budget`: ok after raising internal/equipo to 16664 and internal/thintest to 11759 test lines (measured).
+
+## Ship question as two buttons (2026-11-11)
+
+Paul: instant choices apply at once. "Does merging to main ship to
+users?" left the Change form's Save and became two buttons in How
+Equipo merges, owners only: "Yes, it ships" and "No, main is not a
+release". Each is its own form (revision, `only=main_ships`, the
+value), so without script it posts and comes back to the project page.
+With script (`merge-ships.js`, loaded only when the policy is editable)
+the tap posts in the background, the page is read again, the pressed
+button, the sentences and every revision on the section move on, and
+"Saved" shows with Undo. Undo posts the value from before the tap,
+`unknown` included, the same way. "Not answered" is no longer a choice:
+it is the state before the first tap, neither button pressed. The
+unused `work.merge_policy.ships_opt_unknown` string went with it. No new
+strings: the buttons, the question, `settings.saved` and
+`chat.card.undo` were already reviewed, so there was no copy pass.
+
+Handler: the store's `SetMergePolicy` takes the whole policy, so the
+page handler now reads the policy, refuses unless the posted revision is
+the one it read, and fills what the post leaves out from it: everything
+but the answer for a ship tap, only the answer for the Change form. The
+store write, its revision check, owner check, bounds and audit row are
+unchanged. `chat.ErrRevision` now maps to 409 on page posts (it was a
+503).
+
+Verification (targeted, niced):
+
+- `go test ./internal/thintest -run '^TestContractShipsButtons$'`: before the mapping, a stale tap was 503; then ok. Mutation: a ship tap that dropped the stored words fails it.
+- `go test ./internal/thintest -run '^(TestPagesInnerScreens|TestContractShipsQuestion|TestPagesTasksAndProjects|TestContractMergePolicyTool)$'`: ok.
+- `go test -tags browser ./internal/thintest -run '^TestBrowserShipsButtons$'`: ok. Mutation: the script returning at once fails it at "Saved and Undo". `'^TestBrowserInnerScreens$'`: ok.
+- `go test ./internal/equipo -run 'TestTemplateCopyKeys|TestRunnerCopyInventory'` and `EQUIPO_RELEASE_COPY_CHECK=1 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$'`: ok. `make budget`: ok after raising internal/thintest to 13196 test lines (measured).
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index 786f3c7b..f01b82fd 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -482,7 +482,7 @@ func (a *application) chatNotebookReset(w http.ResponseWriter, r *http.Request)
}
func chatError(err error) error {
- for from, to := range map[error]error{chat.ErrBusy: ErrConflict, chat.ErrInvalid: ErrInvalid, chat.ErrConflict: ErrConflict, chat.ErrNotFound: ErrNotFound, chat.ErrForbidden: ErrForbidden, chat.ErrNotAllowed: ErrInvalid, chat.ErrTaskEnded: ErrConflict, chat.ErrNotRetryable: ErrConflict, chat.ErrMerging: ErrConflict, chat.ErrNotMergeable: ErrConflict, chat.ErrNotAskable: ErrConflict} {
+ for from, to := range map[error]error{chat.ErrBusy: ErrConflict, chat.ErrInvalid: ErrInvalid, chat.ErrConflict: ErrConflict, chat.ErrNotFound: ErrNotFound, chat.ErrForbidden: ErrForbidden, chat.ErrNotAllowed: ErrInvalid, chat.ErrTaskEnded: ErrConflict, chat.ErrNotRetryable: ErrConflict, chat.ErrMerging: ErrConflict, chat.ErrNotMergeable: ErrConflict, chat.ErrNotAskable: ErrConflict, chat.ErrRevision: ErrConflict} {
if errors.Is(err, from) {
return to
}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 31e753dc..a883ea55 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1560,88 +1560,87 @@ var pageCopy = map[string]string{
"specialist.instructions": "Instructions",
// Merge authority (spec 2026-11-11-equipo-merge-authority.md).
- "chat.merge.stance_merge": "Merge %s? I'd merge: %s, but %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.stance_wait": "Merge %s? I'd wait: %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.why.approved": "approved by Review", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.why.small": "a small change, %d lines in %d files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.why.small_one": "a small change, %d lines in one file", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.why.not_shipping": "nothing ships until a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.why.exact_revert": "it exactly reverts %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.environment": "checks couldn't run because %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.no_checks": "it has no checks to run", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.protocol": "your runner needs an update before I merge on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.facts": "the runner didn't say what changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.small": "it's larger than I can merge on my own (%d lines in %d files)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.small_one": "it's larger than I can merge on my own (%d lines in one file)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.special": "it changes a symlink, a submodule or a file mode", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.sensitive": "it touches %s (%s)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.signing": "it changes signing or version settings", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.ships": "merging to %s's main branch ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.ships_unknown": "I don't know yet whether merging to %s's main branch ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.policy": "I ask before every merge in this project", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.revert": "it doesn't exactly revert %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.eligible": "it was ready before I could merge on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.not.sandbox": "its checks ran outside the sandbox", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.migrations": "the database schema", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.auth_secrets": "sign-in, keys or secrets", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.payments": "payments", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.ci_config": "the checks or CI setup", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.dependencies": "dependencies", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.release_signing": "release or signing settings", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.infrastructure": "infrastructure", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.area.project": "a path I must ask about", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.wait_mac": "Wait for a Mac", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.merge_chose_wait_mac": "Waiting for a Mac.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.ships_question": "Does merging to %s's main branch ship to users?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.ships": "It ships", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.not_ships": "It doesn't", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.ships_chose_ships": "Merging to main ships to users, so I'll ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.ships_chose_not_ships": "Main isn't a release, so I can merge small changes on my own when the other rules allow.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.merge_policy_stale": "The merge rules changed since I asked, so nothing was saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy_confirm": "Change how Equipo merges %s: %s?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.save": "Save", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.cancel": "Cancel", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.policy_chose_save": "Saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.card.policy_chose_cancel": "Left as it was.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.rules": "merge on my own when all the rules are met, up to %d lines in %d files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.ask": "ask before every merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.ships_unknown": "I don't know yet whether main ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.ships_yes": "main ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.ships_no": "main is not a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.policy.extra": "always ask about %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.receipt": "Merged [%s](%s) into %s without checks: %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.receipt_unverified": "Merged [%s](%s) into %s without checks. I couldn't identify the merge commit on main, so I can't undo it.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.reverting": "Reverting it: [%s](%s).", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.revert_title": "Revert %s in %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "chat.merge.mode_reason_reverted": "a merge was undone (%s)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.reason.merge_not_authorized": "my rules require me to ask before merging", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.title": "How Equipo merges", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.rules": "I merge work approved by Review on my own when its checks pass. If checks can't run here, the change must also be small (up to %d lines in %d files), touch nothing sensitive and ship only with a release.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ask": "I ask before every merge in this project.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.reason": "I ask because %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_unknown": "I don't know yet whether merging to main ships to users, so I'll ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_yes": "Merging to main ships to users, so I ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_no": "Nothing ships from main until a release.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.extra": "I always ask about %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.words": "In your words: %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.decisions": "Recent decisions", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.decision.act": "Merged on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.decision.ask": "Asked", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.decision.never": "Not ready to merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.mode": "How I decide", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.mode_rules": "Merge on my own when all the rules are met", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.mode_ask": "Ask before every merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.max_lines": "Maximum lines changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.max_files": "Maximum files changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships": "Does merging to main ship to users?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_opt_unknown": "Not answered", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_opt_yes": "Yes, it ships", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.ships_opt_no": "No, main is not a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.extra_label": "Paths I should always ask about, one per line", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.words_label": "In your words", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.save": "Save", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.edit": "Change", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
- "work.merge_policy.saved": "Saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.stance_merge": "Merge %s? I'd merge: %s, but %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.stance_wait": "Merge %s? I'd wait: %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.why.approved": "approved by Review", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.why.small": "a small change, %d lines in %d files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.why.small_one": "a small change, %d lines in one file", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.why.not_shipping": "nothing ships until a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.why.exact_revert": "it exactly reverts %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.environment": "checks couldn't run because %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.no_checks": "it has no checks to run", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.protocol": "your runner needs an update before I merge on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.facts": "the runner didn't say what changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.small": "it's larger than I can merge on my own (%d lines in %d files)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.small_one": "it's larger than I can merge on my own (%d lines in one file)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.special": "it changes a symlink, a submodule or a file mode", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.sensitive": "it touches %s (%s)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.signing": "it changes signing or version settings", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.ships": "merging to %s's main branch ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.ships_unknown": "I don't know yet whether merging to %s's main branch ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.policy": "I ask before every merge in this project", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.revert": "it doesn't exactly revert %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.eligible": "it was ready before I could merge on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.not.sandbox": "its checks ran outside the sandbox", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.migrations": "the database schema", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.auth_secrets": "sign-in, keys or secrets", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.payments": "payments", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.ci_config": "the checks or CI setup", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.dependencies": "dependencies", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.release_signing": "release or signing settings", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.infrastructure": "infrastructure", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.area.project": "a path I must ask about", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.wait_mac": "Wait for a Mac", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.merge_chose_wait_mac": "Waiting for a Mac.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.ships_question": "Does merging to %s's main branch ship to users?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.ships": "It ships", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.not_ships": "It doesn't", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.ships_chose_ships": "Merging to main ships to users, so I'll ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.ships_chose_not_ships": "Main isn't a release, so I can merge small changes on my own when the other rules allow.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.merge_policy_stale": "The merge rules changed since I asked, so nothing was saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy_confirm": "Change how Equipo merges %s: %s?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.save": "Save", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.cancel": "Cancel", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.policy_chose_save": "Saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.card.policy_chose_cancel": "Left as it was.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.rules": "merge on my own when all the rules are met, up to %d lines in %d files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.ask": "ask before every merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.ships_unknown": "I don't know yet whether main ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.ships_yes": "main ships to users", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.ships_no": "main is not a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.policy.extra": "always ask about %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.receipt": "Merged [%s](%s) into %s without checks: %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.receipt_unverified": "Merged [%s](%s) into %s without checks. I couldn't identify the merge commit on main, so I can't undo it.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.reverting": "Reverting it: [%s](%s).", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.revert_title": "Revert %s in %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "chat.merge.mode_reason_reverted": "a merge was undone (%s)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.reason.merge_not_authorized": "my rules require me to ask before merging", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.title": "How Equipo merges", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.rules": "I merge work approved by Review on my own when its checks pass. If checks can't run here, the change must also be small (up to %d lines in %d files), touch nothing sensitive and ship only with a release.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ask": "I ask before every merge in this project.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.reason": "I ask because %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships_unknown": "I don't know yet whether merging to main ships to users, so I'll ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships_yes": "Merging to main ships to users, so I ask before merging without checks.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships_no": "Nothing ships from main until a release.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.extra": "I always ask about %s.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.words": "In your words: %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.decisions": "Recent decisions", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.decision.act": "Merged on my own", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.decision.ask": "Asked", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.decision.never": "Not ready to merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.mode": "How I decide", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.mode_rules": "Merge on my own when all the rules are met", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.mode_ask": "Ask before every merge", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.max_lines": "Maximum lines changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.max_files": "Maximum files changed", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships": "Does merging to main ship to users?", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships_opt_yes": "Yes, it ships", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.ships_opt_no": "No, main is not a release", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.extra_label": "Paths I should always ask about, one per line", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.words_label": "In your words", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.save": "Save", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.edit": "Change", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
+ "work.merge_policy.saved": "Saved.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
// The team panel (the sidebar's specialists and each one's drawer).
"team.activity.read_files": "Reading files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): team panel activity line
"team.activity.edit_files": "Editing files", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): team panel activity line
diff --git a/internal/equipo/merge_policy_page.go b/internal/equipo/merge_policy_page.go
index 67be83ee..67a7e0b3 100644
--- a/internal/equipo/merge_policy_page.go
+++ b/internal/equipo/merge_policy_page.go
@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
+ "amadan.net/oficina/equipo/internal/equipo/chat"
"amadan.net/oficina/equipo/internal/equipo/mergegate"
"amadan.net/oficina/equipo/internal/wire"
"github.com/go-chi/chi/v5"
@@ -53,7 +54,12 @@ func mergePolicyViewOf(p wire.MergePolicy) *mergePolicyView {
}
// workMergePolicy is an owner's form on the project page: their own
-// action, so it may loosen the policy.
+// action, so it may loosen the policy. The store takes the whole policy,
+// so what the post leaves out is the policy at its revision: the form
+// has no ship question, and the ship buttons (only=main_ships) send
+// nothing else. The revision read must be the one posted, and the store
+// refuses the write unless it is still current, so a stale page changes
+// nothing.
func (a *application) workMergePolicy(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
a.chatActionTo(w, r, "/projects/"+id, func(ctx context.Context, address string) error {
@@ -68,13 +74,31 @@ func (a *application) workMergePolicy(w http.ResponseWriter, r *http.Request) {
if err != nil {
return ErrInvalid
}
- var extra []string
- for _, line := range strings.Split(r.PostFormValue("extra_sensitive"), "\n") {
- if g := strings.TrimSpace(line); g != "" {
- extra = append(extra, g)
+ cur, err := a.store.Chat().MergePolicy(ctx, address, id)
+ if err != nil {
+ return err
+ }
+ if cur.Revision != rev {
+ return chat.ErrRevision
+ }
+ in := wire.SetMergePolicy{Mode: cur.Mode, MaxLines: cur.MaxLines, MaxFiles: cur.MaxFiles, MainShips: cur.MainShips, ExtraSensitive: cur.ExtraSensitive, Words: cur.Words, Revision: rev}
+ if r.PostFormValue("only") == "main_ships" {
+ if !r.PostForm.Has("main_ships") {
+ return ErrInvalid
}
+ } else {
+ var extra []string
+ for _, line := range strings.Split(r.PostFormValue("extra_sensitive"), "\n") {
+ if g := strings.TrimSpace(line); g != "" {
+ extra = append(extra, g)
+ }
+ }
+ in.Mode, in.MaxLines, in.MaxFiles, in.ExtraSensitive, in.Words = r.PostFormValue("mode"), atoi("max_lines"), atoi("max_files"), extra, r.PostFormValue("words")
+ }
+ if r.PostForm.Has("main_ships") {
+ in.MainShips = r.PostFormValue("main_ships")
}
- _, err = a.store.Chat().SetMergePolicy(ctx, address, id, wire.SetMergePolicy{Mode: r.PostFormValue("mode"), MaxLines: atoi("max_lines"), MaxFiles: atoi("max_files"), MainShips: r.PostFormValue("main_ships"), ExtraSensitive: extra, Words: r.PostFormValue("words"), Revision: rev})
+ _, err = a.store.Chat().SetMergePolicy(ctx, address, id, in)
return err
})
}
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index a57c99ba..380fc171 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -639,6 +639,15 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-p-cols] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); gap: var(--rst-sp-6); align-items: start; }
[equipo-p-section] { margin-block-end: var(--rst-sp-5); }
[equipo-p-section] > h2 [equipo-quiet] { font-weight: 400; margin-inline-start: var(--rst-sp-2); }
+/* The ship question: two buttons that apply at once; the answer is the pressed one. */
+[equipo-ships] { margin-block: var(--rst-sp-3); }
+[equipo-ships-q] { margin: 0 0 var(--rst-sp-2); font-size: var(--rst-fs-sm); font-weight: 600; }
+[equipo-ships-choices] { display: flex; flex-wrap: wrap; align-items: center; gap: var(--rst-sp-2); }
+[equipo-ships] [rst-btn][aria-pressed="true"] { border-color: var(--rst-accent); background-color: var(--rst-accent-soft); color: var(--rst-accent); }
+[equipo-ships-done] { display: flex; align-items: center; gap: var(--rst-sp-3); margin: var(--rst-sp-2) 0 0; }
+[equipo-ships-done]:empty { display: none; }
+[equipo-ships-done] [equipo-saved-tick] { margin-inline-start: 0; }
+@media (pointer: coarse) { [equipo-ships] [rst-btn] { min-block-size: 2.75rem; } }
[equipo-attach] { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); }
[equipo-attach] li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--rst-sp-3); align-items: center; padding: var(--rst-sp-3) var(--rst-sp-4); font-size: var(--rst-fs-sm); }
[equipo-attach] li + li { border-block-start: 1px solid var(--rst-line); }
diff --git a/internal/equipo/static/merge-ships.js b/internal/equipo/static/merge-ships.js
new file mode 100644
index 00000000..ad449443
--- /dev/null
+++ b/internal/equipo/static/merge-ships.js
@@ -0,0 +1,84 @@
+// The ship question on a project page (Paul, 2026-11-11): "Yes, it
+// ships" and "No, main is not a release" apply at once. A tap posts in
+// the background, the page is read again and the sentences, the pressed
+// button and every form's revision are put back in place; "Saved" shows
+// with Undo, which posts the answer from before the tap ("unknown"
+// included) the same way. No reload. Without script each button posts
+// and comes back to the page.
+(function () {
+ "use strict";
+ if (!window.fetch || !window.URLSearchParams || !window.DOMParser) return;
+
+ document.addEventListener("submit", function (e) {
+ var form = e.target;
+ if (!form.matches || !form.matches("form[data-merge-ships-form]")) return;
+ e.preventDefault();
+ var group = form.closest("[data-merge-ships]");
+ var value = form.elements.main_ships.value, was = group.dataset.mergeShips;
+ if (value === was || group.hasAttribute("aria-busy")) return;
+ set(group, form.getAttribute("action"), value, was, function () { HTMLFormElement.prototype.submit.call(form); });
+ });
+
+ // set posts value at the group's revision; was is what Undo puts back,
+ // and none after an Undo.
+ function set(group, action, value, was, failed) {
+ var rev = group.querySelector("input[name=revision]").value;
+ group.setAttribute("aria-busy", "true");
+ fetch(action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: new URLSearchParams({ revision: rev, only: "main_ships", main_ships: value }) })
+ .then(function (r) {
+ if (!r.ok) throw new Error("save");
+ return fetch(location.pathname + location.search, { credentials: "same-origin", headers: { "Accept": "text/html" } });
+ })
+ .then(function (r) {
+ if (!r.ok) throw new Error("read");
+ return r.text();
+ })
+ .then(function (html) {
+ var doc = new DOMParser().parseFromString(html, "text/html");
+ refresh(group, doc);
+ group.removeAttribute("aria-busy");
+ done(group, action, was, value);
+ })
+ .catch(function () {
+ group.removeAttribute("aria-busy");
+ failed();
+ });
+ }
+
+ // refresh takes the answer, the sentences and the revision from the
+ // page as it is now, leaving the Change form's own fields as they are.
+ function refresh(group, doc) {
+ var section = group.closest("[data-merge-policy]");
+ var fresh = doc.querySelector("[data-merge-ships]"), sentences = doc.querySelector("[data-merge-sentences]");
+ if (!fresh) throw new Error("gone");
+ group.dataset.mergeShips = fresh.dataset.mergeShips;
+ group.querySelectorAll("[data-merge-ships-choice]").forEach(function (b) {
+ b.setAttribute("aria-pressed", b.dataset.mergeShipsChoice === fresh.dataset.mergeShips ? "true" : "false");
+ });
+ var mine = section.querySelector("[data-merge-sentences]");
+ if (mine && sentences) mine.replaceWith(sentences);
+ var rev = fresh.querySelector("input[name=revision]").value;
+ section.querySelectorAll("input[name=revision]").forEach(function (i) { i.value = i.defaultValue = rev; });
+ }
+
+ // done shows the tick, and Undo while there is something to undo.
+ function done(group, action, was, value) {
+ var slot = group.querySelector("[data-merge-ships-done]");
+ var template = group.querySelector("template[data-merge-ships-template]");
+ if (!slot || !template) return;
+ slot.innerHTML = template.innerHTML;
+ var tick = slot.querySelector("[equipo-saved-tick]"), undo = slot.querySelector("[data-merge-ships-undo]");
+ tick.setAttribute("data-shown", "");
+ setTimeout(function () { tick.setAttribute("data-gone", ""); }, 2400);
+ if (!was) {
+ undo.remove();
+ var back = group.querySelector('[data-merge-ships-choice="' + value + '"]') || group.querySelector("[data-merge-ships-choice]");
+ if (back) back.focus();
+ return;
+ }
+ undo.addEventListener("click", function () {
+ if (group.hasAttribute("aria-busy")) return;
+ set(group, action, was, "", function () { location.reload(); });
+ });
+ }
+})();
diff --git a/internal/equipo/templates/chrome.html b/internal/equipo/templates/chrome.html
index 4787801b..15ba1153 100644
--- a/internal/equipo/templates/chrome.html
+++ b/internal/equipo/templates/chrome.html
@@ -1,6 +1,6 @@
{{define "rail-brand"}}<span hidden></span>{{end}}
{{define "title"}}{{copy .Title}} · {{copy "brand"}}{{end}}
-{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script><script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/team-panel.js"}}"></script>{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if or (eq .Key "thinking") (eq .Key "settings-hub")}}<script defer src="{{asset "static/thinking-preview.js"}}"></script><script defer src="{{asset "static/settings.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/vendor/tweetnacl/nacl-fast.js"}}"></script><script defer src="{{asset "static/seal.js"}}"></script><script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .MachinesStream}}<script defer src="{{asset "static/machines.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script><script defer src="{{asset "static/chat-attach.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}}
+{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script><script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/team-panel.js"}}"></script>{{with .Thin.MergePolicy}}{{if .Editable}}<script defer src="{{asset "static/merge-ships.js"}}"></script>{{end}}{{end}}{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if or (eq .Key "thinking") (eq .Key "settings-hub")}}<script defer src="{{asset "static/thinking-preview.js"}}"></script><script defer src="{{asset "static/settings.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/vendor/tweetnacl/nacl-fast.js"}}"></script><script defer src="{{asset "static/seal.js"}}"></script><script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .MachinesStream}}<script defer src="{{asset "static/machines.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script><script defer src="{{asset "static/chat-attach.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}}
{{define "up"}}/work{{if .Key}}#nav-{{.Key}}{{end}}{{end}}
{{define "up-label"}}{{.TeamName}}{{end}}
{{define "brand"}}<a rst-shell-brand href="/work">{{icon "users"}}{{.TeamName}}</a>{{end}}
diff --git a/internal/equipo/templates/merge_policy.html b/internal/equipo/templates/merge_policy.html
index 8ced5c1a..bfc50917 100644
--- a/internal/equipo/templates/merge_policy.html
+++ b/internal/equipo/templates/merge_policy.html
@@ -1,15 +1,22 @@
{{define "merge-policy"}}{{with .}}<section equipo-p-section data-merge-policy>
<h2>{{copy "work.merge_policy.title"}}</h2>
-{{range .Sentences}}<p>{{.}}</p>{{end}}
+<div data-merge-sentences>{{range .Sentences}}<p>{{.}}</p>{{end}}</div>
{{with .Words}}<p equipo-quiet data-merge-words>{{printf (copy "work.merge_policy.words") .}}</p>{{end}}
{{if .Recent}}<h3>{{copy "work.merge_policy.decisions"}}</h3><ul equipo-notes>{{range .Recent}}<li data-merge-decision><p>{{.Label}}</p>{{with .Failing}}<p equipo-cap>{{.}}</p>{{end}}</li>{{end}}</ul>{{end}}
-{{if .Editable}}<details data-merge-policy-edit><summary rst-btn>{{copy "work.merge_policy.edit"}}</summary>
+{{if .Editable}}{{/* The ship question applies at once (Paul, 2026-11-11): each
+ button is its own form, so without script it posts and comes back
+ here. merge-ships.js posts in the background and offers Undo. */}}<div equipo-ships role="group" aria-labelledby="merge-ships-q" data-merge-ships="{{.MainShips}}">
+<p equipo-ships-q id="merge-ships-q">{{copy "work.merge_policy.ships"}}</p>
+<div equipo-ships-choices>{{$ships := .MainShips}}{{range $v := split "yes|no" "|"}}<form method="post" action="/projects/{{$.ProjectID}}/merge-policy" equipo-inline-form data-merge-ships-form><input type="hidden" name="revision" value="{{$.Revision}}"><input type="hidden" name="only" value="main_ships"><input type="hidden" name="main_ships" value="{{$v}}"><button rst-btn type="submit" aria-pressed="{{if eq $ships $v}}true{{else}}false{{end}}" data-merge-ships-choice="{{$v}}">{{copy (print "work.merge_policy.ships_opt_" $v)}}</button></form>{{end}}</div>
+<p equipo-ships-done data-merge-ships-done></p>
+<template data-merge-ships-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span><button equipo-link type="button" data-merge-ships-undo>{{copy "chat.card.undo"}}</button></template>
+</div>
+<details data-merge-policy-edit><summary rst-btn>{{copy "work.merge_policy.edit"}}</summary>
<form method="post" action="/projects/{{.ProjectID}}/merge-policy" data-merge-policy-form>
<input type="hidden" name="revision" value="{{.Revision}}">
<label>{{copy "work.merge_policy.mode"}} <select rst-input name="mode"><option value="rules"{{if eq .Mode "rules"}} selected{{end}}>{{copy "work.merge_policy.mode_rules"}}</option><option value="ask"{{if eq .Mode "ask"}} selected{{end}}>{{copy "work.merge_policy.mode_ask"}}</option></select></label>
<label>{{copy "work.merge_policy.max_lines"}} <input rst-input type="number" name="max_lines" min="0" max="2000" value="{{.MaxLines}}"></label>
<label>{{copy "work.merge_policy.max_files"}} <input rst-input type="number" name="max_files" min="0" max="100" value="{{.MaxFiles}}"></label>
-<label>{{copy "work.merge_policy.ships"}} <select rst-input name="main_ships"><option value="unknown"{{if eq .MainShips "unknown"}} selected{{end}}>{{copy "work.merge_policy.ships_opt_unknown"}}</option><option value="yes"{{if eq .MainShips "yes"}} selected{{end}}>{{copy "work.merge_policy.ships_opt_yes"}}</option><option value="no"{{if eq .MainShips "no"}} selected{{end}}>{{copy "work.merge_policy.ships_opt_no"}}</option></select></label>
<label>{{copy "work.merge_policy.extra_label"}} <textarea rst-input name="extra_sensitive" rows="3">{{.Extra}}</textarea></label>
<label>{{copy "work.merge_policy.words_label"}} <input rst-input name="words" maxlength="300" value="{{.Words}}"></label>
<button rst-btn="primary" type="submit" data-merge-policy-save>{{copy "work.merge_policy.save"}}</button>
diff --git a/internal/thintest/ships_buttons_browser_test.go b/internal/thintest/ships_buttons_browser_test.go
new file mode 100644
index 00000000..24ac6203
--- /dev/null
+++ b/internal/thintest/ships_buttons_browser_test.go
@@ -0,0 +1,67 @@
+//go:build browser
+
+package thintest
+
+import (
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// TestBrowserShipsButtons: on the project page a tap on "Yes, it ships"
+// applies at once with no reload: the button shows pressed, the sentence
+// changes, "Saved" shows with Undo, and Undo puts back the unanswered
+// state. Switching to the other answer and back works the same, and the
+// Change form, opened with an edit in it, keeps the edit and saves over
+// the new revision.
+func TestBrowserShipsButtons(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "reduce")
+ defer p.stop()
+ p.open("/projects/" + project)
+ p.wait(`document.querySelector('[data-merge-ships] [data-merge-ships-choice]')`, "the ship buttons")
+ choice := func(v string) string { return `document.querySelector('[data-merge-ships-choice="` + v + `"]')` }
+ p.check(`document.querySelectorAll('[data-merge-ships-choice]').length===2 && !document.querySelector('select[name=main_ships]') && !document.querySelector('[data-merge-ships] [aria-pressed="true"]')`, "two unpressed buttons and no select")
+ p.check(`document.querySelector('[data-merge-sentences]').textContent.includes("I don't know yet whether merging")`, "the unanswered sentence")
+ // An edit waiting in the Change form survives the taps.
+ p.check(`(()=>{document.querySelector('[data-merge-policy-edit]').open=true;document.querySelector('[data-merge-policy-form] [name=words]').value='only small ones';return true})()`, "type in the form")
+
+ p.check(`(()=>{`+choice("yes")+`.click();return true})()`, "tap yes")
+ p.wait(choice("yes")+`.getAttribute('aria-pressed')==='true' && `+choice("no")+`.getAttribute('aria-pressed')==='false'`, "yes pressed")
+ p.wait(`!!document.querySelector('[data-merge-ships-done] [equipo-saved-tick][data-shown]') && !!document.querySelector('[data-merge-ships-done] [data-merge-ships-undo]')`, "Saved and Undo")
+ p.check(`document.querySelector('[data-merge-sentences]').textContent.includes('Merging to main ships to users')`, "the sentence did not change")
+ if got, _ := r.client.MergePolicy(r.ctx, project); got.MainShips != "yes" {
+ t.Fatalf("after tap: %+v", got)
+ }
+ p.stayed("tap")
+ p.fits("the ship buttons")
+ p.shot("ships-buttons-1280")
+
+ p.check(`(()=>{document.querySelector('[data-merge-ships-undo]').click();return true})()`, "Undo")
+ p.wait(`!document.querySelector('[data-merge-ships] [aria-pressed="true"]') && !document.querySelector('[data-merge-ships-undo]') && !!document.querySelector('[data-merge-ships-done] [equipo-saved-tick]')`, "back to unanswered, Saved, no second Undo")
+ p.check(`document.querySelector('[data-merge-sentences]').textContent.includes("I don't know yet whether merging")`, "the unanswered sentence after Undo")
+ if got, _ := r.client.MergePolicy(r.ctx, project); got.MainShips != "unknown" {
+ t.Fatalf("after Undo: %+v", got)
+ }
+
+ // No, then yes, then Undo: back to no.
+ p.check(`(()=>{`+choice("no")+`.click();return true})()`, "tap no")
+ p.wait(choice("no")+`.getAttribute('aria-pressed')==='true' && !document.querySelector('[data-merge-ships]').hasAttribute('aria-busy')`, "no pressed")
+ p.check(`(()=>{`+choice("yes")+`.click();return true})()`, "tap yes")
+ p.wait(choice("yes")+`.getAttribute('aria-pressed')==='true' && !!document.querySelector('[data-merge-ships-undo]')`, "yes pressed")
+ p.check(`(()=>{document.querySelector('[data-merge-ships-undo]').click();return true})()`, "Undo")
+ p.wait(choice("no")+`.getAttribute('aria-pressed')==='true' && !document.querySelector('[data-merge-ships-undo]')`, "back to no")
+ if got, _ := r.client.MergePolicy(r.ctx, project); got.MainShips != "no" {
+ t.Fatalf("after the second Undo: %+v", got)
+ }
+ p.stayed("taps and Undo")
+
+ // The form kept its edit and saves over the moved revision.
+ p.check(`document.querySelector('[data-merge-policy-edit]').open && document.querySelector('[data-merge-policy-form] [name=words]').value==='only small ones'`, "the form lost its edit")
+ p.check(`(()=>{document.querySelector('[data-merge-policy-save]').click();return true})()`, "Save")
+ p.wait(`document.querySelector('[data-merge-words]') && document.querySelector('[data-merge-words]').textContent.includes('only small ones')`, "the form saved")
+ if got, _ := r.client.MergePolicy(r.ctx, project); got.MainShips != "no" || got.Words != "only small ones" {
+ t.Fatalf("after Save: %+v", got)
+ }
+}
diff --git a/internal/thintest/ships_buttons_test.go b/internal/thintest/ships_buttons_test.go
new file mode 100644
index 00000000..b5e3e0c5
--- /dev/null
+++ b/internal/thintest/ships_buttons_test.go
@@ -0,0 +1,131 @@
+package thintest
+
+import (
+ "net/http"
+ "net/url"
+ "strconv"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// TestContractShipsButtons (Paul, 2026-11-11): "Does merging to main
+// ship to users?" is two buttons that apply at once, outside the Change
+// form. A tap posts only the answer at the page's revision and leaves
+// the rest of the policy as it was; Undo is the same post with the
+// value before, "unknown" included; each is an audited policy write. A
+// stale revision changes nothing; a member sees no buttons and is
+// refused.
+func TestContractShipsButtons(t *testing.T) {
+ r := newToolRigAt(t, wire.ProtocolMergeFacts)
+ project := r.project()
+ owner := r.inst.Cookie()
+ path := "/projects/" + project + "/merge-policy"
+ // A policy with something in every field, so a tap that dropped one
+ // would show.
+ p0, _ := r.client.MergePolicy(r.ctx, project)
+ if _, err := r.client.SetMergePolicy(r.ctx, project, wire.SetMergePolicy{Mode: "ask", MaxLines: 40, MaxFiles: 3, MainShips: "unknown", ExtraSensitive: []string{"billing/**"}, Words: "ask me before Woodstar merges", Revision: p0.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ base, _ := r.client.MergePolicy(r.ctx, project)
+ audits := func() int {
+ var n int
+ if err := r.inst.DB.Writer().QueryRow("SELECT COUNT(*) FROM chat_merge_audit WHERE project_id = ? AND kind = 'policy'", project).Scan(&n); err != nil {
+ t.Fatal(err)
+ }
+ return n
+ }
+ tap := func(c *http.Cookie, value string, rev int64) int {
+ t.Helper()
+ status, loc := r.post(c, path, url.Values{"revision": {strconv.FormatInt(rev, 10)}, "only": {"main_ships"}, "main_ships": {value}})
+ if status == http.StatusSeeOther && loc != "/projects/"+project {
+ t.Fatalf("tap %s came back to %q", value, loc)
+ }
+ return status
+ }
+ pressed := func(page, value string) bool {
+ return strings.Contains(page, `aria-pressed="true" data-merge-ships-choice="`+value+`"`)
+ }
+ // Before the first tap: two buttons, neither pressed, no select.
+ page := r.get(owner, "/projects/"+project, 200)
+ for _, v := range []string{"yes", "no"} {
+ if !strings.Contains(page, `aria-pressed="false" data-merge-ships-choice="`+v+`"`) {
+ t.Fatalf("no unpressed %s button: %s", v, page)
+ }
+ }
+ if strings.Contains(page, `<select rst-input name="main_ships"`) || strings.Contains(page, "Not answered") || !strings.Contains(page, `data-merge-policy-form`) {
+ t.Fatalf("the ship question is still on the form: %s", page)
+ }
+ if i, j := strings.Index(page, "data-merge-ships-form"), strings.Index(page, "<details data-merge-policy-edit>"); i < 0 || j < 0 || i > j {
+ t.Fatal("the buttons are inside the Change form")
+ }
+ same := func(p wire.MergePolicy, ships string, rev int64) {
+ t.Helper()
+ if p.MainShips != ships || p.Revision != rev || p.Mode != base.Mode || p.MaxLines != base.MaxLines || p.MaxFiles != base.MaxFiles || strings.Join(p.ExtraSensitive, ",") != "billing/**" || p.Words != base.Words {
+ t.Fatalf("after %s at %d: %+v (was %+v)", ships, rev, p, base)
+ }
+ }
+ n := audits()
+ // Yes, then Undo back to unknown.
+ if s := tap(owner, "yes", base.Revision); s != http.StatusSeeOther {
+ t.Fatalf("tap yes: %d", s)
+ }
+ p, _ := r.client.MergePolicy(r.ctx, project)
+ same(p, "yes", base.Revision+1)
+ if page = r.get(owner, "/projects/"+project, 200); !pressed(page, "yes") || pressed(page, "no") {
+ t.Fatal("yes is not the pressed button")
+ }
+ if s := tap(owner, "unknown", p.Revision); s != http.StatusSeeOther {
+ t.Fatalf("undo to unknown: %d", s)
+ }
+ p, _ = r.client.MergePolicy(r.ctx, project)
+ same(p, "unknown", base.Revision+2)
+ if page = r.get(owner, "/projects/"+project, 200); pressed(page, "yes") || pressed(page, "no") {
+ t.Fatal("a button pressed after Undo to unanswered")
+ }
+ // No, then yes, then Undo back to no.
+ tap(owner, "no", p.Revision)
+ tap(owner, "yes", p.Revision+1)
+ if s := tap(owner, "no", p.Revision+2); s != http.StatusSeeOther {
+ t.Fatalf("undo to no: %d", s)
+ }
+ p, _ = r.client.MergePolicy(r.ctx, project)
+ same(p, "no", base.Revision+5)
+ if got := audits(); got != n+5 {
+ t.Fatalf("audit rows %d, want %d", got, n+5)
+ }
+ // A stale page is refused and changes nothing.
+ if s := tap(owner, "yes", p.Revision-1); s != http.StatusConflict {
+ t.Fatalf("stale tap: %d", s)
+ }
+ if s := tap(owner, "yes", p.Revision+1); s != http.StatusConflict {
+ t.Fatalf("tap ahead of the record: %d", s)
+ }
+ if s := tap(owner, "maybe", p.Revision); s != http.StatusUnprocessableEntity {
+ t.Fatalf("bad value: %d", s)
+ }
+ if status, _ := r.post(owner, path, url.Values{"revision": {strconv.FormatInt(p.Revision, 10)}, "only": {"main_ships"}}); status != http.StatusUnprocessableEntity {
+ t.Fatalf("no value: %d", status)
+ }
+ again, _ := r.client.MergePolicy(r.ctx, project)
+ same(again, "no", p.Revision)
+ // The Change form saves its own fields and keeps the answer.
+ if status, _ := r.post(owner, path, url.Values{"revision": {strconv.FormatInt(p.Revision, 10)}, "mode": {"rules"}, "max_lines": {"40"}, "max_files": {"3"}, "extra_sensitive": {"billing/**"}, "words": {"merge small Woodstar changes"}}); status != http.StatusSeeOther {
+ t.Fatalf("form save: %d", status)
+ }
+ if f, _ := r.client.MergePolicy(r.ctx, project); f.MainShips != "no" || f.Mode != "rules" || f.Words != "merge small Woodstar changes" || f.Revision != p.Revision+1 {
+ t.Fatalf("form save %+v", f)
+ }
+ // A member: no buttons, and a refused post.
+ member := r.memberCookie()
+ if mpage := r.get(member, "/projects/"+project, 200); strings.Contains(mpage, "data-merge-ships") || !strings.Contains(mpage, "How Equipo merges") {
+ t.Fatal("member's project page offers the ship buttons")
+ }
+ if s := tap(member, "yes", p.Revision+1); s != http.StatusForbidden {
+ t.Fatalf("member tap: %d", s)
+ }
+ if f, _ := r.client.MergePolicy(r.ctx, project); f.MainShips != "no" || f.Revision != p.Revision+1 {
+ t.Fatalf("member tap changed it %+v", f)
+ }
+}