Native Worker live admission
The native Mastermind Worker also readsGET /api/v1/mastermind/access on every
request that passes its Access JWT, app session, and owner allowlist checks.
It forwards only the verified Mastermind app-session bearer token to the fixed
web endpoint, with caching disabled, redirects refused and a five-second timeout.
The endpoint accepts the mastermind audience with internal-app:session scope
and resolves the principal’s root-workspace permissions afresh. Existing mobile
session access and the rollout rule below remain unchanged.
Revoking the active root permission denies the next Worker request without
changing its environment or waiting for its owner data memo to expire. An API
error, timeout, non-200 status or invalid response also denies access. The
endpoint must be deployed before adopting the Worker follow-up; an older endpoint
without the app-session opt-in denies the Worker. Regression coverage lives in
apps/mastermind/src/native/auth.test.ts and the emitted-Worker runtime smoke.
Offline preparation
The default-offoffline_read_mastermind flag registers the existing signed
snapshot flow with mobile offline preparation. Downloads verify that the
existing store can reopen the accepted snapshot; rejected exports, access loss,
and failed persistence do not count as ready. The section shows the stored
receipt time as Last synced while this flag is on. Flag-off reads retain their
existing behavior. Coverage: mastermind_offline_preparation_test.dart,
file_snapshot_store_test.dart, and the existing hub header/freshness suites.
Who sees it
- Scope: the Apps hub offers Mastermind when the active workspace is the
root workspace or the user’s personal workspace, Web’s
GET /api/v1/mastermind/accessanswersenabled: true(rootmanage_mastermindonce the rollout flag is on; see Access rule and Rollout), and the build has a hub source configured. Production, staging and any build withMASTERMIND_HUB_URLhave one; see Data source. The personal workspace shows the same fleet data; nothing in Mastermind is workspace-scoped. - Default: hidden. It is not an experimental module and cannot be enabled from Settings. A user the access answer denies, in any other workspace, or while access is loading or failed never sees the entry.
- Authority: this check is cosmetic. The server-side gates in Access rule decide, and a 403 from the hub hides the entry until the next access sync.
- Production beta: the production app reads the hub for the beta behind
these gates: root or personal workspace plus the access answer, a
configured source, and the hub’s owner allowlist. Replies stay off until the
hub’s
GET /v1/capabilitiesreportsreplies: true. Production reportsreplies: falsetoday, so the Inbox is read-only there and the reply composer stays hidden; turning replies on needs no store release. - Deep links and push taps: any
/mastermind/**location is held on a neutral skeleton while the access check runs, then redirected to the Apps hub unless access is loaded and enabled. A 403 keeps the user on the screen so it can explain itself; the entry disappears from the Apps hub. - Account changes: logout and account switch erase the cached snapshot, memory and disk, and re-check access for the selected workspace.
- Access errors: a failed access check hides the entry, so it is re-run when the app resumes and when the Apps hub is pulled to refresh; neither blinks a healthy entry while it checks.
Access rule
Mastermind is restricted to one person, the platform owner account, through the dedicated workspace permissionmanage_mastermind.
- Scope: every Tuturuuu-owned surface that serves Mastermind data or
actions: the mobile entry and its
/mastermind/**routes, andPOST /api/v1/mastermind/push-events. The mobile app reads snapshots and sends replies to the external hub Worker (mastermind-hub.tutur3u.com) directly; Tuturuuu serves no other Mastermind API. - Default: deny. Migrations
20261030113000_manage_mastermind_enumand20261030113001_manage_mastermind_grantsadd the permission with no grants; the owner grant is a separate, later change that needs an explicit GO (see Rollout). Unlike every other permission it is never implied by being the workspace creator, byadmin, or by a default permission, and it counts only as membership of the one root role the grant procedure created. Database triggers reject enabling it as a default permission, in any other workspace or on any other role, and enabling it or adding a member to that role from an API session (anon, authenticated, service role). Re-saving an unchanged role and disabling or deleting grants stay allowed. The web and mobile role editors omit it from their catalogs, and every role write from either client (create, update, default permissions) strips it, even for the workspace creator. CMS external-project team role creation, role updates and default-permission writes apply the same filter;team-access.test.tscovers enabled, disabled and explicit-only payloads. - Granting: for API sessions, only
private.grant_mastermind_access(user_id, reason), which the database owner alone may execute; a database-owner session is fully trusted and could also write the rows directly, without an audit row. The grantee must be a rootMEMBER(not a guest). On first use the procedure creates its own rootMastermindrole and records the id inprivate.mastermind_access_role; it never looks a role up by name, so renaming or creating anotherMastermindrole selects nothing. It refuses (raises) when the recorded role has a member other than the grantee or any permission row besidesmanage_mastermind, so at most one person holds it; revoke the current holder before granting another. API sessions cannot rename, re-date, move or delete the recorded role, add another permission to it, or add a member; the creator-grant guards still apply to it. It is idempotent and writes every call toprivate.mastermind_access_audit.private.revoke_mastermind_access(also database owner only) removes the user from the recorded role the same way. Running a grant in production is a production write that needs an explicit GO. - Enforcement points: the flag switches the Web, push and mobile
Mastermind gates. Database and Web-helper explicit-grant semantics always apply:
- Database:
public.has_workspace_permission(ws, user, 'manage_mastermind')is true only for an explicit root role grant. - Web helpers:
getPermissions().containsPermission('manage_mastermind')(packages/utils/src/workspace-helper.ts) ignores creator, admin and default permissions for explicit-grant permissions (packages/utils/src/explicit-grant-permissions.ts). - Push events: each recipient must be in
MASTERMIND_PUSH_OWNER_IDS(kept as defence in depth) and, with the flag on, hold rootmanage_mastermind; an unreadable answer skips the owner. - Hub: the external hub Worker enforces its own one-UUID owner allowlist on the requests the app sends it. That allowlist lives in the hub repository, is not changed here, and must name the same account.
- Mobile: the access cubit shows the entry only when
GET /api/v1/mastermind/accessanswersenabled: true; Web picks the rule, so a store build never decides it. Offline, the cubit reuses that user’s last server answer. This hides the entry only; it is not authorization.
- Database:
- Exceptions: none. Provisioning the recipient in the push allowlist and the hub allowlist is separate from the grant and must name the same user.
20261030113000 and 20261030113001 grant the permission to
nobody. Separate migration 20261030120000_grant_mastermind_owner.sql grants only root’s creator through private.grant_mastermind_access. Missing root, null creator, missing auth account or root MEMBER membership produces NOTICE without a grant. After seed, the database owner may idempotently run SELECT private.grant_mastermind_root_creator();. Production writes require explicit approval. Before the production sync, an operator checks read-only that the creator exists in auth.users and is a root MEMBER, reporting names only. Rollback 20261030120000_grant_mastermind_owner.rollback.sql uses audited revoke provenance, preserving later intentional operator grants. Missing provenance revokes nothing. Bootstrap coverage: manage-mastermind-owner-grant.sql; actual rollback coverage: apps/database/scripts/mastermind-owner-rollback-test.py.
- Regression coverage:
apps/database/supabase/tests/manage-mastermind-permission.sql(no role, default permission, member or creator holds it after the migration; creator and admin do not imply it; every guard; the audited, idempotent grant and revoke),apps/database/supabase/tests/manage-mastermind-role-binding.sql(root and outside-root pre-seeded, renamed, older or stagedMastermind-named role is never selected; the recorded role is root-owned, holds onlymanage_mastermindand cannot be edited outside the procedure; an extra member, extra permission row, second grantee or guest is refused),packages/utils/src/__tests__/workspace-helper-explicit-grants.test.ts,packages/utils/src/__tests__/permissions.test.tsx(absent from the web role catalog),roles/route.creator-grant.test.ts,roles/[roleId]/route.test.tsroles/form/permission-payload.test.tsandworkspace_role_permission_payload_test.dart(every role write strips it, even for the creator; neither catalog lists it),api/v1/mastermind/access/route.test.ts(flag off and on),route.delivery.test.ts(flag off keeps the allowlist-only rule; flag on skips an owner without the permission and a failed lookup),mastermind_access_cubit_test.dart(root and personal workspace follow the server answer) andmastermind_access_repository_test.dart(offline reuse of the same user’s last answer only).
manage_mastermind row removes
access immediately (fail closed); the recorded role itself cannot be deleted.
The migration rollback removes the role, its members and its record, so a
re-apply admits nobody. Restoring access requires the database owner to call
private.grant_mastermind_access(user_id, reason) again; ordinary role edits
cannot re-grant it. Role saves from web and mobile write permissions before the
name, so a rejected permission save leaves the name unchanged.
Rollout
Production applies migrations only after the deployment marker, so Web and a store build can be live beforemanage_mastermind exists there. Enforcement
therefore waits for a server-side switch that defaults to the earlier rule.
- Scope:
MASTERMIND_REQUIRE_EXPLICIT_GRANTon Web, read byapps/web/src/lib/mastermind/access.ts. It drivesGET /api/v1/mastermind/access(the mobile entry) and the push-events permission check. - Default: off (unset or anything but
true). The access answer is rootview_infrastructure(creator and admin imply it), and push events go to everyMASTERMIND_PUSH_OWNER_IDSowner without a permission lookup: the behaviour beforemanage_mastermind. On, the answer is rootmanage_mastermindand push recipients need it too. - Grant:
20261030113001grants nobody, so a local reset, CI pgTAP and staging apply unchanged and, with the flag off, nobody is locked out. The owner grant ships separately, after an explicit GO. - Exceptions: none. The hub Worker’s owner allowlist is separate and does not read the flag.
-
Merge and let the gated production migration workflow apply
20261030113000and20261030113001for the exact SHA. -
After the separately approved owner grant, read back exactly one holder, the
owner, with this read-only query as the database owner. Any other result
means do not flip; fix the cause and grant with
private.grant_mastermind_accessafter an explicit GO. This query is the only way to see who holds the permission: the web role editor never lists it, and no RPC or route returns holders.privateis revoked from anon, authenticated and service role, so run it only from a database-owner session (SQL editor orpsql);private.mastermind_access_auditrecords every grant and revoke with its reason. -
Set
MASTERMIND_REQUIRE_EXPLICIT_GRANT=trueon every runtime serving Web and redeploy. In new app builds, everyone else loses the entry on the next access sync. Older builds rely on the hub allowlist denial.
Data source
Fixture builds (development flavor withMASTERMIND_FIXTURE) read the bundled
synthetic sample. Staging reads <hub-staging-host>.tutur3u.com, production
reads mastermind-hub.tutur3u.com, and any build reads MASTERMIND_HUB_URL
when it is set; an explicit value always wins over the flavor host, and a bad
one never falls back to it. A build with neither (development without a
fixture, an unknown flavor) stays disconnected, as does any value that is not
a bare HTTPS origin: no credentials, path, query or fragment, so the bearer
token never leaves over cleartext or to a lookalike host. The app-level runtime owns
the source, the cache and the refresh scheduler and closes them with the app.
Each Mastermind screen only attaches to and detaches from the scheduler, so
refresh runs only while a screen is open and the app is in the foreground. It
also runs at once when the app returns from the background (hidden or
paused); a brief inactive blip such as Control Centre or a biometric prompt
is not a resume and fetches nothing. The scheduler follows device connectivity,
and the freshness line (Offline versus Couldn’t refresh) updates when
connectivity alone changes.
Tabs
Home, Inbox, Work, Ship and Insights share one mini-app shell: the top navbar shows the destination title and no Back button, and the floating dock owns Back. Every tab sits behind the same access gate and freshness strip. Work is planned to become Threads (Home · Inbox · Threads · Ship · Insights); until the hub serves threads it shows today’s lane list. In-screen views (Needs you | Decisions, Lanes | Backlog | Staff) use the compactMastermindSegmentedControl: a 32 pt track whose segments each own a 44 pt hit
area, instead of the tall pill. When the segments cannot fit across at the
current text size they stack into full-width 44 pt rows with a check on the
selected one; the control never becomes a hidden horizontal scroller and labels
are never truncated. List search uses MastermindCollapsibleSearch:
hidden until the navbar search icon is tapped, kept
open while a query is applied, folded away once cleared and unfocused. Every
sheet opens on the root navigator so the floating dock never covers it.
Freshness strip
Each tab starts with one short line inside the scroll view. Data age is informational because publishing is manual at first; only a failed refresh or a degraded source is a warning. The visible line carries an age or a short GMT+7 time (with the day once the data is 20 hours old); screen readers hear the full sentence with the absolute GMT+7 date and time.
Healthy, fresh data hides the strip on every tab but Home. A warning tints only
the glyph and a 3 pt leading bar; the text stays foreground so it keeps 4.5:1
contrast in light mode. The line ellipsizes at normal text sizes and wraps past
130%. It is a live region only while it is a warning. With degraded sources it
is a 44 dp row with a chevron that opens the “Sources” sheet: every source the
snapshot reports, degraded first, each as a glyph, a name and a state word.
Home also has a “Data sources” navbar action that opens the same sheet.
Before data arrives
A 401 can come from the Worker (audience or clock skew) rather than the
session, and signing out removes every saved account on the device, so it is
never the primary action and only runs after the user confirms.
Home (Today)
The Home tab is labelled Today. Order: freshness strip, Catch-up, activity tiles, Needs you, replies waiting to send, Ship, Quota, Activity and, last, recent decisions. Home lists are capped and end in “Show all N” only when they hold more than the cap; Inbox shows every ask (see below).- Activity tiles. Running, Waiting, Idle and Failed, four across (two by
two past 130% text), each at least 44 × 72 and opening Work filtered to that
state. Waiting shows “
<n>on you” when open decisions or actions wait on the owner. A muted footnote reads “<n>queued ·<n>not reporting” and opens Work on queued lanes. Failed > 0 tints its glyph destructive; “0 failed” keeps a neutral glyph. - Needs you. Up to three normal items (decision, then action, then FYI, then publisher order) with the count in the caption. The kind is a leading glyph, the title is the display title, and the product is the second line unless the title names it. Rows push the item detail, so Back returns Home.
- Ship. Failing environments first, then the three most recent releases;
a release with no age reads
—and sorts last. A basis shared by every row moves into the caption (“Ship · GitHub deployment”). - Quota. The three most urgent pools (the Insights order) with a sparkline;
a missing session budget or pacing reads
—. - Activity and recent decisions show three each; decision rows push their detail and “See all decisions” opens the Decisions segment.
Catch-up
Scope: Mastermind mobile, top of Today. It renders only when the snapshot carries acatchup object; no /v1/catchup route exists and the app calls
none. Everything is optional on the wire, unknown enum values are tolerated and
the parser never rejects the snapshot (catchup/catchup_parser.dart).
- Contract.
catchup { generated_at, window_start, coverage ok|partial|stale, products[{slug,name}], counts{needs_you,shipped,blocked, changed}, sections[{key, items[{id, kind, title (80), product|null, at, importance, link{label,url}|null, entity{kind,id}|null, neutral, reason?, owner_name?}]}] }, at most 20 items per section and 100 in all, enforced again by the parser. - Window. Default is since the last visit (rendered-time marker kept per
device in local preferences); the first visit shows 24 hours. A visit ends
after 30 minutes without a render, so tab switches keep the window. Items are
filtered by
aton the client. “Show N earlier” widens to 24 hours and draws a “New since your last visit” divider where the new rows end in each product group. Hubcountsare used while nothing is filtered out; otherwise the counts line is computed from the visible rows. - Sections and groups. Needs you, Shipped, Blocked, Changed, Usage & health, each grouped per product (hub name, else the slug) under collapsible headers whose state is remembered for the app session. Blocked rows show the reason and who is on it.
- Taps.
askopens/mastermind/inbox/item/:id,laneopens/mastermind/work/lane/:id,envandreleaseopen Ship,usageopens Usage. Otherwise the link opens in the system browser, only forhttpstuturuuu.comor*.tuturuuu.com; any other URL is dropped at parse time. A row with neither is not tappable. - Neutral items render “Security update” with no product, title or link; the parser keeps only their kind, time and importance.
- Times. Relative with the clock glyph (
now,12m,2h 13m,3d); long-press or a tap on the glyph shows the absolute time in Asia/Ho_Chi_Minh. - States. First run, quiet, “Some updates may be missing” for partial or stale coverage (or a hub window that starts after the view’s), offline or failed refresh from cache with the age line.
- Catch me up and pull-to-refresh refetch the snapshot (no LLM) with progress, an “up to date” confirmation and a failure message.
- Morning catch-up (Today navbar, Catch-up settings): a local toggle and
time. The push body is the fixed line “Your catch-up is ready” with no
content. There is no app quiet-hours setting yet; the server must apply
quiet hours (
MorningCatchupSyncis the seam). Server scheduling is not part of this change.
apps/mobile/test/features/mastermind/catchup/.
Inbox
The Inbox tab opens on one compact segmented control: Needs you · Resolved · Decisions. Needs you lists the open asks grouped by kind (“Decisions for you”, “Actions”, then “For your information”), each with its count, in publisher order. Resolved groups hub history by GMT+7 day; see resolved rows. Pull to refresh.- Rows are two lines: the friendly title (
itemDisplayTitle, so a redactedProduct · area · kindtitle uses the first ask line), then the kind badge with state and age for open asks, or answer attribution and time for resolved asks. A separate two-line preview retains the ask. No age is shown where the hub publishes none. Open asks expose one-tap option buttons on Home and Inbox; “More” and the full ask live on detail. The summary is one screen-reader node (“Decision. Review plan. Review the plan”, hint “Opens the ask”). - Every ask: lazy loading and paging.
- Search is hidden until the navbar search icon of the list reveals it (“Search asks”); it covers every ask segment, including the resolved answer. Product chips (one row, 44 pt targets) appear only while two or more products are present.
- Empty and no-match states say why: “Nothing needs you” (Mastermind lists an ask here when a lane needs your answer), “Nothing resolved recently” (asks appear once Mastermind records an answer), and “No matching items” with a “Clear search and filters” row.
- Security rows keep the Home rule: one non-tappable line in a trailing “Security” group with no count, never counted, searched or filtered, with no severity, id or detail. Resolved does not show them.
- Detail:
/mastermind/inbox/item/:itemIdopens one ask in full, pushed from the Inbox and from Home, so Back returns to whichever opened it, with the same search text and product chips (the shell pops an item location instead of falling back to the Inbox). The navbar title is the kind (“Decision”), so the title is not repeated; the page leads with the display title as a heading and shows the fullask_textwith tappable links, never clamped. When the hub published only its “Open on Mac” stand-in, an info alert reads “Full details are on the Mac” instead. The id is looked up among the open asks, then the resolved history, and is only ever a route parameter; deep links carry tab roots only and never ids. A resolved ask shows an “Outcome” panel with answer attribution and GMT+7 time, or withdrawn status, and no composer. An id in neither list shows “This item is no longer in Mastermind” (or “This was answered or withdrawn” when it left while open) with a way back, never an error. A changedversion_hashshows “This question was updated”. - The “Reply on Mac” option is a placeholder the publisher adds when an item has nothing to pick. It is never offered as a choice and the app never sends it.
Decisions
The segment lives in the URL: Needs you is the bare/mastermind/inbox, and
Resolved and Decisions are ?segment=resolved|decisions; old all maps to Needs you (an unknown
value is Needs you).
Switching is a go, never a push, so Back does not walk the segments. Home
links straight to the Decisions segment.
The Decisions segment lists the journal (decisions[]) newest first, grouped by
GMT+7 calendar day (a decision at 17:30 UTC belongs to the next GMT+7 day), each
day with a count. A row shows the title, the GMT+7 time, category, risk as the
words “Risk: low / medium / high” plus a signal glyph, and the product. Chips
filter by product and by reversible / not reversible; a chip only exists while it
can split the journal, and a filter whose chip left the data is dropped. The
filters survive opening a decision and coming back. When decisions_skipped is
above zero the list ends with “N older decisions aren’t included in this
snapshot.” An empty journal says “No decisions recorded yet.”
/mastermind/inbox/decision/:decisionId opens one decision in full: why (“No
reason recorded” when absent), decided by (Mastermind, You, or “Role: <slug>”
with the slug verbatim), reversible (“Can be reversed” / “Not reversible”),
risk, category, area, product and the absolute GMT+7 time. It is pushed from the
Decisions list and from Home, and the shell pops it on Back like an item or
lane. The id is an opaque snapshot id and a route parameter only. An id the
snapshot no longer holds shows “This decision is no longer in Mastermind” with a
way back to the Decisions segment; a decision whose fields changed while open
shows “This decision was updated”. The journal is history: there is no reply
control. Security decisions do not exist in schema 1.4 and are never rendered;
the Needs-you “Security” group never appears on this segment.
Replies
Replies are gated at runtime byGET /v1/capabilities (replies, with schema
1.4), checked when an Inbox screen opens and at most every five minutes.
Where replies are off, or the hub cannot be asked, the detail shows the options
read-only and “Reply on your Mac”; there is no composer. The Worker owns the
switch, so it flips without a store release.
-
Gate in code: submit, retry and flush all refuse to send unless the hub
says replies are on, not only the composer’s visibility. Entries queued while
replies are off stay queued: neither sent nor dropped, until capabilities say
replies: trueagain. Coming back online re-asks the hub before flushing. -
Known answer kept offline: a known “supported” answer survives a failed
re-check. Going offline never flips it, so the outbox keeps working with no
connection; only an answer from the hub turns replies off:
replies: falsefrom the capabilities check, or a 403replies_disabledon a send (any other 403 is a lost-access refusal, handled like a 403 on the snapshot). - One check at a time: overlapping capability checks, forced or not, share a single request, and a reply sent during the first-ever check waits for its answer instead of being refused. Connectivity changes are de-duplicated, so several interfaces flipping together cause one re-check and flush.
-
Contract:
POST /v1/replieswith exactly{schema_version: "1.4", item_id, version_hash, option_index | text}: one of an option index (into the item’s ownoptions[]) or free text of at most 500 characters, counted in code points, and at most 10 lines (the hub’s limit; the composer caps both as you type). An option sends its index after a five-second undo window (see Undo window below). The text field has a placeholder and a counter; free-text sending requires confirmation. -
Idempotency: the
Idempotency-Keyis a random v4 UUID from a secure generator, made once per reply and stored in the outbox before the first send. Every retry reuses it, so an unknown outcome never becomes a second reply. A 200 replay is treated exactly like 201. One reply per question version. - Offline outbox: a reply that cannot be delivered (offline, timeout, 5xx) stays queued on the device, per user, in the snapshot cache directory, and is sent again when an Inbox screen opens, when the app resumes and when the device comes back online. It can be retried or discarded. Entries expire after seven days and are dropped when a live snapshot no longer has the item open. Queued replies live in the OS cache directory, not the documents directory: that keeps them out of device backups, at the cost that the OS may purge the cache under storage pressure and silently lose a queued reply. We accept that trade-off, because a reply is short-lived and a lost one is re-asked; a reply already accepted by the hub is unaffected. Logout, account switch and lost access erase the outbox with the snapshot cache, behind the same generation fences, so an in-flight send cannot revive it.
-
409
stale_item: refreshes the item; see the answered elsewhere rules. Options always use the current question version.idempotency_conflictdrops the queued entry with “Something went wrong with this reply. Review it and send it again.” -
Other answers: 400 (
unsafe_textexplains the text policy) and 413 keep the words to edit; 429 waits outRetry-Afterand disables the retry until then; 403replies_disabledhides the composer and 403forbiddenis lost access. - 401: the reply stays queued. The first failure offers “Try again”; only after a repeat does “Sign out and sign in again” appear, and it asks first, because signing out removes every saved account on the device.
-
Waiting rows: the Inbox shows “N replies waiting to send” while replies
are queued; with exactly one, the row opens that item. A queued reply binds to
its item id and
version_hash, so a reply to an older version of a question is never shown as the answer to the current one. A 429 counts down on its own and re-enables “Try again” whenRetry-Afterhas passed. - Search: it never matches the “Reply on Mac” placeholder option.
- Accessibility: the reply status line is a live region, and the character counter has a spoken label (“12 of 500 characters used”).
Work
The Work tab has three segments, a segmented control under the freshness strip: Lanes (the default), Backlog and Staff. Lanes lists lanes grouped by state, the one that needs attention first: failed, waiting, running, queued, idle, stale, completed, cancelled, then the rare open, answered, withdrawn and unknown. Each group shows its count and is ordered oldest first, a lane with no age last. A row shows the title, role and provider/model (display text, shown verbatim), “Running for 2 h” (or “Running · age unknown”), “About 20 min left” only when there is an estimate, and product, area and kind chips. State is always a glyph and a word.- Filters: a search field (“Search lanes”), one chip per state, and product and area chips while two or more of each are present. A state chip’s count follows the product, area and search filters, so it always matches its group header. A product or area filter resets when its value leaves the snapshot, because its chip would be gone.
- Segment and filters in the URL: the segment lives in the location as
?segment=backlogor?segment=staff(Lanes is the bare tab, and an unknown value reads as Lanes), beside the lane filters?state=,?product=and?area=. Every segment or chip change rewrites the location withgo, so Back never walks through segments. The lane filters stay in the URL on the other segments, so switching back to Lanes finds them. The Home lane chips open/mastermind/work?state=<state>. An unknown value is ignored and “All” clears the state. A lane opens by push, so Back from it (the dock included) pops to the same filtered list, search text and all; the shell pops a lane location instead of falling back to the bare tab root. External deep links open the tab root and never carry a segment, filter or lane id. - A filter that leaves the snapshot leaves the URL too: when a product or area filter resets because its value is gone, the location is rewritten without it once the frame is built, so a later visit to that location does not bring a stale filter back. Filters that are still valid stay.
- No matches: a filter combination with no lanes (including a state with none) shows “No matching lanes” with a “Clear filters” row that resets state, product, area and search.
- Backlog:
backlog[]grouped by product (the item count in each group’s header), open before answered before withdrawn, in the publisher’s order within a state. An item with no product sits last under “No product”. Each row is a title and a state glyph and word; it has no tap target, and its opaque id is never shown. The search field (“Search backlog”) matches the title and product and is local to the segment. An empty backlog reads “Backlog is clear” and hides the search; no match reads “No matching backlog items”. - Staff:
observability.staff[], which is{role, title, state, model}and nothing else. Rows sort by the Lanes state priority and then by role, case-insensitively, never by activity. A row shows the title, the role and model (display text; the literalunknownreads “Unknown model”) and a state glyph and word. A summary caption reads “11 roles · 4 running”. Staff has no search, filters or sort control. Privacy rule: the screen never shows or derives a last-active time, a runs-today count, an “active today” label or any activity ordering; the hub does not publish them, and a change that adds one must be reviewed as a privacy change. An empty list reads “No staff roles reported.” - Security rows keep the Home rule on Lanes and Backlog: one non-tappable line in a trailing “Security” group with no count, never counted, searched or filtered. Staff has none, because the hub omits security roles.
- Detail:
/mastermind/work/lane/:laneIdshows the same fields in full and has no action. The id is an opaque snapshot id and only ever a route parameter. An id that is not in the snapshot shows “This lane is no longer in Mastermind” (or “This lane finished or was removed” when it left while open) with a way back, never an error. A lane whose state changed while open shows “This lane was updated”.
Ship
/mastermind/ship is read-only. It lists, under the freshness strip:
- Environments by product. A product with a failing environment (deploy or
CI
failureorerror) comes first, then the rest by most recent release, then by name. Each product is one compact card. Its header row carries the name, “Live 2 h ago” with the age basis (left out when the age is null, never “Unknown” or 0) and, when failing, a destructive glyph and a “Failing” badge. Production comes before staging. An environment row shows deploy and CI as a glyph and a word, and its ownfreshnessas a chip only when it is not fresh (it never follows the snapshot’s age). Then come the version and the commit id (monospace, with a 44-pt copy button; it is a public commit id), and one muted line with the subject, “Released 2 h ago” and “Checked 30 min ago” measured from the snapshot time. The absolute GMT+7 release and check times and the evidence label are in the row’s semantics label. A reading the hub did not publish is left out, while one it could not read keeps its reason, for example “Deploy Not connected · Last checked 19:22”. The publisher’s stand-in subject for a commit it will not send is shown as the localized label “Withheld, open on Mac”, muted with an info glyph and the tooltip “Details stay on the Mac”. A failing environment on Home opens Ship on its product, and its row carries a chevron like the release rows. - Not tracked yet. A product with no release age whose every environment has
deploy, CI, freshness and evidence
unknownand no release time, version or commit id gets no card. All such products share one final “Not tracked yet” row that names them (“Product A, Product B”). Tapping it lists each with the hub’s reason (“Not connected · Last checked 19:22”) or “No deployments observed”. The row is hidden while a product filter is on, and these products get no filter pill. - CI now.
observability.ci[], queued and running per repository. A null count reads “Unavailable”, never 0. - Release cadence. Most recent production release first; a product with none reads “No production release observed” and sits last. The caption carries the row count, and the list shows five rows with “Show all N” for the rest.
- Pull requests and merges. From
observability.delivery: the latest open pull request count and merge-to-live median per product, and “At least N production releases observed” (a lower bound). A null count reads “Unavailable”; a delivery source with no coverage says so once and shows no numbers. Nothing on this tab opens a pull request, merges or syncs anything. The schema carries no separate sync record, so production sync is only visible as the release age and cadence above. - Product filter in the URL. One horizontally scrolling pill bar (All, then
the tracked products in list order, failing ones marked with a warning glyph)
appears while two or more tracked products are present. It never wraps and
writes
?product=<product>withgo. A product the snapshot lacks is shown unfiltered at once and removed from the URL after the frame, but only while Ship is the top route: a rewrite is ago, so one that fired under an open route would drop it. External deep links open the tab root.
Insights
/mastermind/insights is the Usage view (the Fleet, Models, Coordination and
Delivery sections arrive later and reuse the table route below).
- Pools come from
observability.usage.instances[], most urgent first: SHORT, then unknown pacing, then OK, then SURPLUS, then the least session budget left, then label. A pool’s pacing is the worse of its session and weekly windows, so a weekly SHORT outranks a session that is fine. Pool labels are opaque display strings, shown verbatim and never summed or stacked. - Pool card. One pacing verdict per pool, as a shape and a word: “Running short”, “On pace”, “Surplus”, or “No pacing data” (a static hollow square, not the dashed outline that read as a spinner). The verdict is the worse of the windows that report pacing, so a window without pacing does not hide the other’s. Under it, one muted line gives the burn and the signed projection at reset for the window the verdict comes from. An info button opens the “Reserve pacing (chart rule)” note saying it is not the routing decision. Then “Session left” and “Weekly left” each show a meter toned by that window’s pacing, the percent and the reset (“Resets 17:10”, with the day when it differs from the reading’s). A window the hub did not read shows a dash and its reason (“Not connected · Last checked 19:22”), never 0.
- Contradiction guard. Scope: the pool card’s burn line. Default: when the
verdict window is SHORT and its burn is 0 pp/h or less, the line reads “Burn
not measured yet” instead of “0 pp/h”, because a pool that burns nothing
cannot run short and the hub reading is partial. Exceptions: a zero burn on an
OK or SURPLUS window is shown as measured. Coverage:
presentation/ship_usage_model_test.dart(“a zero burn next to SHORT”) andmastermind_insights_compact_test.dart. - Charts use the shared chart kit: one panel per pool (session solid,
weekly dashed, a fixed 0 to 100 percent axis, a reset marker when it falls in
range), and for each Codex pool in
usage.credits[]a balance panel and a burn-against-target panel. “Credits” is a unit of its own, never money or tokens; a null daily target reads “Target unavailable”. Each panel’s header holds its title and the Table action (a ghost button with an icon and a 44-pt target), so the action is never at the bottom of the card under the floating dock. A muted caption says what the plot leaves out (“Partial data: Weekly window not reported.”, the gaps and their reasons). The plot’s semantics label is the full text summary. The legend names only series with at least one reading, and a live readout follows. X-axis ticks show the GMT+7 time alone (“20:30”), adding the day (“Oct 28 05:45”) only where the day changes and never on a chart within one day. Withusage.coverageofmissingorunavailablethe plot is left out and the summary and coverage note stand in. Withpartialorstale, the caption and summary lead with the coverage word. A pool with no series shows the summary only. - Quota table (
products.quotas[], includingUnknown account), least left first and unknown last, with “as of N min ago” (left out when the read age is null). Forecasts (quota_forecasts[]): “Projected empty<time>GMT+7” soonest first, or “Not projected to run out before reset”. Both captions carry the row count and show five rows with “Show all N” for the rest. - Chart table route.
/mastermind/insights/:section/table/:chartIdis pushed over Insights and shows the same series rows the panel draws (a null cell reads “Unavailable”). The section isusageand the chart id isbudget:<pool>,credits:<pool>orburn:<pool>; both are route parameters only. A chart the snapshot no longer has shows “This chart is no longer in Mastermind” with a way back, never an error. The shell pops this location on Back instead of falling back to the tab root.
Product decisions
-
True activity counts. Scope: Home tiles now; the lane list header and a
Threads badge read the same
MastermindActivitymodel. Default: running, waiting and idle come from the hub’swork.countsonly when its status isokandchecked_atis within 15 minutes of the snapshot; stale/down readings fall back to the latestobservability.fleet.seriespoint when coverage is ok or partial and it is at most 15 minutes older thangenerated_at, else from lane states, captioned “From lane reports”. Queued and failed always come from lanes; unknown or stale lanes are a “not reporting” footnote, never a headline. “On you” counts open decisions and actions, never FYI. Coverage:presentation/activity_model_test.dart,view/mastermind_home_v1_test.dart. -
Friendly names. Scope: every row and detail title. Default: the hub’s
[Name] Roletitle shows verbatim; a redactedProduct · area · kindtitle is never shown: a lane uses its standing role, or “<Product><area>” for a child lane; an item uses its real title or first ask line. Models shorten to “Sonnet 5.5” or “GPT-6.1 sol”; an unknown model reads “Model not reported”. Coverage:presentation/display_names_test.dart. -
No bare unknown. Scope: Home now, Ship and Insights next. Default: a
missing, blank or “unknown” reading renders a muted
—(ReportedText) announced as “Not reported” plus the hub’s reason; the word “unknown” never stands alone. Coverage:view/mastermind_home_v1_test.dart,view/forge_v1_fixture_test.dart. -
Resolved is the hub’s word. Scope: Inbox rows, the item detail, the
Resolved segment. Default: an ask reads “Resolved” only once the hub
lists it in
decisions_resolved; a reply this device sent reads “Sent · waiting for Mastermind” (with its GMT+7 queued time on the detail) until then, never Resolved. Exceptions: an ask that leaves the snapshot without a history row reads “This was answered or withdrawn”. Coverage:view/mastermind_inbox_v1_test.dart(“a sent reply reads Sent · waiting until the hub resolves”, “a resolved ask shows the hub outcome”). -
Decisions journal. Scope: the Inbox Decisions segment, the decision
detail and Home’s recent-decisions card. Default: the Inbox segmented control
ends with Decisions, its segment in the URL; Home rows open the
detail and “See all decisions” opens the segment. Exceptions: the journal is
history and is not answerable; search and risk/area filters are not offered
yet. Coverage:
mastermind_decisions_test.dart,mastermind_decision_page_test.dart, the “Back from a decision” cases inshell_peer_section_checks.dart. -
Offline reply queuing. Scope: replies from the item detail, on every app
surface that shows the “N replies waiting to send” row (Home and Inbox).
Default: a reply that cannot be delivered stays queued on the device and is
sent later instead of being refused. This is safe because each queued reply is
bound to its item id and
version_hash, and carries oneIdempotency-Keyreused on every retry: if the question changed meanwhile the hub answers 409stale_item, the item is refreshed, the typed words are kept and the user reviews it again, so a stale answer is never accepted as the answer to a newer question. Exceptions: replies off at the hub keep entries queued without sending, an entry expires after seven days or when the item leaves the open list, and logout, account switch and lost access erase the outbox. Coverage:mastermind_replies_cubit_test.dart,mastermind_replies_gate_test.dart,reply_outbox_store_test.dart.
Vietnamese state wording
One Vietnamese word per state: “queued” is “trong hàng đợi”, “pending” is “chờ xử lý” and “waiting” stays “đang chờ”, across lane, deploy and CI labels. One term per destination: the Home “Usage” link and the Insights page caption are both “Mức sử dụng”, and the Insights tab and its label are both “Phân tích”. Whole-section state titles carry no trailing period; their messages do.Push notifications
The web routePOST /api/v1/mastermind/push-events (see the
API reference) receives
signed hub events and sends a mobile push to Mastermind owners.
- Scope:
needs_you.new,decision.awaitingandpin_batch.newonly. Recipients are the owners inMASTERMIND_PUSH_OWNER_IDSwho hold rootmanage_mastermind(once the rollout flag is on), with a registered device and the account push preference on. - Copy: always “Open Mastermind” (vi “Mở Mastermind”) under the title “Mastermind”. The event carries no title, product or text, so no item content, including security items, can reach a lock screen.
- Tap:
openTarget: mastermindwith the tab root (/mastermind/inbox, or/mastermindfor pins), held by the same access gate as any deep link. The app navigates only whenrouteexactly matches one of those two roots; any other or missing route opens the notifications screen, and a route from the payload is never followed otherwise. An item id is never in the push. - Rate: at most one push per type per owner per minute; a burst inside the window is dropped, not queued, because the next snapshot shows it.
- Retries: successful owners are skipped for 24 hours per event, including partial retries after the coalescing window. Token-owned claims prevent stale requests from releasing newer claims. Fan-out stops after 60 seconds and returns 502 for unreached owners. Observed FCM success gets a bounded, best-effort receipt write before the deadline is honoured; receipt failure warns and still counts as sent. A retry inside a pending coalescing window remains failed and retryable until the outcome is confirmed or the window expires, rather than completing the event. Unstored receipts can allow duplicates after the window expires if another owner failed. These rules apply to the web push endpoint; mobile tap behavior is unchanged.
- Default: off until Release Desk provisions
MASTERMIND_PUSH_HMAC_SECRETandMASTERMIND_PUSH_OWNER_IDS; without the secret the route sends nothing. - Regression coverage:
apps/web/src/app/api/v1/mastermind/push-events/route.test.ts,apps/web/src/app/api/v1/mastermind/push-events/route.race.test.ts,route.delivery.test.tsand, for the tap,apps/mobile/test/features/notifications/push/mastermind_push_destination_test.dart.
App-switcher privacy
On every/mastermind/** route (Home, For you, Decided, Journal, item and
decision detail, Work, Ship, Insights) the app covers its own content with a
blur under a mostly opaque surface tint while it is not in the foreground
(SB-100 L2). The cover is built on inactive, hidden and paused, so the
OS-captured switcher thumbnail never holds hub text, and it does not depend on
whether a screen has cards. Screenshots are deliberately not blocked: Mastermind
is owner-only. The cover is a Flutter overlay, so a system sheet that only
pauses the app (Control Centre, a biometric prompt) briefly covers it too.
- Deferred (SB-100 gate): the neutral “A decision is waiting on your Mac”
card (S2, T7) and local “Later” notifications with a local quiet window
(L1/Q5, T8) wait for the hub’s
displayfield and S1 classification; the app has no snooze notifications today. - Regression coverage:
apps/mobile/test/features/mastermind/privacy/mastermind_privacy_shield_test.dartand, for the constant security label,apps/mobile/test/features/mastermind/view/mastermind_home_page_test.dart; for the single row per list,apps/mobile/test/features/mastermind/presentation/security_rows_test.dart.
Deferred to PR8
- Activity cursor (spec 2.10). Home shows the latest three events from
now.digestas display only. The “new since you last looked” cursor and the full Activity feed arrive with PR8.
- separate session and weekly small multiples instead of one shared panel;
- a signed projection axis;
- a pp/h axis for burn;
- diverging credit bars for
burn_vs_target; - a light and dark golden image for the chart panels.
Regression coverage
apps/mobile/test/features/mastermind/view:
mastermind_entry_test.dart: entry gating, route gate, mini-app shell, runtime reset, the flavor host (production, staging, unknown).mastermind_section_test.dart: access gate, scheduler lifetime, resume refresh gated on a real background (including a section mounted while the app is backgrounded), connectivity-driven freshness strip, whole-section states, the sign-out confirmation.mastermind_access_resync_test.dart: access recovery on resume and Apps hub pull-to-refresh.runtime/mastermind_auth_reset_test.dart: the app-level logout and account-switch listener over a realAuthCubit.mastermind_decisions_test.dart: journal order and GMT+7 day grouping, product and reversible chips, the segment in the URL (no Back walk), Home links, redaction.mastermind_decision_page_test.dart: decision fields, the gone and updated states, no reply controls.mastermind_freshness_test.dart: short line and full spoken sentence, hidden-when-healthy off Home, glyph-only tint, the live region, the sheet.mastermind_sources_sheet_test.dartandmastermind_sources_root_overlay_test.dart: the Home action opens the sheet, degraded first, on the root navigator above the dock.mastermind_home_page_test.dart,home_model_test.dartandmastermind_home_v1_test.dart: order, tiles and links, caps, names,—, security redaction, last-row dock clearance at 1.0 and 2.0 text.widgets/mastermind_segmented_control_test.dart(44 pt targets, semantics) andwidgets/collapsible_search_test.dart(icon, refresh isolation, fold-away).mastermind_work_page_test.dart: grouping, the state, product and area filters and their URL, chip counts following the filters, Clear filters, Back from a lane keeping the Home chip filter, security redaction, whole-section states, dock clearance, deep links to the tab root.mastermind_work_segments_test.dart: the segment control and its URL, the Backlog grouping, search, empty and security rows, the Staff sort, summary, privacy rule (no activity text, no sort or filter control) and unknown model, dock clearance on every segment.mastermind_work_filter_url_test.dart: a product or area filter that leaves the snapshot is removed from the URL too, and valid filters are kept.mastermind_lane_page_test.dart(detail, gone, updated) andwork_model_test.dart.mastermind_ship_page_test.dart: failure-first grouping, production before staging, withheld subject, per-environment freshness independent of the snapshot, “Unavailable” instead of 0, cadence order, pull requests and merges, redaction, whole-section states, the product filter in the URL, dock clearance.mastermind_insights_page_test.dart: pool urgency order, one verdict per pool, the reserve note behind its info button, unread windows as a dash, GMT+7 resets, credits copy, quota and forecasts, coverage handling, the chart table route (same series, gone chart, Back), whole-section states, dock clearance.mastermind_insights_compact_test.dart: the burn guard, the static no-pacing shape, the Table action above the plot with a 44-pt target, the legend of drawn series, the plot’s summary label, the quota cap and the Forge v1 fixture (a reason per window, no bare “unknown”).mastermind_ship_compact_test.dart: the “Not tracked yet” row (collapse, order, expansion), the filter bar (tracked products only, failing marked, one row), the cadence cap and the Forge v1 fixture (every product untracked, reasons on expand).mastermind_home_links_test.dart: Home Ship rows and the Usage link open the real tabs.presentation/ship_usage_model_test.dart: the Ship and Usage models and chart ids.apps/mobile/test/features/mastermind/access/mastermind_access_cubit_test.dart: the root workspace, server answer and configured-source matrix (the entry followsGET /api/v1/mastermind/access), the personal workspace, creator andadminnever implyingmanage_mastermind, workspace ABA and error fail-closed.mastermind_access_repository_test.dart: the server answer, a malformed answer, signed out, and offline reuse of the same user’s last answer only.apps/mobile/test/features/mastermind/data/hub_http_snapshot_source_test.dart: base URL by flavor and override (production, staging, development, a bad override never falling back) and the bare-HTTPS-origin rules: non-HTTPS, credentials, path, query, fragment, and lookalike shapes such as the hub host hidden behind userinfo or a fragment are refused.apps/mobile/test/features/shell/view/shell_back_navigation_test.dart: system Back from a lane over a filtered Work location returns to that location with its query (it fails without the shell’s lane-pop rule). System and dock Back from a chart table, pushed over Insights over Work, pop back to the same Insights (one state created, Work still beneath it); both fail without the shell’s chart-table pop rule, because the mini-app parent fallback’sgorebuilds Insights and flattens the stack.mastermind_ship_url_test.dart: a product filter with no chip shows the whole list and rewrites the URL once, and not while another route is on top.
/mastermind/** route
through the production router.
apps/mobile/test/features/mastermind/replies covers the reply path:
reply_models_test.dart (key format, exact body, strict stored form, limits),
reply_outbox_store_test.dart (per-user persistence, corruption, clear),
hub_reply_transport_test.dart (headers, every status, the 401 retry with the
same key), mastermind_replies_cubit_test.dart (capability gate, persist before
send, idempotent retry, 409/400/401/403/413/429, logout fencing, snapshot sync),
mastermind_replies_gate_test.dart (nothing is sent while replies are off,
including a reconnect flush; a logout racing a refused or stale reply; entries
bound to item id and version), mastermind_capability_load_test.dart (one
shared capability request, a send waiting on the first check) and
mastermind_runtime_replies_test.dart (logout, switch and lost access clear
the outbox). runtime/mastermind_runtime_online_test.dart covers the
connectivity stream (reaches the scheduler, de-duplicated, cancelled on close).
The screens are in view/mastermind_inbox_page_test.dart,
view/mastermind_inbox_v1_test.dart (the Forge v1 fixture: Needs you /
Resolved, navbar search, caps, row semantics, the full ask,
the Open on Mac alert, resolved history, Sent then Resolved, 44 pt targets and
last-row dock clearance at 1.0 and 2.0 text),
view/mastermind_item_page_test.dart and
view/reply_line_limit_formatter_test.dart (the 10-line cap and its refusals).
Decision and usage metadata
Mobile accepts legacy scalar fields alongside Forge v1 field envelopes. Missing values display “Not published yet”; connection and source failures retain their explicit status. An accepted reply remains sent until a live snapshot closes its stable item ID. Resolved items leave Needs you and can appear in Recently resolved. Full asks useask_text (up to 2000 characters); an absent full ask is stated on
the detail page. No mobile action can infer that the hub processed a reply.
Usage charts annotate timestamp gaps with published reasons (source failure,
account switch or quota reset). Without metadata they say “No samples published”.
A reset timestamp within an inferred gap supplies the reset reason. Pools remain
separate. Adapter and classification regressions live in
apps/mobile/test/features/mastermind/presentation/hub_contract_test.dart.
Optional resolved history is parsed row by row: invalid entries are skipped,
repeated IDs use their latest resolved entry, and the last 20 valid entries are
shown. Additive lane and staff metadata does not invalidate the snapshot; known
fields still receive strict validation. Native open items may supply status
without the legacy state. Checked field timestamps and spoken chart gap bounds
use the same GMT+7 wall time as the rest of Mastermind.
Pages consume the shell’s published bottom clearance through AppPageScrollView.
The Sources sheet opens on the root navigator, above the floating dock, so the
system safe area pads its end and no dock estimate is needed.
Forge v1 publishes field health beside the legacy arrays: ship[] supplies
deploy, ci, and released_at; work.lanes[] supplies age/ETA observations;
insights[].weekly supplies weekly budget and pacing observations. Mobile adapts
these companion paths and can show their reasons even when legacy environment
and usage-instance lists are empty. work.counts supplies Home’s top-level
running, waiting, and idle counts. Unknown root keys, asks_source, and
decisions_unknown are safe to ignore. The exact redacted publisher fixture is
covered by test/features/mastermind/view/forge_v1_fixture_test.dart; it verifies
all five tabs, open asks, resolved history, source reasons, gaps, and counts.
Optional companions are validated field by field. Ship observations apply only to
production; null companions retain a published legacy value. Unknown enums,
invalid numeric values and unparseable timestamps retain the legacy value with
not_published status and an “Unrecognised value” reason. ISO timestamps with
Z or an explicit offset normalize to UTC. These rules apply to Ship, weekly
Insights and Work age/ETA fields. A malformed lane or unknown decision status
is skipped without hiding the remaining snapshot. Decisions marked resolved in
decisions[] also populate Recently resolved. Home keeps a queued chip when
work.counts is published, deriving queued from lanes when absent.
Regression coverage: test/features/mastermind/presentation/companion_hardening_test.dart.
An unreported pacing value retains its dashed status glyph beside the explicit
reason. The label wraps within the row’s content area so checked timestamps do
not overflow narrow screens. mastermind_insights_page_test.dart preserves the
one-glyph-per-window assertion for reported and unreported values.
Truncated asks carry a visible Mac continuation notice. Recorded answers remain
available regardless of length, with an expandable preview. Failed replies say
“Not sent · tap to retry” while the reply is still queued and a retry can go
out (offline); tapping retries the existing reply and opens its recovery
details. A 429, a 401/403 (behind the auth-failure guard) or a dropped reply
reads “Couldn’t send · open to review” and a tap only opens the details. Grouped open rows omit the repeated kind badge. Coverage:
mastermind_inbox_v1_test.dart (truncation, long answers, failed sends).
Ask cards on Home and Inbox share the same row. The A2 short title wins when
present; otherwise the publisher title wins;
a redacted title falls back to the first ask line. Cards preview two lines,
project, status and created-at age; detail keeps the full published ask. Only
unique open ids appear in Needs you; a hub-answered id always wins. Home’s
See-all link opens Needs you. A redacted title is the first ask line, so the
preview starts on the second line; screen readers hear at most 200 characters
of the ask on a row. The recorded answer shows “Show full answer” whenever it
overflows four lines at the current width and text size.
Undo window (decided 2026-10-28). A Home or Inbox option is one tap; the item detail selects, then sends from the sticky Send (decision detail). Either shows
“Sending “option” · Undo” for 5 seconds; the reply enters the outbox only then, through the same
submit and Idempotency-Key. One window per item; the other options lock
meanwhile. Leaving the screen inside the window still sends; logout or an
account switch cancels it, and so does a live snapshot where the ask changed or
left. Coverage: mastermind_replies_undo_test.dart, mastermind_option_undo_test.dart.
See answered elsewhere and withdrawn for cross-device answers, batch labels, undo cancellation and resolved rows.
Read-only Threads preview
MASTERMIND_THREADS is a Dart define, default false. With it off, Work, Ship
and Insights retain their existing navigation. When enabled, Threads replaces
Work in the dock; Backlog and Staff remain segments, and Ship and Insights stay
separate. The flag is read through mastermindThreadsEnabled, which tests can
override with debugOverrideMastermindThreads, so the default flutter test run
covers both the flag-off and flag-on paths without a --dart-define.
P1a is Work’s own page with a Threads segment control: it reads the same
accepted snapshot as Home and Work through the shared snapshot cubit and the
tolerant v1 parser, and never parses the hub payload on its own. The grouped
lane list, search, state, product and area filters, “Clear filters”, Backlog and
Staff are Work’s own components, so a Work or Home link keeps ?state=,
?product= and ?area= when it redirects to /mastermind/threads. The one
difference is the group and chip order: Waiting, Failed, Running (queued
follows), then Idle, each oldest first. The segment switch uses the compact
32 pt track with 44 pt hit areas. A row opens the existing lane detail under
/mastermind/work/lane/:id; the dock keeps Threads selected while it is open,
and a missing lane offers “Back to Threads”. There is no send UI and no row
opens history. Loading, access loss, rate limits (the last snapshot stays) and a
404 with nothing published use the shared Mastermind section states.
Thread history is a separate P1b change, built to the design’s mobile conditions
(app lock, screenshot protection, closed parsers, localized state words and
times). It is not part of P1a and has no flag here.
Regression coverage lives in apps/mobile/test/features/mastermind/threads/:
threads_list_test.dart covers the group order, filters, “Clear filters”,
Backlog/Staff segments, 44 pt targets, dock clearance, rate-limit retention and
the 404 state with the flag on; threads_flag_test.dart keeps the flag-off
navigation unchanged and checks the flag-on dock selection, redirects with
filters kept, and the lane-gone copy. Enablement remains held for exact-commit
mobile CI and product acceptance.
Inline decision cards
Scope: open asks on mobile Home and Inbox. Schema 1.4 remains the wire version; the existing adapter accepts optional A2hub_title, hub_text,
hub_options, hub_recommended, and by. Short title/text take precedence
on cards; absent, null or empty copy falls back to the canonical title/body.
The publisher’s text and recommended aliases normalize to body and
recommended_option. Open asks still come from now.needs_you and the
item-identity rows in decisions[]; the journal is a separate history model.
Short option labels must preserve the canonical option order and count.
A mismatched list falls back to canonical labels; mobile always sends the
original option_index, item ID and version hash. Recommendation is marked
with localized text as well as a badge. Product and publisher chips wrap;
age appears only when created_at is published.
A tap optimistically replaces choices with the existing five-second
Sending/Undo window, then the existing version-bound, idempotent reply outbox
and POST /v1/replies transport. Undo restores choices without a send.
Acceptance remains “Sent · waiting for Mastermind”; only the hub may resolve
the ask. Offline, rejected and stale replies retain existing recovery behavior.
When capabilities do not permit replies, choices are disabled with the existing
capability explanation. No new endpoint or inferred backend capability is added.
Full detail continues to show canonical ask text and choices.
Regression coverage: view/decision_cards_test.dart (English/Vietnamese,
320px, text scale 2.0, short-copy fallback, recommendation, canonical indices,
Undo and delayed send) plus the existing reply cubit and Inbox/Home suites.
Unreadable quota pools
On mobile Insights, a null pool percentage displays “Out of service / unreadable” in the quota table, percentage chart summaries, and session/weekly rows. Null quota rows sort before numeric readings so they remain visible in the initial five rows. Missing chart series retain their window-not-reported description. Numeric readings, including a measured zero, retain their existing meaning. Regression coverage lives inmastermind_insights_compact_test.dart and
ship_usage_model_test.dart; snapshot parsing preserves null quota rows.
Iris in the Inbox (M0)
The owner’s inbox is a first-class part of the mobile Inbox, behind a flag. Synthetic data only in fixtures and tests.- Flag:
mastermindIrisEnabledis on when theMASTERMIND_IRISDart define is set (dev, staging and tests) or when the hub’sGET /v1/capabilitiesreturns"iris": true(TestFlight and Play internal). The capabilities parser accepts that optional last key; a Worker without it, or a failed check, keeps Iris off.irissays only that the relay is on, never anything about enrolment. Tests usedebugOverrideMastermindIris. - Inbox segments: with Iris on, Chat is the first and default segment
(
/mastermind/inbox); Needs you is then written as?segment=needs-you, and?segment=chatdeep-links Chat. With Iris off nothing changes. If the hub turns Iris off while Chat is open, the Inbox falls back to Needs you. - Chat feed:
GET /v1/iris/feedreturns thethreads-1page and message shape (oldest first, opaqueitem-thread ref andm-message refs, plusnext_afteron a forward?after=poll;beforeandaftertogether is refused). The list is reversed so it opens at the newest message, newest last, and holds its place. Rows reuse the #7182 plain-text renderer: bidi and invisible characters stripped, redactions as neutral placeholders, and a withheld row (withheld: true, empty text) reads “Hidden message”. The feed polls every 15 s with backoff, holds at most 500 rows in memory, is dropped when the app leaves the foreground, and resets to the latest page on a 404 cursor. Author labels are display-only provenance: nothing owner-only (answers, enrolment, un-kill) is granted by who a message says wrote it. - Composer: published into the shell’s floating dock like Assistant, so
there is no second dock or inner bar and the dock keeps its Back while idle.
Text only in M0; voice is the OS keyboard’s dictation.
POST /v1/iris/sendsends exactly{"target":"atlas","text":…}(1 to 16,000 characters) with a lowercase-UUIDIdempotency-Key. Receipts fromGET /v1/iris/send/<id>only move forward: received reads “Sending”, delivered viaqueuereads “Queued”, any other delivery reads “Sent”, acked reads “Seen”. Three failed attempts show “Not sent” with Retry, which reuses the same key. - Kill switch: a 423
killed(or a 503iris_killedfrom an older Worker) keeps the chat readable, shows a banner and turns sending off. - Signing: every relay request carries the owner JWT plus
X-Iris-Device,X-Iris-Ts,X-Iris-NonceandX-Iris-Sigfrom an injected signer over method, path with query, sha256(body), timestamp, nonce, device id and the Idempotency-Key. Until the native device-key lane lands, a fake signer stands in; a real relay refuses it. Platform difference: iOS can drop the biometric read session early (lock), but on Androidlockis a no-op and the Keystore’s 300 s auth window stays open after any strong biometric. Writes stay disabled; a write-only second key (M1 gate) closes the gap. Seeiris/device/SECURITY.md. - Devices and enrolment:
/mastermind/iris/devices(Chat’s navbar action) lists enrolled devices with their status, QA mark and key prefix, and revokes with a second tap on the same button, never a native dialog. Enrol shows the 6-digit code and the key fingerprint prefix and says to confirm on the Iris enrol page with a passkey; the app then polls the device from pending to confirmed, or expired after 15 minutes. No typed T3 command or chat message confirms a device. Builds without a device key cannot enrol. - Ask cards: asks keep the hub snapshot and
POST /v1/replies; the relay never answers them. Inbox rows and detail share urgency badges (“Urgent”, “High priority”, each with a glyph) and deadline labels beside the age. A What needs me header (Needs you, Chat and the Home card) counts open asks once each as urgent, soon (high), FYI or other; in Chat it also shows the relay’s role status and usage line. Use recommendations opens a confirm sheet listing each open ask with a recommended option, then queues one held reply per ask, each with its own Idempotency-Key and the existing durable undo on its card, and reports each result. The recommended option is a filled button beside its “Recommended” badge. - Fixture mode: the development flavor with
MASTERMIND_FIXTURE=trueservesassets/dev/mastermind/iris_fixture.json(12 synthetic asks across urgent, soon and FYI, with and without options, one expired; 40 messages) throughFixtureIrisRelay, with offline, 429, kill and slow-ack toggles. - Not in M0: attachments, secure input, push deep links to Chat, typed-code approvals and the native device key. The summary and devices response shapes are provisional until the relay fixes them.
apps/mobile/test/features/mastermind/iris/
(data/http_iris_relay_test.dart for routes, shapes, signed headers and
401/403/423/429 handling; data/fixture_iris_relay_test.dart for the fixture
and its faults; cubit/iris_cubits_test.dart; view/iris_chat_view_test.dart
for the feed, composer, receipts, retry, kill banner and dark mode;
iris_integration_test.dart for the flag, capabilities, Chat segment and
enrolment) and view/what_needs_me_test.dart for badges, counts and the
recommendations sheet.