Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,33 @@ public enum State {
* one of them. Worse, it collapsed two orthogonal axes into one enum and then mapped LIVE
* and STOPPED to the same colour to undo the collapse. Severity is a property of the row;
* the class is a property of the operation. They are asked separately now.
*
* <p>{@link #CAUTION} was added afterwards, and it is not that collapse coming back. Install
* was teal, the same accent as Open, and that reads as "go ahead, this is a tap" for
* something that can hold the box for an hour and a half on a poor link. That is a warning
* about cost, which is severity — the axis colour is for. The class is still said in words,
* by {@link #noticeFor}, and the two channels answer different questions: the colour says be
* careful, the sentence says why.
*
* <p>It happens that every STOPPED operation we ship today is also a costly one, so the two
* axes agree on every row currently drawn. They are kept apart anyway, because the day a
* cheap STOPPED operation exists, {@code CAUTION} must not follow it — but note that nothing
* enforces that yet. {@code CAUTION} is chosen per row by hand, and until "this is expensive"
* is a property of the {@link Operation} rather than of the row, the separation lives in this
* paragraph and nowhere else. Do not derive it from {@code isLive()} to save the typing; that
* is the collapse, and it would be the third time.
*/
private enum Emphasis { ACCENT, PLAIN, DESTRUCTIVE }
private enum Emphasis { ACCENT, PLAIN, CAUTION, DESTRUCTIVE }

private static int colorOf(Emphasis e) {
switch (e) {
case ACCENT: return R.color.k2go_teal;
// Measured 3.30:1 against k2go_surface in light (teal is 6.47, dark amber is 6.68),
// which is under AA for body text on paper. Read on device and judged legible, so it
// stands; recorded because this token pins 24 sites at the same ratio and this is the
// first one where it carries a warning rather than a status. Revisit with real
// reports, or whenever colour tokens get a pass of their own.
case CAUTION: return R.color.k2go_amber_text;
case DESTRUCTIVE: return R.color.k2go_clay;
default: return R.color.k2go_ink;
}
Expand Down Expand Up @@ -181,7 +202,7 @@ public static void show(Activity act, String endpoint, String title, int iconRes
String installLabel = act.getString(
n > 1 ? R.string.k2go_sheet_install_sel : R.string.k2go_sheet_install);
content.addView(row(ctx, R.drawable.ic_download_24, installLabel,
Emphasis.ACCENT, Operation.appInstall(key), false, v -> { dlg.dismiss(); if (sel) openMapsSetup(act); else openHub(act); }));
Emphasis.CAUTION, Operation.appInstall(key), false, v -> { dlg.dismiss(); if (sel) openMapsSetup(act); else openHub(act); }));
content.addView(row(ctx, R.drawable.ic_close_24, act.getString(R.string.k2go_sheet_cancel),
Emphasis.DESTRUCTIVE, null, false, v -> {
if (sel) MapsWishlist.clear(ctx);
Expand All @@ -197,8 +218,8 @@ public static void show(Activity act, String endpoint, String title, int iconRes
// platform is installed, so neither Install nor Schedule is offered.
//
// A middle version offered Schedule here, on the grounds that it only writes a
// preference and leaving the state with nothing to do was harsh. Luis took that
// apart: Schedule is Install deferred. Withholding one and offering the other
// preference and leaving the state with nothing to do was harsh. That came apart
// on one point: Schedule is Install deferred. Withholding one and offering the other
// grades the same wrong guess by when it hurts, not by whether it is wrong, and a
// scheduled install for a platform that turns out to be installed still runs.
//
Expand All @@ -214,10 +235,10 @@ public static void show(Activity act, String endpoint, String title, int iconRes
if (sel) {
// maps: installing needs the content selector; route there (schedule lives in the wizard).
content.addView(row(ctx, R.drawable.ic_download_24, act.getString(R.string.k2go_sheet_install),
Emphasis.ACCENT, Operation.appInstall(key), false, v -> { dlg.dismiss(); openMapsSetup(act); }));
Emphasis.CAUTION, Operation.appInstall(key), false, v -> { dlg.dismiss(); openMapsSetup(act); }));
} else {
content.addView(row(ctx, R.drawable.ic_download_24, act.getString(R.string.k2go_sheet_install),
Emphasis.ACCENT, Operation.appInstall(key), false, v -> {
Emphasis.CAUTION, Operation.appInstall(key), false, v -> {
if (key != null) ModuleWishlist.add(ctx, key);
dlg.dismiss();
openHub(act);
Expand Down
101 changes: 101 additions & 0 deletions controller/docs/ADR-5061-rest-vs-proot-operation-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,54 @@ screen. Subtle, not in-your-face: the lights change, buttons appear or don't.
`STOPPED → {colour: amber, navigable: false (gated to the index/card), backgroundAffordance: none,
progress: full-screen index}`. Presentation reads these from the class; screens stop hand-picking.

**Amended, 11 Aug — colour is severity, not class.** The colour half of this decision was wrong
and the work proved it. `ModuleActionSheet` originally had a four-valued `Tone` carrying LIVE and
STOPPED exactly as written here; it collapsed two orthogonal axes into one enum and then mapped
both class values to the same colour to undo the collapse. What a user needs to be told about a
STOPPED operation is its *consequence*, and a consequence is a sentence — so the class is said in
words (`noticeFor` → "Your system pauses while this installs"), read from `op.isLive()`.

Colour still does real work on that row, for a different reason. Install was teal, the same accent
as Open, which reads as "go ahead, this is a tap" for something that can hold the box for an hour
and a half. So Install is amber, as a warning about **cost** — severity, which is the axis colour
is for. The two agree on every row we ship today, because every STOPPED operation we have is also
an expensive one; they are kept apart so that a cheap STOPPED operation would not inherit the
warning.

**And derive only where it can vary.** The other four class-expressing sites — the maps-landing
rebuild block and section header, the maps-confirm banner, the module-hub time note — stay literal
on purpose. Each is a single-purpose screen: the maps rebuild is always maps, the hub note is
always a module install. Their colour cannot drift because there is nothing to drift from, and
three of the four are static XML with no model object in scope; deriving a constant is indirection,
not a source of truth. `ModuleActionSheet` is the one surface where a LIVE row and a STOPPED row
are built by the same function and sit next to each other for the user to compare, and that is
where the rule is applied once instead of typed per row.

**Two things accepted with open eyes, written down so they are not rediscovered as bugs.**

*Amber now says two things on two surfaces.* On the Home cards amber is a status — "connecting",
"stopped". On this row it is a warning about cost. The contexts are far apart and the sheet draws
no status dots, so the collision was judged acceptable; but if colour tokens ever get unified,
this is the knot to untie first.

*The two axes are separated only in prose.* Every STOPPED operation we ship is also an expensive
one, so `CAUTION` and `!op.isLive()` select the same rows in every screen currently drawn. Nothing
in the code keeps them apart — `CAUTION` is chosen per row by hand, exactly the shape the earlier
review condemned when the class was typed per row. It is deliberate: deriving from `isLive()`
would be the collapse a third time. The durable fix is for "this is expensive" to become a
property of `Operation`, next to `kind` and `executionClass`, and for the sheet to read it the way
it already reads the notice. Until then the distinction is a convention, and conventions do not
survive contributors who cannot see them.

*And one measurement, recorded rather than acted on.* `k2go_amber_text` gives 3.30:1 against
`k2go_surface` in light mode, where teal gives 6.47:1 and the dark twin gives 6.68:1 — under AA
for body text. Read on device and judged legible, so it ships. It is noted because the token pins
24 sites at that same ratio and this is the first one where it carries a warning rather than a
status; the fix, if reports say so, is the token's light value, not this row.

The rest of the contract — navigable, background affordance, progress surface — is unchanged and
still reads from the class.

4. **One dispatch point per operation** reads the class and selects mechanism + progress surface +
gates. Kill the implicit per-surface derivation: replace the `SetupProgressActivity` key switch and
the invisible version fork's *silent* fallback with an **explicit** resolver — and when the class
Expand Down Expand Up @@ -1088,6 +1136,59 @@ most expensive by the third platform. A is B done safely over time.
only the latter — so the three UI doors that do check `isHeld()` lose it between the door
and the drain. Its own ticket.

13. [x] **Kolibri, both classes** (decision 6b). Closed by inspection, with no code of its own —
recording that is the point, because the item sat amber on a blocker that another change
had already removed.

Seeding is LIVE and reaches the model twice over: `KolibriReadinessViewModel` resolves
`Operation.content("kolibri")` through the dispatcher, and the pickers ask `ContentDoor`
before they decide to bank or run. The install is STOPPED and reaches it through
`ModuleProvisioner` → `SystemDoor` → `Operation.appInstall("kolibri")`, which is item 12.
The roadmap note under this item — "the app install never reaches the model,
`Operation.appInstall` has one caller and it only picks an animation" — was true when it
was written and stopped being true one commit later. Corrected there.

Not closed by this: the content drains still serialise themselves by hand
(`KolibriProvisioner.canDrainNow` checks pending proot work and other live streams). That
is a different question — stream against stream, not operation against box — and it is the
third bullet of the carried list, not this item.

14. [x] **UX-contract tokens** (item 2d), closed by amending decision 3 rather than implementing it.

The item had three different things inside it, which is why it stayed amber so long.

*The colour rule.* Amended above: colour is the severity channel, the class is said in
words. Install now goes amber in `ModuleActionSheet` — a warning about cost, not about
class — through a new `Emphasis.CAUTION`. Open stays teal. The four static
class-expressing sites stay literal, and the ADR now says why instead of leaving the next
reader to wonder whether they were missed.

*The animation.* Already delivered under ADFA-5074: `ProgressVisual.forOperation` returns
BUILD or DOWNLOAD from `op.isLive()`, and `ProgressVisuals` maps it. No colour in either,
correctly.

*The terminal state.* Split out. It is not a token — it is instrumentation across three
services with three different starting points, and it kept this item amber for reasons
that had nothing to do with tokens. Its own card on the roadmap: "A finished run leaves no
evidence it happened".

15. [ ] **Two items moved out of 5061 so it can close** — a follow-up card on the roadmap, joined
to the ticket by an arrow, because "out of scope" and "forgotten" look identical six months
later and only one of them is a decision.

- **One shared answer to "is the platform there"** (item 10). Its visible face is already a
standalone card: module management treats silence as absence and offers to reinstall what
is installed. The plumbing and the defect are one pass.
- **Dashboard Rebuild, the REST/proot fork** (decision 5). Untouched since before this ADR
existed: an unreadable version silently takes the route that stops the box, and the LIVE
route is presented as if it were STOPPED. It is the sharpest mixing example in the app and
it was named as the first place to apply the model; it is also the only item here that
needs a version resolver rather than the facts.

Everything else 5061 set out to do is delivered: the facts reader, the pure resolver, both
execution classes dispatching through it, the wizard booleans retired, selection surviving
process death, the UX contract settled, and Kolibri covered on both classes.

11. [ ] **Small things the second review pass left standing.** None of them is worth a ticket on
its own; they belong to whichever ticket next opens these files.

Expand Down
Loading
Loading