Skip to content

ADFA-5104 feat(system): read what is installed from the installer's own flags - #390

Merged
luisguzman-adfa merged 4 commits into
mainfrom
fix/ADFA-5104-module-state-from-disk
Aug 12, 2026
Merged

luisguzman-adfa merged 4 commits into
mainfrom
fix/ADFA-5104-module-state-from-disk

Conversation

@luisguzman-adfa

@luisguzman-adfa luisguzman-adfa commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Module management answered "what is installed" by asking "what is answering".
ModuleHubFragment.reachable() collapses a 404, a timeout and a refused
connection into one boolean, and probeAll() turned that boolean into the
installable list — so with the box stopped nothing answered and every module was
offered, including the installed ones. Accepting stops the box and runs a
runrole for hours to rebuild what was already there.

Three facts were being treated as one. Whether a system exists, whether it is
running, and what is installed inside it are separate questions with separate
sources.

Does a system exist is the precondition. With no rootfs there is no proot and
nothing to install into, so the hub asks SystemStateEvaluator first and, when
the answer is no, offers nothing at all — no helper text, no dash-node card, no
rows, no proceed button. Reachable rather than defensive:
pref_key_setup_complete is only ever written true, so after a reset the app
still routes to the Library and Settings still opens this screen over an empty
rootfs.

What is installed is read from etc/iiab/local_vars.yml inside the rootfs —
a plain file on the host filesystem, so it is readable with the services stopped
and no proot is entered. It is the installer's own record, and it lives inside
the rootfs, so a reset, restore, clone or reinstall invalidates it with no
bookkeeping on our side. InstalledModules reads <key>_install and not
<key>_enabled: installed and enabled are different statements, and reading
both would make "installed" mean "installed and running".

Whether it is running no longer gates any of this. A module install opens its
own proot, so a stopped box is not a reason to withhold anything.

Silence keeps its own name throughout. readFlags returns null when the file
cannot be read, installedKeys passes that through, and both screens treat it
as a third state — "Status unknown", no checkboxes, no buttons — rather than as
absence. A missing or half-written file must not put installed modules back on
screen as installable.

The probe still runs and can only add. A platform that answers proves it is
there; a 404 proves much less, because a module can be installed and switched
off and nginx answers the same way. That leaves one gap on purpose:
InstallService writes the flag before the runrole and reverts on failure, so a
process death between the two leaves a claim nothing here corrects. Letting a
404 demote would close it and cost more.

The list stops hiding what you have. Installed modules stay on screen, labelled,
with no checkbox — hiding them answered "what can I still add" while users were
asking "what do I have", and since a module cannot be uninstalled the row is not
an offer to undo anything. The detail screen agrees: it withheld nothing before,
so a module the list called Installed still had Install now and Schedule inside.

GetMoreHubFragment.reachable() is the same function and deliberately untouched.
Its use is add-only — a failed probe never removes a card — so silence never
becomes absence there, and its empty state already tells a stopped box from an
empty one. Module management had the same call inverted, and the inversion was
the defect. Consolidating the two copies is ADFA-5062.

One new string in all 34 locale files that carry them; k2go_mod_phase_done and
k2go_state_no_answer are reused. Files.readAllBytes avoided: it is API 26 and
this app ships to 24 with no desugaring.

Module management answered "what is installed" by asking "what is answering".
ModuleHubFragment.reachable() collapses a 404, a timeout and a refused
connection into one boolean, and probeAll() turned that boolean into the
installable list — so with the box stopped nothing answered and every module was
offered, including the installed ones. Accepting stops the box and runs a
runrole for hours to rebuild what was already there.

Three facts were being treated as one. Whether a system exists, whether it is
running, and what is installed inside it are separate questions with separate
sources.

