oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Equipo native, slice 2 (plan for Paul, 2026-11-20)
2
3Slice 1 landed on 2026-11-19: pairing, the conversation in the Roster look,
4question cards, Needs you, Tasks and the task view (plan
5`2026-11-18-equipo-native-slice-1.md`). TestFlight has 0.1.0 (2); the Mac has
60.1.0 (1) on Sparkle. Slice 2 makes the apps something you can leave running:
7they tell you when something needs you, show work in progress without opening
8them, and let you answer the most common decision on the device.
9
10Paul asked on 2026-11-20 for push notifications and a Live Activity, after
11merges on the device. Decisions this plan needs are at the end, each with a
12recommendation.
13
14## What a person can do
15
161. **Answer a merge on the device.** The merge card shows the server's
17 question, the preview link when there is one, and its choices (Merge, Wait
18 for a Mac), Merge primary, exactly as the web does. "Does main ship?" cards
19 (`merge_ships`) too. Other decisions still open the web.
202. **Be told when something needs you.** A notification when a decision or a
21 question waits on you, when the coordinator replies while the app is not in
22 front, and when a task you started finishes or stops. The app badge is your
23 Needs you count. Tapping a notification opens the card or task.
243. **Watch a task without opening the app.** A Live Activity for each task you
25 started, from the moment work starts until it ends: the title, the five-stop
26 stage track, who is working on it and the latest activity line. When it
27 needs you it turns amber and alerts; tapping opens the decision. On the Mac,
28 macOS 26 shows the iPhone's Live Activities in the menu bar.
294. **Set a card aside** (if it fits; D5). The web's Set aside and Undo: never
30 answers, cancels or starts anything; the card stays in Needs you, grouped
31 under Set aside.
32
33## What waits
34
35- The other decision cards (What next, Publish, Add a specialist, Grant
36 access, Research), Copy hold and Wrong project? still open the web.
37- Replies inside an answered card, and the day roll-up (no server support yet).
38- Answering from the notification itself (D4).
39
40## Shape of the work
41
42### Server (Equipo)
43
44- **Device push registrations.** `POST /api/v1/push-registrations` with the
45 device's APNs token, its environment (development or production) and, on
46 iPhone, its Live Activity push-to-start token. Bound to the paired device
47 credential, replaced on re-registration, deleted when the device is revoked,
48 the person is removed, or Apple answers `Unregistered`. Tokens are never
49 logged. Documented in the OpenAPI file and covered by the device contract
50 test like every other device route.
51- **A push outbox.** The engine already appends an event for every change
52 (`t.event`). Inside the same transaction, a small rule table decides whether
53 the change is a push, and writes a `push_outbox` row:
54 - a card that waits on the person opens (merge, question, other decisions):
55 an alert, `apns-collapse-id` the card, priority 10;
56 - the coordinator's reply finishes while the person has no open stream: an
57 alert;
58 - a task the person started reaches done, cancelled or failed: a passive
59 alert;
60 - every Needs you change: the badge count;
61 - a task the person started is dispatched: a Live Activity start; its stage,
62 step or needs-you change: an update (priority 10 for needs you, 5 for the
63 rest); its end: an end with the outcome.
64 Activity lines (the "Reading README.md" line) update the Live Activity at
65 most once a minute, so the activity stays inside Apple's update budget.
66- **A sender** drains the outbox through a transport, retries with backoff,
67 and records Apple's answer. Transports mirror mail's: the CARLOS platform
68 transport in production (D1), a logged transport only on loopback or
69 staging, as `EQUIPO_ALLOW_LOGGED_MAIL` is for mail.
70- **Notification text** is server-rendered from `copy.go`, in the
71 recipient's locale where Equipo has one, through copy review. The body of a
72 coordinator reply is the reply's first line (D2).
73- **Set aside** (D5): the store already has `SetCardAside` and the
74 `chat_card_visibility` table; the engine gains `POST /cards/{id}/visibility`
75 and the card's per-person `aside` field, and Needs you keeps set-aside cards.
76
77### Platform (CARLOS), if D1 is the platform
78
79A `POST /v1/push` verb on the per-instance control socket, as mail submission
80added `POST /v1/mail`: the instance submits a device token, topic, push type,
81priority, collapse ID and payload; a box-local sender with its own uid holds
82the Team Tito APNs auth key and talks HTTP/2 to Apple. Policy before sending:
83the topic must be one of the app's bundle IDs, a per-instance rate cap, a pause
84switch. The instance holds no Apple credential. rastrillo gains a `push`
85transport like `mail`'s `submit`.
86
87### iPhone and Mac
88
89- **Notifications** (both): ask permission after pairing, not at first launch;
90 register the token; handle a tap by opening the card or task; categories for
91 "Needs you" with "Open" only (D4). The Mac needs the `aps-environment`
92 entitlement, which means a Developer ID provisioning profile for
93 `works.oficina.equipo`, as the other Oficina Mac apps already have.
94- **Live Activity** (iPhone): a widget extension, `works.oficina.equipo.activity`,
95 with the Lock Screen and Dynamic Island layouts drawn from Roster (the stage
96 track, the specialist's tile, amber for needs you). The app sends its
97 push-to-start token at registration so the server can start an activity
98 without the app running. At most three at once, the three most recently
99 started tasks (D3); Apple caps them anyway.
100- **Merge card**: native buttons on `POST /cards/{id}/answer`, bound to the
101 revision seen, the slice 1 rules for stale and lost answers unchanged.
102 Parity row R-02 is `must_match`: the same question text, choices, primary and
103 outcome line as the web; a test renders both from the same server fixture.
104
105## Decisions for Paul
106
107**Ruled 2026-11-20:** Paul approved the plan with every recommendation below ("Go ahead"), and copy review by Luna ("Luna can probably do copy review"): Luna's verdicts are the review for slice 2's strings.
108
109| | Decision | Recommendation |
110| --- | --- | --- |
111| D1 | Who holds the Apple push key | **CARLOS platform push**, like mail submission: instances hold no sending credential (your 2026-11-12 ruling for mail). It needs a CARLOS piece first. The alternative, the key as a secret on each Equipo instance, is faster but puts the same key on every team's box. |
112| D2 | What a notification shows on the Lock Screen | The card's question and the reply's first line, as Messages does; iOS already hides previews while locked unless you change that. The alternative is a fixed "Your coordinator replied" with no content. |
113| D3 | Live Activities | One per task you started, at most three; nothing for the coordinator's own turns (they last seconds and the app's thinking line covers them). |
114| D4 | Answering from a notification | Not in slice 2: a notification opens the card, and you answer in the app. A merge from a notification button is a tap, but the person API says a notification action is never authentication, and the card's context (Checks, Review, preview) should be in front of you. Revisit after living with it. |
115| D5 | Set aside in slice 2 | Yes, if the push work lands first; it is small on the server (the store already has it). |
116
117## Steps for Paul
118
119- The Apple push key (an APNs auth key for Team Tito, in the developer portal).
120 I can make it in the browser while you are signed in; it goes to the
121 CARLOS box (D1) and never into a repository.
122- Approving the Push Notifications capability on `works.oficina.equipo`,
123 the new `works.oficina.equipo.activity` ID and the profiles they need; I can
124 do these through the App Store Connect API.
125- Copy review of the notification and Live Activity strings, in the copy
126 review app.
127
128## Gates
129
130- Server: failing tests first for the rules (which change pushes what, to
131 whom, never to someone removed or revoked), the outbox written in the same
132 transaction as the event, idempotent sends (collapse IDs, no duplicate after
133 a retry), token deletion on `Unregistered`, the logged transport refused on a
134 public origin; the device contract test covering the new routes; payload
135 goldens for every push kind. Mutations of each guard.
136- Native: EquipoKit tests for registration, the tap routing and the Live
137 Activity content state from server fixtures; the merge card parity test; the
138 existing native gate.
139- End to end: a local drive with the logged transport, then a real device
140 through TestFlight against staging: a merge card arrives as a notification,
141 the Live Activity starts, moves through its stages and ends, and a merge
142 answered on the phone lands.
143- One Fable review per branch; Paul lands each.
144
145## Order
146
1471. CARLOS push submission (if D1), in parallel with 2.
1482. Equipo: registrations, outbox, rules, logged transport, copy.
1493. Native: the merge card (no push needed; can ship first).
1504. Native: notifications on iPhone and Mac.
1515. Native: the Live Activity extension.
1526. Set aside (D5).
1537. TestFlight and Mac releases; live check on staging.
154