| 1 | # Equipo native, slice 1 (plan, 2026-11-18) |
| 2 | |
| 3 | Paul approved building the first production slice of Equipo for iPhone and Mac |
| 4 | on 2026-11-18, with three defaults: Equipo's own device pairing behind a |
| 5 | sign-in interface (Oficina ID later), rastrillo/native's toolchain, and a |
| 6 | Developer ID Mac build with Sparkle plus an iPhone build run from Xcode. The |
| 7 | design is revision 7 of the mockups on `native-mockups-r4` |
| 8 | (`docs/native/r7/index.md`) and the web-led sync proposal |
| 9 | (`docs/native/sync-proposal.md`). The web leads; native follows its parity |
| 10 | rows. |
| 11 | |
| 12 | ## What a person can do |
| 13 | |
| 14 | 1. Pair the device: the app shows a code, opens the team in the browser, and |
| 15 | waits while the person approves it there. The credential lives in the |
| 16 | Keychain for its thirty days. Sign out revokes the device. |
| 17 | 2. Read the conversation and send messages. Answer questions in their cards, |
| 18 | with an option or in their own words when the question allows text. |
| 19 | 3. Needs you, Tasks and the task view with its steps, usage and its thread |
| 20 | ("Talk about this"), which can be read and replied to. |
| 21 | 4. New activity arrives on the conversation's event stream while the app is |
| 22 | in front; the thinking line shows the coordinator's real activity. A |
| 23 | dropped stream reconnects from its cursor. Offline is shown, never hidden. |
| 24 | |
| 25 | ## Finding: the device reads the conversation engine, not the OpenAPI shapes |
| 26 | |
| 27 | A device bearer is answered by the conversation engine's routes |
| 28 | (`internal/equipo/chat/http.go`, shapes in `internal/wire`): `/snapshot`, |
| 29 | `/messages`, `/events`, `/cards/{id}/answer`, `/tasks`, `/needs-you`, |
| 30 | `/tasks/{id}` and `/tasks/{id}/thread`. The web's Roster is drawn from the |
| 31 | same engine. `docs/api/equipo-v1.openapi.json` describes a different |
| 32 | conversation shape, and a live run against a local drive showed the device |
| 33 | never sees it (`/projects` with a bearer answers in the engine's shape). |
| 34 | |
| 35 | So slice 1 is built on the engine's routes, and most of |
| 36 | `roster-gaps.json` on `native-mockups-r4` is not missing from the server, |
| 37 | only from the OpenAPI file: stage, Checks, Review, Branch, card times, the |
| 38 | activity label and the event stream are all there. Pairing, devices and |
| 39 | errors stay on the person API and its schema. Two follow-ups for Paul: the |
| 40 | OpenAPI file should describe what a device is actually answered with (or say |
| 41 | it is not the device's contract), and the sync proposal's gap list should be |
| 42 | cut down to what is really missing (set aside and the roll-up). |
| 43 | |
| 44 | ## What waits |
| 45 | |
| 46 | - Merges, approvals, Contra and every other decision card open the web app, |
| 47 | until each has an accepted parity row (sync proposal, "must match"). |
| 48 | - Set aside and the day roll-up. Where a value has no words yet, the native |
| 49 | view leaves it out; it never invents it. |
| 50 | - Push notifications (APNs), Oficina ID, several teams at once, TestFlight. |
| 51 | |
| 52 | ## Shape |
| 53 | |
| 54 | ``` |
| 55 | native/ |
| 56 | apple/ SwiftPM: EquipoKit (library), EquipoMac (executable), tests |
| 57 | ios/project.yml XcodeGen: EquipoPhone, the iPhone app |
| 58 | mac-updates.json Sparkle settings for rastrillo's bundle-mac.py |
| 59 | scripts/ check-native.sh, build-mac.sh, build-iphone.sh |
| 60 | ``` |
| 61 | |
| 62 | Pinned to rastrillo/native `f1c7a14` (the revision Docs uses). Deployment |
| 63 | targets iOS 26 and macOS 26, as Docs. Bundle ID `works.oficina.equipo`; |
| 64 | "Oficina Equipo" in Finder, the Dock and Spotlight and "Equipo" inside the |
| 65 | app (the native level-up's D1 and D2). |
| 66 | |
| 67 | EquipoKit owns: |
| 68 | |
| 69 | - **Transport.** URLSession, ephemeral, no cookies, no cache, no redirects. |
| 70 | Bearer only, never mixed with a browser cookie. Every write carries an |
| 71 | `Idempotency-Key` kept with its body and revision until the result is known; |
| 72 | a retry resends the same three. Responses are bounded. Outcomes are reported |
| 73 | to RastrilloApple's `NativeConnectivity` so its offline banner works. |
| 74 | - **Errors.** The person API's `code`, `copy_key`, `request_id` and |
| 75 | `current_revision`. 401 ends the session; 409 `revision_conflict` refetches |
| 76 | before any new decision; 410 restarts what the API says to restart. |
| 77 | - **Pairing.** Curve25519 (Ed25519) key generated on the device and kept in |
| 78 | the Keychain, `ThisDeviceOnly`. The proof message is the server's own |
| 79 | `personapi.DeviceProofMessage`; a Go test owns a vector file that the Swift |
| 80 | tests must reproduce byte for byte. Poll every five seconds at least, slow |
| 81 | down on 429, start again on 410. |
| 82 | - **Models.** Hand-written Codable. The conversation fixtures under |
| 83 | `Fixtures/thin` are the server's own answers, captured from the thin test |
| 84 | rig with a device bearer by `internal/thintest` `TestNativeFixtures` |
| 85 | (`EQUIPO_UPDATE_NATIVE_FIXTURES=1`) and strictly decoded into `internal/wire` |
| 86 | on every Go run, so a changed wire shape fails CI. Pairing, device and error |
| 87 | fixtures are checked against the OpenAPI schema by |
| 88 | `native/scripts/check-fixtures.py`. An unloaded Needs you count stays |
| 89 | unknown, never zero. |
| 90 | - **Sync.** One `CoalescedRunner` per refresh (snapshot, tasks, needs-you), |
| 91 | reconciled by ID and revision. The event stream resumes after its cursor; |
| 92 | an activity moves the thinking line without a read, a change to a message, |
| 93 | turn, card, task, step or project reads again, and runner or connection |
| 94 | events are ignored. Writes keep their key and body until they have a |
| 95 | result; an answer is bound to the card revision the person saw, and a |
| 96 | stale or answered card is shown as it is now and never resent. |
| 97 | - **Presentation.** Roster from r7 (bylines, raised cards, tone rules), fed |
| 98 | only from API data. |
| 99 | |
| 100 | Locale: dates and times use `Date.FormatStyle` in the reader's locale; |
| 101 | token counts use the locale's number format. Storage and every request stay |
| 102 | canonical (ISO dates, integers). Slice 1 shows no money. |
| 103 | |
| 104 | Copy: native strings live in one String Catalog, English. Where the web |
| 105 | already has a string (`copy.go`), the native one uses the same words. Paul |
| 106 | reviewed the 86 native-only strings on 2026-11-19 and approved them as |
| 107 | written; the other 57 are the web's accepted words. A new or changed |
| 108 | native string is draft until it is reviewed the same way. |
| 109 | |
| 110 | ## Gates |
| 111 | |
| 112 | - `native/scripts/check-native.sh`: Swift tests, the fixture check, the Mac |
| 113 | executable and an unsigned iPhone Simulator build. Runs on a Mac. |
| 114 | - Go: the proof vector test runs inside `make test`, on Linux CI. |
| 115 | - An end-to-end pairing against a local Equipo on 127.0.0.1 before review. |
| 116 | - Mutations of the guards that matter each fail a test: idempotency key |
| 117 | reuse (messages, thread replies, answers), revision on answers, stale |
| 118 | answers never resent, closed cards never answered, unknown counts, proof |
| 119 | bytes, the polling floor, the stream cursor, activity without a read, |
| 120 | facts never invented, and every fact's words in the catalog. Go: a fixture |
| 121 | with an invented field fails `TestNativeFixtures`. |
| 122 | - One Fable review of the whole branch. Paul lands it. |
| 123 | |
| 124 | ## Steps for Paul |
| 125 | |
| 126 | - Slice 1 needs no provisioning profile: the Mac app is signed with the |
| 127 | Developer ID certificate and notarised (no restricted entitlements), and the |
| 128 | iPhone build runs from Xcode with automatic signing. The Sparkle feed under |
| 129 | `native-releases/equipo` is needed when there is something to ship. |
| 130 | - Approving the first device in the browser. |
| 131 | |