Does a system exist is the precondition. With no rootfs there is no proot and
nothing to install into, so the hub asks SystemStateEvaluator first and, when
the answer is no, offers nothing at all — no helper text, no dash-node card, no
rows, no proceed button. Reachable rather than defensive:
pref_key_setup_complete is only ever written true, so after a reset the app
still routes to the Library and Settings still opens this screen over an empty
rootfs.

What is installed is read from etc/iiab/local_vars.yml inside the rootfs —
a plain file on the host filesystem, so it is readable with the services stopped
and no proot is entered. It is the installer's own record, and it lives inside
the rootfs, so a reset, restore, clone or reinstall invalidates it with no
bookkeeping on our side. InstalledModules reads <key>_install and not
<key>_enabled: installed and enabled are different statements, and reading
both would make "installed" mean "installed and running".

Whether it is running no longer gates any of this. A module install opens its
own proot, so a stopped box is not a reason to withhold anything.

Silence keeps its own name throughout. readFlags returns null when the file
cannot be read, installedKeys passes that through, and both screens treat it
as a third state — "Status unknown", no checkboxes, no buttons — rather than as
absence. A missing or half-written file must not put installed modules back on
screen as installable.

The probe still runs and can only add. A platform that answers proves it is
there; a 404 proves much less, because a module can be installed and switched
off and nginx answers the same way. That leaves one gap on purpose:
InstallService writes the flag before the runrole and reverts on failure, so a
process death between the two leaves a claim nothing here corrects. Letting a
404 demote would close it and cost more.

The list stops hiding what you have. Installed modules stay on screen, labelled,
with no checkbox — hiding them answered "what can I still add" while users were
asking "what do I have", and since a module cannot be uninstalled the row is not
an offer to undo anything. The detail screen agrees: it withheld nothing before,
so a module the list called Installed still had Install now and Schedule inside.

GetMoreHubFragment.reachable() is the same function and deliberately untouched.
Its use is add-only — a failed probe never removes a card — so silence never
becomes absence there, and its empty state already tells a stopped box from an
empty one. Module management had the same call inverted, and the inversion was
the defect. Consolidating the two copies is ADFA-5062.

One new string in all 34 locale files that carry them; k2go_mod_phase_done and
k2go_state_no_answer are reused. Files.readAllBytes avoided: it is API 26 and
this app ships to 24 with no desugaring.

Verified on device: installed modules labelled with the box up and with it
stopped; the no-system precondition; the unreadable-flags state with the box up
and down, by moving local_vars.yml aside; Get More unchanged; and a real module
install end to end, which also exercises the cleanup of the banked order once
the module lands on disk.

Not verified: the detail screen withholding Install now and Schedule on an
already-installed module, and the "Checking" first frame — it was never seen
saying the wrong thing, which is the pass condition but not a forced test.

…wn flags

Module management answers "what is installed" by asking "what is answering",
which needs the box up and turns every silence into absence. This adds the
source that does not: etc/iiab/local_vars.yml, a plain file inside the rootfs,
readable with the services stopped and with no proot entered.

Two properties are why it is the right source rather than a cache. It is
written by the thing that does the installing, and it lives inside the rootfs —
so a reset, restore, clone or reinstall takes it along and invalidation costs
nothing. A SharedPreferences copy of the same fact would need a clear() on five
routes, which is exactly how installed_tier came to be written once and cleared
by nobody.

InstalledModules is the pure rule. It reads <key>_install and not <key>_enabled:
installed and enabled are different statements, and reading both would make
"installed" mean "installed and running" — the conflation this ticket exists to
undo. It answers with PlatformPresence.Evidence rather than a boolean, because a
readable file that does not carry the flag is a real absence while an unreadable
one establishes nothing, and a boolean cannot hold that difference.

Nothing calls this yet; behaviour is unchanged. The hub and the precondition
come next.

