Skip to content

feat: a needs-attention summary on the Overview - #336

Merged
2 commits merged into
mainfrom
feat/needs-attention-card
Nov 13, 2026
Merged

2 commits merged into
mainfrom
feat/needs-attention-card

Conversation

@nofuturekid

Copy link
Copy Markdown
Collaborator

What changed

A "Needs attention" card at the top of the Overview lists what needs the user's attention, most urgent first. One row per item, coloured with the existing Warn / Danger / Info tones and also labelled in words (Critical / Warning / Info), so it does not rely on colour alone. Tapping a row opens the Array tab, or the notifications sheet for notification rows. The card is hidden when the list is empty and while the server is offline (an Error on the info, array, docker or VMs stream, the same rule as the top bar's Offline pill).

What it flags:

  • Array not started (warning), degraded (critical), or rebuilding while the API reports no parity operation (warning).
  • A parity operation: running (info), paused (warning), last check failed (critical), last check completed with errors (critical).
  • Disks with numErrors above zero (critical), one row per disk.
  • Disks at or above their critical (critical) or warning (warning) temperature, using the per-disk threshold, else the global display threshold.
  • Unread alert (critical) and warning (warning) notifications, as counts.

Architecture

The rules are one pure function in the data layer, attentionItems(AttentionSnapshot): List<AttentionItem> in data/model/Attention.kt, with no Compose or Android dependency, so background alerts (#321) and a widget (#322) can reuse it. Each AttentionItem has a severity, a title, a detail, a target (Array or Notifications) and a stable key that names the condition and not the moment: progress, error counts and temperatures stay out of the key, while warm to critical is deliberately a new key.

Only data the app already loads is used: the array stream, the notifications stream and the display thresholds. No new polling and no new query.

Decisions

  • Unknown is not a problem. An array that is not loaded, a spun-down disk (isSpinning is the truth source), a missing threshold, ArrayState.Offline (the mapper's "unknown") and an unreported parity error count raise nothing.
  • Temperature needs a threshold the server reported (per disk or global, each coalesced independently, values of 0 ignored). The Array tab also falls back to fixed 42/50 degrees; this card does not, because a guessed limit would raise alerts the server never configured. This differs from the Array tab only when the server reports no threshold at all.
  • Notifications are a sheet, not a tab, so the target is AttentionTarget.Notifications; the Overview opens the sheet.
  • A cancelled parity check never raises an item.
  • Small mapper extension: ArrayInfo.parityLastRun (outcome and the error count if the API gives one), filled from array.parityCheckStatus, which the existing GetArray query already asks for. ParityCheck and the existing parity mapping are unchanged. Neither queries.graphql nor UnraidRepository.kt is touched.

Deliberately left out

  • Containers that are not running but have auto-start on. The flag stays set when a user stops a container on purpose and one-shot containers exit by design, so the loaded data cannot tell "should be running" from "was stopped". When in doubt it stays out.
  • A parity error count as a source of truth: the API does not fill errors today, so "completed with errors" can only appear once a server reports it; a FAILED status is flagged now.
  • Notifications outside the app, a widget, background alerts, version bump, .github/.

Checks

  • ./scripts/local-ci.sh: passed (generateApolloSources, lintDirectDebug, assembleDirectDebug, assembleRelease, testDirectDebugUnitTest).
  • New AttentionItemsTest (32 tests: each rule raised and not raised on unknown data, stable keys, ordering, healthy server empty) and four new mapper tests in ArrayMappingTest; 0 failures, 0 skipped.
  • Not checked on a device: the card's look and the tap behaviour (maintainer acceptance).

Closes #319

🤖 Generated with Claude Code

nofuturekid and others added 2 commits November 13, 2026 17:40
…d 7.4

Unraid 7.4.0 refuses requests above a cost of 1,000, depth 20, 100 aliases
and 5,000 GraphQL tokens (unraid/api request-protection.ts, graphql-armor
3.2.0). A query that grows past them would only show up as a failed screen.

GraphqlRequestLimitsTest re-implements the server's formulas (documented
with their source in GraphqlDocumentMetrics), measures every operation in
app/src/main/graphql as Apollo sends it and fails, naming the operation and
the measure, when one passes 70 percent of a limit. Its other tests pin the
formulas to the server's own boundaries. HANDOFF.md records the limits, the
margin and the result measured on a real Unraid 7.4.0.

No app code changes: the largest operation (GetArray) costs 59 of 1,000.

Closes #320

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A card at the top of the Overview lists what needs attention, most urgent
first: an array that is not started or is degraded, a parity operation that is
running, paused or failed, disks with errors, disks at or above their warning
or critical temperature, and unread alert and warning notifications. Tapping a
row opens the Array tab or the notifications. The card is hidden when nothing
needs attention and while the server is offline.

The rules are one pure function in the data layer (attentionItems) that returns
items with a severity, a stable key per condition, a title, a detail and a
target, so background alerts and a widget can reuse it. It reads only data the
app already loads. The array mapper now also keeps how the last parity run
ended (the query already asked for it).

Closes #319

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid
nofuturekid force-pushed the feat/needs-attention-card branch from c79e7f1 to 3258fbb Compare November 13, 2026 16:49
@nofuturekid nofuturekid closed this pull request by merging all changes into main in dcfb183 Nov 13, 2026
@nofuturekid
nofuturekid deleted the feat/needs-attention-card branch November 13, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show a "needs attention" summary on the Overview tab

1 participant