oficina / equipo Public
Notification actions, slice 8
Branch: notify/actions. Approved design: 2026-11-27-notification-actions.md. Normal merges of main 8ac4dbaf and a2619ce3 (merge 69219bb0); no runner protocol change.
Behavior and release boundary
Notification actions are opt-in at both ends. Production defaults off; EQUIPO_NOTIFICATION_ACTIONS=1 enables the capability after the physical-device checks below. Old registrations, old payloads, unknown categories and malformed bindings retain open-only behavior. Every native response action requires .authenticationRequired and .foreground.
The mockup's model-written lock-screen option buttons were deliberately not built, pending any future privacy decision by Paul. Only optionless questions whose complete text is already in today's alert offer direct text entry. Other questions open their bound card after unlock. The alert adds no private text. Merge opens fresh task detail, Checks and the current candidate's Review summary, then the existing confirmation with a separate final tap.
Server receipts bind person, credential, operation, target, request key and digest. They retain result identifiers for seven days, not duplicate answer text. Repeated answers return those identifiers with current presentation fields; timestamp formatting need not be byte-identical to the first response. Native stores the exact request before POST, keeps uncertain writes for at most 24 hours and never retries on a timer. Credentials stay in the Keychain. The registration binding rotates with the account or device sign-in.
Migration 0111 adds receipt storage and registration opt-in fields, with the schema snapshot. The existing API routes are extended; no new GET route or performance-budget exemption is introduced.
Test-first evidence
Scratch logs: physical TMPDIR notify-actions-evidence/ (archive before handoff). Commands use GOMAXPROCS=4 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0, go test -p 4, and swift test --package-path native/apple --jobs 4 --disable-xctest --filter 'Notification.*Tests'. No full local gate. Machine load/swap and other heavy jobs checked before each run; work paused above load 20, including a spike above 100.
new-guards-red.log: changed whitespace under an answer key was incorrectly accepted.new-guards-green.log: digest now uses the submitted body before answer trimming; notification and migration checks pass.payload-red.log,http-red.log,server-contract.log: capability, payload opt-in and HTTP binding tests started red, then pass, including old empty retry requests and partial/unknown binding refusal.schema-red.log: bound retry undocumented.receipts-schema.log: generated retry and both 409 response shapes pass; concurrent receipt deliveries produce one answer, and current membership/device checks apply before receipt reads.native-parser-red.log,native-journal-red2.log,native-dispatch-red.log: missing native functionality before implementation.native-dispatch-green3.log: 13/14 tests pass; lost-reply restoration caught snake-case decoding of the journal envelope. Corrected to plain Codable for the envelope; original HTTP request remains unchanged.native-dispatch-green4.log: all 14 focused tests pass.merge-options-red.log: the filter omitted the web'snot_nowandwait_macalternatives. The allowlist now covers those known merge choices.native-restore-red.log: pending replies did not reappear after relaunch.native-restore-green.log: all 17 focused tests pass. Restoration exposes an explicit Retry and never posts automatically. Account switch, sign-out cleanup and stale-response refresh tests pass.- Sign-in lifetime source guard and parity: pass, 336 web strings byte-identical.
Direct card read and compatibility
GET /cards/{id} remains the same URL. Reserved c_ IDs select the thin store before lookup, with no fallback after any refusal; other IDs preserve personapi and ProjectCard. Thin reads use an indexed primary-key lookup, current person/member/device checks, Coordinator lane and not-held visibility, and cardView plus its revision/ETag. OpenAPI's oneOf distinguishes the thin Card shape (state/question) from PersonAPICard (resource_id/actions); the compatibility operation and both shapes have contract coverage.
The old newest-50 scan fails card-read-red.log; card-contract-green.log passes the older-than-window question/options, projection byte equality, visibility, dispatch and legacy regression tests. Native tests place both the bound question and merge outside the snapshot, then use the direct read. final-go-focused.log passes the six focused packages, including migration snapshot, API copy and operation/schema checks.
Legacy message and Coordinator-turn IDs use crypto/rand.Text's RFC 4648 uppercase Base32 alphabet, which contains neither lowercase c nor underscore; native question aliases start native:. The generator and aliases are pinned by TestLegacyCardIDsCannotUseThinPrefix. A counts-only read of the production CARLOS replica at transaction 206586 (2026-11-26 23:08:47 UTC) found 68 legacy conversationcards and 341 coordinatorturns, with zero c_ IDs in both tables. No live database writes or row contents were read. The existing measured legacy GET perf path remains; its new device branch uses a primary-key lookup instead of a list scan. No new route or perf exemption.
Mutations
All 19 server mutations die: digesting the trimmed answer; ignoring receipt digest mismatch, disabled capability or current device; dropping task revision, step revision or attempt; ignoring the retry receipt; exposing text input for option/clipped questions; dropping retry creator/termination or merge-choice validation; and dropping direct-card person, held, lane, current-person, member/device or store-prefix checks. The initially noncompiling device mutation was corrected and rerun: only its valid failed test is counted.
All 19 native mutations die: dropping unlock, foreground, payload version, registration capability, response account binding, journal-before-POST, question options, switch-notice cleanup, sign-out journal cleanup, stale refresh, journal binding/expiry/count, double-submit guard, final Merge tap, card revision, dispatch capability, omitting the direct stale-card refresh and replacing direct lookup with the snapshot window. Every mutation was restored. Logs are mutation-<name>.log and mutation-native-<name>.log, with per-case JSON results. A narrow SwiftPM invocation stalled before running tests; its helper was sampled and terminated, then the explicit Swift Testing invocation ran. It is not counted as a killed mutation.
The stale-response regression also first failed (stale-direct-red.log): a 409 refreshed only the snapshot and retained the old card. It now refetches the bound ID for navigation, merges the current projection, and never changes the original request's key/body/revision. The restored native suite passes all 19 tests (final-native-focused.log). Merge confirmations use the large phone sheet so the checks, Review summary and final decision fit; long content remains scrollable. No new copy.
Physical-device checks still required
Real APNs on a locked iPhone; hidden previews; Face ID/passcode success and cancellation; submit before/after unlock; terminated-app delivery; offline and lost replies; grouping and mirrored Watch actions. Simulator and unit tests do not prove the unlock guarantee. Keep the production capability off until these pass. No deployment or release performed.
Cold launch (added with the held-input follow-up):
- From a terminated app, reply by text from the lock screen, then unlock. The app opens on the card with the reply pre-filled, and nothing is sent until Answer is tapped.
- Do the same with Try again on a stopped task. The sheet shows Try again, and the retry starts only after the tap.
- Repeat both behind a system prompt (permission alert, Face ID sheet) so the app is still
.inactivewhen the response is handled. - Check that
applicationStateandisProtectedDataAvailableread active and available by the time a confirmed tap is sent.
Captures and handoff validation
iPhone UI tests pass: 2 tests, 0 failures (iphone-ui-final.log). Both captures are in site/build/slice8/; the Merge capture shows facts, summary and the final Merge/Not now buttons. The first run hit XCTest's 128-character identifier limit; its assertion now uses NSPredicate. The existing booted iPhone 18 Pro was reused and the fixture app terminated. No simulator created or booted. Mac capture uses an in-app NSView snapshot with its sheet backing composited to an opaque image, without screen-capture permission.
The restored native run has 19 notification tests in 8 suites. Mac builds (mac-build.log). The no-credential-write guard, share packaging/copy guard and 336-key parity check pass. Full suites belong to Linux hub CI; its head and verdict are recorded in the handoff and archived CI JSON after push.
First CI follow-up
CI at 209cf741 passed the notification, card, contract and security tests, but failed four budget reasons longer than 200 bytes and the existing TestBrowserRosterVisual spacing assertion in all four appearances, including its retry. Budget reasons now retain the measured counts and a concise reason; go test -p 4 ./internal/testci -run '^TestBudgetRecordsAreShort$' -count=1 passes (budget-reasons.log). The browser assertion is unchanged, with computed spacing diagnostics added. Main a2619ce3 had green CI. No browser templates, CSS or scripts differ from main. The first local narrow browser invocation could not locate Chromium; the installed Playwright browser was then located, but load exceeded 20, so the next narrow run is left to hub CI.
Review fixes (Fable)
Taken over from the Codex implementer's uncommitted worktree. The roster spacing change moved to its own branch, fix/roster-visual-report-card (4836c9f2); this branch's roster_browser_test.go is back to main's, so the diagnostic log added at 18cd2fcb is gone too.
- Placement cards are open-only.
cardViewsetsplacement_questionon every placement question (options or by name; OpenAPI and API notes updated).notificationIntentreturns open-only whenPlacementis set. Native decodes the field and, after the bound card read, opens any placement question instead of writing.TestNotificationPlacementPushRuleIsOpenOnlycovers both states through the real card-event enqueue andcardView. - Try again eligibility. The intent is offered exactly when
retryReasonaccepts the failed, terminated newest step, and never for a Merge or Publish step. The bound write still goes throughpersonRetry. Enqueued through the real task push: Engineering and Checks failures are offered; Merge, non-owner, another step person and no runner are not. Failed Review and Publish steps raise no task alert (Review readsNeedsReviewBlocked;task_failsfires only onNeedsRetry, and progress ignores Publish), so their eligibility is read throughnotificationIntentdirectly: Review is offered, Publish is not. - 403 on registration. When a registration with actions is refused 403,
PushRegistrarre-reads/capabilitiesand, when actions are off, registers again without the action fields (once; no loop). - App-side guard. The dispatcher writes the journal and POSTs only while protected data is available and the app is active; otherwise it opens the card. The guard sits immediately before the journal save and before the POST, not at the start of the action: a
.foregroundresponse usually arrives while the app is still.inactive, and the card and capability reads are harmless. A restored journal entry skips the save, so the POST guard is tested separately. The inherited in-progress change was trimmed: a check in the 409 path dismissed by the card ID, not the notice, and theanswer()placement check was unreachable (run re-reads the card first).
Evidence: notification Go tests pass; ./internal/wire/... and plan3test -run 'Notification|Contract' pass; Linux build, vet and staticcheck v0.7.0 on chat and wire are clean. Native: 22 notification tests in 10 suites pass; iOS Simulator app build succeeds (UIKit branch).
Mutations, every one killed and restored:
| Guard | Killed by | |---|---| | intent skips Placement | PlacementPushRuleIsOpenOnly/options, /by-name | | cardView sets PlacementQuestion | PlacementPushRuleIsOpenOnly/options, /by-name | | intent consults retryReason | RetryPushRuleRefusals/member, /other-step-person, /no-runner | | intent refuses Merge | RetryPushRuleRefusals/merge | | intent refuses Publish | RetryPushRuleRefusals/publish | | native placement refusal after read | wrongBindingDisabledCapabilityAndStaleCardNeverWrite | | native decodes placement_question | wrongBindingDisabledCapabilityAndStaleCardNeverWrite | | foreground guard before journal save | lockedOrInactiveBeforeOrAfterReadNeverJournalsOrPosts | | foreground guard before POST | restoredReplyNeverResendsWhileLockedOrInactive | | guard requires protected data | both foreground tests | | guard requires active | both foreground tests | | registrar 403 fallback | forbiddenActionsRefreshCapabilitiesAndRegisterOpenOnly |
Not run: physical-device checks (above), browser tests (hub CI). The capability stays off by default.
CI at f49270cf failed two shards: TestBrowserRosterVisual (this branch then had main's test; fixed by merging main 6616af91) and the size budget (chat 35801/10650, wire 7448 lines; exemptions raised to the measured counts). Headless flakes in the same run passed on their retry.
Follow-up: held input (Fable P2)
Branch notify/actions-followup from main 10659d1f. When the unlock/active guard fails, the dispatcher no longer dismisses the notice or discards input. It holds the action in memory on its notice (held), bound to the card and revision it read:
- a typed reply is pre-filled in the card's existing answer field and is sent only by its existing Answer button;
- Try again shows the existing Try again button.
A redelivery of the same response never sends a held action. The person's tap wins over the alert's text, so an edited reply sends as edited. Nothing is journalled until the tap. The tests walk the journal directory and assert it holds no files. No new copy.
Tests: lockedOrInactiveBeforeOrAfterReadNeverJournalsOrPosts (held, pre-filled, redelivery-safe, edited reply sent once on tap) and coldLaunchTryAgainWaitsForTheTap (inactive and locked). The restored-reply test now also checks that the notice stays on screen. 23 notification tests in 10 suites pass.
Mutations, every one killed and restored:
| Mutation | Killed by | |---|---| | card not held | lockedOrInactive… | | reply not pre-filled | lockedOrInactive… | | Try again not offered | coldLaunchTryAgain… | | redelivery sends a held action | both cold-launch tests | | guard dismisses again | both, plus restoredReply… | | alert text beats the tap | lockedOrInactive… | | held not reset on tap | lockedOrInactive… | | guard before journal save removed | both cold-launch tests |
Review fix: retry sends what the screen shows (Fable P2)
Suppose a held reply was edited, then failed before it was journalled (the capability or card read was offline). Try again used to send the alert's original text. Now, while a card is shown and nothing is journalled, Try again goes through answer with the notice's current choice. A free-text card in the choices flow, after the same kind of failure, keeps its inputs enabled.
The inputs now lock on uncertain (a journalled request may have reached the server) instead of canRetry. A locked card takes no new answer; Try again resends the stored request exactly.
Hardening: run refuses a notice whose own binding is not the current selection, before any read or write.
Tests:
editedReplyThatFailsBeforeJournallingRetriesTheEdit: the edit is sent exactly once.choicesFlowFreeTextRetriesWhatTheScreenShows: inputs re-enabled; the re-typed text is sent once, then locks.aNoticeFromAnotherBindingNeverWrites: no card read, no POST, no file.
26 notification tests in 10 suites pass.
Mutations, every one killed and restored:
| Mutation | Killed by | |---|---| | retry ignores the shown choice | both retry tests | | uncertain never set | choicesFlow… | | uncertain on any failure | both retry tests | | answer takes a locked card | choicesFlow… | | run skips the notice binding | aNoticeFromAnotherBinding… |