Two things found on the way. Files.readAllBytes is API 26 and this app ships to
24 with no desugaring, so it would have crashed on the oldest devices we
support; plain streams instead. And LocalVarsYamlParser's known limits are now
pinned in a test rather than assumed — it splits on the first colon and knows
nothing about nesting, quoting or inline comments, which was tolerable while it
fed a cosmetic grid and is not now that it is load-bearing.
The screen decided what was installable from a probe alone, so with no rootfs at
all nothing answered and all six modules were offered — over an empty system,
where there is nothing to install into and no proot to run a runrole with. The
dash-node card was drawn above them, offering Rebuild on the same nothing.

Reachable, not theoretical: pref_key_setup_complete is only ever written true —
five writers, none of them clears it — so after a reset or a failed restore the
app still routes to the Library and Settings still opens this screen over an
empty rootfs.

The hub now asks SystemStateEvaluator first, off the main thread, and when the
answer is no it draws one line saying why and offers nothing: no helper text, no
dash-node card, no module rows, no proceed button. The hidden section stays,
because restoring a hidden card is a preference and costs the box nothing.

One new string in all 34 locale files that carry them. The fr, it and en values
carry escaped apostrophes; the build fails on a bare one.

This is the precondition only. What is installed still comes from the probe —
the disk source landed in the previous commit and is not wired yet.
Module management now asks the installer's flags what is installed instead of
asking who answers, and shows every module with its state instead of hiding the
installed ones.

Two changes that go together. The state comes from local_vars.yml on the rootfs,
so it is right with the box stopped — the case where the old probe returned
nothing and the screen read that as "install all six". And the list stops
filtering: installed modules stay on screen, labelled Installed, with no
checkbox. Hiding them answered "what can I still add" while users were asking
"what do I have", and since a module cannot be uninstalled the row is not an
offer to undo anything — it is the only place that answer exists.

The probe still runs, but it can only add. A platform that answers proves it is
there; a 404 proves much less, because a module can be installed and switched
off and nginx answers the same way. That leaves one known gap on purpose:
InstallService writes the flag before the runrole and reverts on failure, so a
process death between the two leaves a claim nothing here corrects. Letting a
404 demote would close it and cost more — that is the error that offers a
multi-hour reinstall of something already present.

Also: a "Checking" state until the first disk read returns, so the list does not
render everything as Not installed for an instant and then correct itself; the
time warning only when something is still installable; installed outranks
scheduled on the pill; and a stale order for an installed module is dropped from
the wishlist, so the button agrees with the pill.

Reuses k2go_mod_phase_done for the label — already translated in all 34 files.
…keeps its own name

Review of #390, plus what the device found.

From the device: the detail screen still offered Install now and Schedule on a
module the list had just labelled Installed. The hub stopped making that offer
and this screen was one tap behind it — and it is the louder of the two, since a
full-width button reads as an invitation in a way a checkbox does not. Both
actions are withheld when the flags say installed, and a chip says why. They
start hidden and appear only if the read says there is something to offer;
showing them first and removing them later is how a user taps one in the gap.

From the review: InstalledModulesReader.installedKeys returned an empty set both
when nothing was installed and when the file could not be read. readFlags
returns null precisely to keep those apart, and the layer above flattened it —
the defect this ticket removes, one layer down. A missing, half-written or
oversized local_vars.yml would have put every module back on screen as
installable. It returns null now, and both screens treat it as its own state:
no checkboxes, no proceed button, no install buttons, and a "Status unknown"
pill rather than a claim.

Also from the review: the stale javadoc above probeAll described the rule this
work deletes; k2go_mod_none is gone from the hub, since it said "everything
available is already installed" while the list was filtered to installables and
the branch can no longer fire on a device where that sentence is true; and one
over-long comment line wrapped.

root.post rather than requireView().post in the detail: inside onCreateView the
fragment's view is not set yet and requireView() would throw.
@luisguzman-adfa
luisguzman-adfa merged commit 19af742 into main Aug 12, 2026
3 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the fix/ADFA-5104-module-state-from-disk branch August 12, 2026 13:55
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.

1 participant