neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
Log in to mark this repository.
Android app: triage issues (resolve, ignore, assign)
7ad8440 · gmorell · 2026-12-03 18:16
Message
{commit_body(@commit)}
Files changed
modified
README.md
+11
−7
| 37 | 37 | - **Organizations**: teams, roles and invites; membership can come from |
| 38 | 38 | OIDC or LDAP groups (NEIAM). There are API tokens and a Sentry-shaped |
| 39 | 39 | `/api/0` for project, key and issue management. |
| 40 | −- **Android app**: a read-only client for issues, events and monitors, | |
| 41 | − paired by scanning a QR from the API tokens page. | |
| 40 | +- **Android app**: issues, events and monitors, with triage (resolve, | |
| 41 | + ignore, assign; swipes and bulk), paired by scanning a QR from the API | |
| 42 | + tokens page. | |
| 42 | 43 | |
| 43 | 44 | ROADMAP.md is the design document: the wire contract, the architecture, |
| 44 | 45 | and what each slice built, as built. |
| 104 | 105 | |
| 105 | 106 | ### The Android app |
| 106 | 107 | |
| 107 | −`android/` is a read-only phone client: issues across an organization or | |
| 108 | −a project, each one's latest event and stack trace, and the cron and | |
| 109 | −uptime monitors. To pair a phone, tick **Mobile app** when making a token | |
| 110 | −under **Settings → API tokens** and scan the QR that appears; revoking the | |
| 111 | −token signs the phone out. CI publishes signed builds to the forge's | |
| 108 | +`android/` is a phone client: issues across an organization or a | |
| 109 | +project, each one's latest event and stack trace, and the cron and uptime | |
| 110 | +monitors; issues can be resolved, ignored and assigned there (swipe, or | |
| 111 | +long-press for several). To pair a phone, tick **Mobile app** when making | |
| 112 | +a token under **Settings → API tokens** (and **Read-only** for a phone | |
| 113 | +that only looks) and scan the QR that appears; revoking the token signs | |
| 114 | +the phone out. Phones paired before triage have a read-only token: pair | |
| 115 | +them again with a new one. CI publishes signed builds to the forge's | |
| 112 | 116 | F-Droid repository. See android/README.md. |
| 113 | 117 | |
| 114 | 118 | ## Deploy |
modified
ROADMAP.md
+4
−0
| 532 | 532 | - Settings → API tokens has a **Mobile app** box that ticks the read bundle (`org:read project:read team:read member:read event:read`, `Vigil.ApiTokens.mobile_scopes/0`). A new token covering it is shown with a `vigil://pair?base=…&token=…` QR (EQRCode, as gitgud) and link. The app verifies against `GET /api/0/` before storing, and names any missing scope. A paired phone is its token: revoking it signs the phone out. |
| 533 | 533 | - New in `/api/0`, Sentry-shaped: `GET /organizations/{o}/issues/` (every visible project's issues, or `?project=`, with the issue search and Link cursors); `GET /projects/{o}/{p}/issues/{id}/` (group details: releases and a tag summary); `GET /projects/{o}/{p}/issues/{id}/events/latest/` (Sentry's event with `entries`: exception, message, breadcrumbs, request; frames with `context`, never `vars`). Issue lists now carry `userCount`, from the `user` tag. |
| 534 | 534 | - The app: org picker (skipped with one), issues (search, status, project, paging, pull to refresh), an issue with its latest event, cron and uptime monitors. `test/vigil_web/api/android_fixtures_test.exs` writes the responses the app's contract test decodes. |
| 535 | + - **Triage (as built):** | |
| 536 | + - The **Mobile app** bundle now adds `event:write` (`mobile_scopes/0`); a **Read-only** sub-option leaves it out (`mobile_read_scopes/0`, the old bundle). `mobile?/1` checks the read bundle, so tokens made before still pair; `mobile_triage?/1` adds `event:write`, and the token list badges which. | |
| 537 | + - The bulk `PUT /projects/{o}/{p}/issues/` takes Sentry's `assignedTo` (`"user:<id>"`, a bare id, an email/username, or `""`/`null` for nobody; teams refused) beside or instead of `status`, and `statusDetails: {"inNextRelease": true}` with `resolved`. It replies with what changed (`assignedTo` as the issue's actor); bad input is a 400 in Sentry's field-error shape. `GET /organizations/{o}/members/` (`member:read`) lists the assignable, in Sentry's member shape. Ignore durations and counts aren't supported (Vigil's ignore is for good), and delete stays web-only (`project:admin`). | |
| 538 | + - The app reads its scopes from `GET /api/0/` at pairing and each start; with `event:write`, the issue screen resolves (now or in the next release), ignores, reopens and assigns (me, a member, nobody), and the list swipes (resolve / ignore) and long-presses into multi-select for bulk changes, one PUT per project. Every change offers Undo (each issue's former status or assignee, grouped); rows that no longer match the filter leave. Without it the issue screen says to pair a new token. | |
| 535 | 539 | |
| 536 | 540 | --- |
| 537 | 541 |
modified
android/DESCRIPTION.md
+2
−2
| 1 | 1 | Your Vigil errors, cron monitors and uptime checks, on your phone. |
| 2 | 2 | |
| 3 | −The read-only phone companion to Vigil, the self-hosted error tracker that speaks Sentry's protocol. See what is breaking across your organization or in one project: each issue's level, how often it happens and to how many users, its tags, and its latest event with the exception and stack trace (your own frames first, with the source around them), breadcrumbs and the request. Check which cron monitors are failing or late, and which uptime monitors are down. | |
| 3 | +The phone companion to Vigil, the self-hosted error tracker that speaks Sentry's protocol. See what is breaking across your organization or in one project: each issue's level, how often it happens and to how many users, its tags, and its latest event with the exception and stack trace (your own frames first, with the source around them), breadcrumbs and the request. Triage as you go: swipe to resolve or ignore, long-press to select several, assign to yourself or a teammate, and undo any of it. Check which cron monitors are failing or late, and which uptime monitors are down. | |
| 4 | 4 | |
| 5 | −Pair by scanning the code on Vigil's Settings → API tokens page, after ticking "Mobile app". Revoke the token there and the phone is signed out. | |
| 5 | +Pair by scanning the code on Vigil's Settings → API tokens page, after ticking "Mobile app" (and "Read-only" for a phone that should only look). Revoke the token there and the phone is signed out. |
modified
android/README.md
+34
−15
| 1 | 1 | # Vigil Android client |
| 2 | 2 | |
| 3 | −A read-only phone companion for [Vigil](../): what's breaking across an | |
| 3 | +A phone companion for [Vigil](../): what's breaking across an | |
| 4 | 4 | organization, each issue's latest event with its stack trace, and which |
| 5 | −cron and uptime monitors are failing. It talks to the same Sentry-shaped | |
| 5 | +cron and uptime monitors are failing; and triage: resolve, ignore and | |
| 6 | +assign issues from the list or the issue. It talks to the same Sentry-shaped | |
| 6 | 7 | `/api/0` that sentry-cli uses, with an API token scanned from the web. |
| 7 | 8 | |
| 8 | 9 | Sister app to `../../gitgud/android`, `../../bigtrippr/android` and the rest |
| 15 | 16 | |---|---| |
| 16 | 17 | | **Pairing** | Scan the QR from Settings → API tokens, open its `vigil://pair` link on the phone, or type the server and token. Verified before anything is stored | |
| 17 | 18 | | **Organizations** | Picked once and remembered; skipped when you're in only one. Switch from the menu | |
| 18 | −| **Issues** | Across the organization or one project; Unresolved (the default), Ignored, Resolved or All; the web's search syntax (`level:error`, `release:1.2`, `browser:Firefox`, free text). Level, title, culprit, events, users, last seen and project per row. Pages load as you scroll (Sentry's Link-header cursors); pull to refresh | | |
| 19 | −| **Issue** | Counts, first and last seen, releases, assignee; the latest event's exception chain and stack, newest call first, in-app frames outlined with their source lines and library frames folded; breadcrumbs, the request, the event's tags, user and runtime; a tag summary. **Open in browser** goes to the web page, where it can be triaged | | |
| 19 | +| **Issues** | Across the organization or one project; Unresolved (the default), Ignored, Resolved or All; the web's search syntax (`level:error`, `release:1.2`, `assigned:me`, `browser:Firefox`, free text). Level, title, culprit, events, users, status, assignee, last seen and project per row. Pages load as you scroll (Sentry's Link-header cursors); pull to refresh | | |
| 20 | +| **Triage in the list** | Swipe right to resolve, left to ignore (from Resolved: right reopens; from Ignored: right resolves, left reopens), with **Undo** in the snackbar. Long-press to select, tap to add more, then resolve, ignore, assign, resolve in next release or unresolve them all: one request per project. A row that no longer matches the filter leaves the list | | |
| 21 | +| **Issue** | Status and assignee; counts, first and last seen, releases; the latest event's exception chain and stack, newest call first, in-app frames outlined with their source lines and library frames folded; breadcrumbs, the request, the event's tags, user and runtime; a tag summary. **Open in browser** goes to the web page | | |
| 22 | +| **Triage on an issue** | Resolve, Resolve in next release, Ignore, Unresolve (whichever make sense from its status), and Assign: to you, a member, or nobody. Each with **Undo**; a refusal shows the server's reason | | |
| 20 | 23 | | **Monitors** | Cron monitors (health, schedule, last check-in, next due) and uptime monitors (up or down, why, response time, certificate expiry), failing ones first | |
| 21 | 24 | |
| 22 | −Nothing in the app changes anything on the server: the token it asks for | |
| 23 | −is read-only. | |
| 25 | +The only changes the app makes are an issue's status and assignee, through | |
| 26 | +Sentry's bulk `PUT …/issues/?id=…`, which needs `event:write`. A token made | |
| 27 | +with **Read-only** ticked (or before the app could triage) has no | |
| 28 | +`event:write`: the app then shows no triage controls, and the issue screen | |
| 29 | +says that a new token, paired again, brings them. The app asks the server | |
| 30 | +for its scopes at every start (**Check again** asks at once), but a | |
| 31 | +token's scopes never change, so re-pairing is the way. | |
| 32 | + | |
| 33 | +Not here, on purpose: **delete** (it needs `project:admin`, which the | |
| 34 | +mobile bundle doesn't carry, so a lost phone can't delete), comments, | |
| 35 | +sharing, and ignoring "for a while" or "until N more events" (the server's | |
| 36 | +ignore, like the web's, is for good). | |
| 24 | 37 | |
| 25 | 38 | The summary and description F-Droid shows come from |
| 26 | 39 | [`DESCRIPTION.md`](DESCRIPTION.md): the summary on the first line (80 |
| 44 | 57 | ## Pairing |
| 45 | 58 | |
| 46 | 59 | 1. Signed in on the web: **Settings → API tokens**. Tick **Mobile app**, |
| 47 | − which ticks the read-only bundle the app needs (`org:read`, | |
| 48 | − `project:read`, `team:read`, `member:read`, `event:read`), give the | |
| 49 | − token a label and create it. | |
| 60 | + which ticks the bundle the app uses (`org:read`, `project:read`, | |
| 61 | + `team:read`, `member:read`, `event:read`, and `event:write` for | |
| 62 | + triage), give the token a label and create it. Tick **Read-only** under | |
| 63 | + it to leave out `event:write`: the phone can look but not touch. | |
| 50 | 64 | 2. A QR appears beside the token, encoding |
| 51 | 65 | `vigil://pair?base=<server>&token=<token>`, with the same link under it. |
| 52 | 66 | 3. In the app, **Scan code** and point it at the QR. Or open the link on |
| 53 | 67 | the phone, or enter the server and token by hand. |
| 54 | 68 | 4. The app calls `GET /api/0/` and keeps the pair only once the server |
| 55 | − names the token's owner. If the token lacks part of the bundle it says | |
| 56 | − which scopes, and pairing anyway is your choice. | |
| 69 | + names the token's owner. If the token lacks part of the read bundle it | |
| 70 | + says which scopes, and pairing anyway is your choice. A token without | |
| 71 | + `event:write` pairs without a word, read-only. | |
| 57 | 72 | |
| 58 | 73 | A paired phone *is* its token: there is no separate device list. Revoke |
| 59 | 74 | the token on the tokens page and the app notices on its next request and |
| 130 | 145 | | `GET /projects/{org}/{project}/issues/{id}/events/latest/` | `event:read` | Sentry's event shape (`entries`) | |
| 131 | 146 | | `GET /organizations/{org}/monitors/` | `project:read` | cron monitors, with Vigil's `health` | |
| 132 | 147 | | `GET /organizations/{org}/uptime/` | `project:read` | Vigil's own | |
| 148 | +| `GET /organizations/{org}/members/` | `member:read` | Sentry's member shape; who to assign to | | |
| 149 | +| `PUT /projects/{org}/{project}/issues/?id=…&id=…` | `event:write` | Sentry's bulk mutate: `{"status": …}` and/or `{"assignedTo": "user:<id>" \| ""}`; one per project | | |
| 133 | 150 | |
| 134 | 151 | An issue's `id` is its short id within the project (`SHOP-12` is `12`), as |
| 135 | 152 | in the web's issue URLs. |
| 196 | 213 | TokenStore.kt # (server, token), encrypted; https upgrade |
| 197 | 214 | PrefsStore.kt # theme and organization |
| 198 | 215 | VigilClient.kt # Retrofit interface, error messages |
| 199 | − Models.kt # JSON shapes; the mobile scope bundle | |
| 216 | + Models.kt # JSON shapes; the mobile scope bundle; Account | |
| 217 | + Triage.kt # status actions, undo plans, filter matching | |
| 200 | 218 | auth/ |
| 201 | 219 | PairScreen.kt # scan | link | by hand, verified, scope check |
| 202 | 220 | ui/ |
| 203 | 221 | OrgPickerScreen.kt |
| 204 | 222 | HomeScreen.kt # Issues | Monitors tabs; menu: org, theme, unpair |
| 205 | − IssuesTab.kt # search, filters, paged list | |
| 206 | − IssueScreen.kt # details, latest event, tags | |
| 223 | + IssuesTab.kt # search, filters, paged list; swipes, multi-select | |
| 224 | + IssueScreen.kt # details, triage, latest event, tags | |
| 225 | + Triage.kt # runs a triage with Undo; assign dialog | |
| 207 | 226 | MonitorsTab.kt # cron and uptime |
| 208 | 227 | Loading.kt # load / refresh / error states |
| 209 | 228 | Common.kt # app bar title, pills, sections, times |
| 210 | 229 | ThemePicker.kt |
| 211 | 230 | theme/ # the web's themes, status colours and B612 |
| 212 | 231 | app/src/test/ |
| 213 | − …/LinksTest.kt, ContractTest.kt, CommonTest.kt | |
| 232 | + …/LinksTest.kt, ContractTest.kt, TriageTest.kt, CommonTest.kt | |
| 214 | 233 | resources/api/*.json # real API responses the contract test decodes |
| 215 | 234 | ``` |
| 216 | 235 |
modified
android/app/src/main/java/org/neiam/vigil/app/MainActivity.kt
+29
−0
| 13 | 13 | import androidx.compose.runtime.Composable |
| 14 | 14 | import androidx.compose.runtime.LaunchedEffect |
| 15 | 15 | import androidx.compose.runtime.getValue |
| 16 | +import androidx.compose.runtime.mutableIntStateOf | |
| 16 | 17 | import androidx.compose.runtime.mutableStateOf |
| 17 | 18 | import androidx.compose.runtime.remember |
| 18 | 19 | import androidx.compose.runtime.setValue |
| 24 | 25 | import androidx.navigation.compose.rememberNavController |
| 25 | 26 | import androidx.navigation.navArgument |
| 26 | 27 | import org.neiam.vigil.app.auth.PairScreen |
| 28 | +import org.neiam.vigil.app.data.Account | |
| 27 | 29 | import org.neiam.vigil.app.data.PairLink |
| 28 | 30 | import org.neiam.vigil.app.data.PrefsStore |
| 29 | 31 | import org.neiam.vigil.app.data.TokenStore |
| 35 | 37 | import org.neiam.vigil.app.ui.theme.AppTheme |
| 36 | 38 | import org.neiam.vigil.app.ui.theme.VigilTheme |
| 37 | 39 | import org.neiam.vigil.app.ui.theme.appThemeForKey |
| 40 | +import retrofit2.HttpException | |
| 38 | 41 | |
| 39 | 42 | /** |
| 40 | 43 | * The one activity. Routes: pair, orgs?auto=, home/{org}, |
| 103 | 106 | val nav = rememberNavController() |
| 104 | 107 | var credentials by remember { mutableStateOf(tokens.load()) } |
| 105 | 108 | val api = remember(credentials) { credentials?.let(VigilClient::authenticated) } |
| 109 | + // Who we are and what the token may do: as stored at pairing, then | |
| 110 | + // asked again at each start (and on request), so triage shows up | |
| 111 | + // without re-pairing when the token allows it. | |
| 112 | + var account by remember { mutableStateOf(tokens.loadAccount()) } | |
| 113 | + var accountCheck by remember { mutableIntStateOf(0) } | |
| 106 | 114 | val start = remember { |
| 107 | 115 | when { |
| 108 | 116 | credentials == null -> "pair" |
| 128 | 136 | // A 401 means the token was revoked (or expired): this phone is signed out. |
| 129 | 137 | fun unauthorized() = unpair() |
| 130 | 138 | |
| 139 | + LaunchedEffect(api, accountCheck) { | |
| 140 | + val signedIn = api ?: return@LaunchedEffect | |
| 141 | + try { | |
| 142 | + val root = signedIn.root() | |
| 143 | + if (root.user != null) { | |
| 144 | + account = Account.of(root).also(tokens::saveAccount) | |
| 145 | + } | |
| 146 | + } catch (e: HttpException) { | |
| 147 | + if (e.code() == 401) unauthorized() | |
| 148 | + } catch (e: kotlinx.coroutines.CancellationException) { | |
| 149 | + throw e | |
| 150 | + } catch (_: Exception) { | |
| 151 | + // Offline: keep what we had. | |
| 152 | + } | |
| 153 | + } | |
| 154 | + | |
| 131 | 155 | LaunchedEffect(pairLink) { |
| 132 | 156 | if (pairLink == null) return@LaunchedEffect |
| 133 | 157 | pendingPair = pairLink |
| 144 | 168 | pendingPair = null |
| 145 | 169 | prefs.orgSlug = null |
| 146 | 170 | credentials = tokens.load() |
| 171 | + account = tokens.loadAccount() | |
| 147 | 172 | nav.navigate("orgs?auto=true") { popUpTo(0) } |
| 148 | 173 | }, |
| 149 | 174 | ) |
| 172 | 197 | HomeScreen( |
| 173 | 198 | api = signedIn, |
| 174 | 199 | org = org, |
| 200 | + account = account, | |
| 201 | + onCheckAccount = { accountCheck++ }, | |
| 175 | 202 | theme = theme, |
| 176 | 203 | themeKey = themeKey, |
| 177 | 204 | onPickTheme = onPickTheme, |
| 199 | 226 | org = args?.getString("org").orEmpty(), |
| 200 | 227 | project = args?.getString("project").orEmpty(), |
| 201 | 228 | id = args?.getString("id").orEmpty(), |
| 229 | + account = account, | |
| 230 | + onCheckAccount = { accountCheck++ }, | |
| 202 | 231 | onBack = { nav.popBackStack() }, |
| 203 | 232 | onUnauthorized = ::unauthorized, |
| 204 | 233 | ) |
modified
android/app/src/main/java/org/neiam/vigil/app/auth/PairScreen.kt
+19
−8
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/data/Models.kt
+77
−4
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/data/TokenStore.kt
+21
−1
Click to load diff…
added
android/app/src/main/java/org/neiam/vigil/app/data/Triage.kt
+115
−0
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/data/VigilClient.kt
+64
−9
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/ui/HomeScreen.kt
+9
−1
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/ui/IssueScreen.kt
+146
−6
Click to load diff…
modified
android/app/src/main/java/org/neiam/vigil/app/ui/IssuesTab.kt
+339
−48
Click to load diff…
added
android/app/src/main/java/org/neiam/vigil/app/ui/Triage.kt
+283
−0
Click to load diff…
modified
android/app/src/test/java/org/neiam/vigil/app/data/ContractTest.kt
+31
−0
Click to load diff…
added
android/app/src/test/java/org/neiam/vigil/app/data/TriageTest.kt
+129
−0
Click to load diff…
modified
android/app/src/test/resources/api/event.json
+5
−5
Click to load diff…
modified
android/app/src/test/resources/api/issue.json
+10
−5
Click to load diff…
added
android/app/src/test/resources/api/issue_update.json
+10
−0
Click to load diff…
modified
android/app/src/test/resources/api/issues.json
+10
−5
Click to load diff…
modified
android/app/src/test/resources/api/issues_link.txt
+1
−1
Click to load diff…
added
android/app/src/test/resources/api/members.json
+19
−0
Click to load diff…
modified
android/app/src/test/resources/api/monitors.json
+5
−5
Click to load diff…
modified
android/app/src/test/resources/api/organizations.json
+2
−2
Click to load diff…
modified
android/app/src/test/resources/api/projects.json
+4
−4
Click to load diff…
modified
android/app/src/test/resources/api/root.json
+9
−8
Click to load diff…
modified
android/app/src/test/resources/api/uptime.json
+2
−2
Click to load diff…
modified
lib/vigil/api_tokens.ex
+24
−7
Click to load diff…
modified
lib/vigil_web/api/v0/issue_controller.ex
+85
−20
Click to load diff…
modified
lib/vigil_web/api/v0/organization_controller.ex
+13
−1
Click to load diff…
modified
lib/vigil_web/api/v0/project_json.ex
+31
−2
Click to load diff…
modified
lib/vigil_web/live/api_token_live.ex
+40
−10
Click to load diff…
modified
lib/vigil_web/router.ex
+4
−2
Click to load diff…
modified
test/vigil_web/api/android_fixtures_test.exs
+14
−1
Click to load diff…
modified
test/vigil_web/api/mobile_api_test.exs
+169
−1
Click to load diff…
modified
test/vigil_web/live/api_token_live_test.exs
+53
−1
Click to load diff…
Parents: 6a2ac0f