Skip to content

ADFA-5143 fix(home): a clone in flight has a name, and neither side i… - #405

Merged
luisguzman-adfa merged 6 commits into
mainfrom
fix/ADFA-5143-clone-sharing-has-a-name-and-no-retry
Aug 14, 2026
Merged

luisguzman-adfa merged 6 commits into
mainfrom
fix/ADFA-5143-clone-sharing-has-a-name-and-no-retry

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

…s offered a restart

Navigate away from the Clone tab mid-transfer and Home said the system had failed to start, with a Retry that did nothing.

The ticket claimed that Retry boots the server. It does not — handleServerLaunchClick refuses on EnvironmentLock.ownerHeld, and both clone sides take Owner.CLONE. Priority came down to 3 once that was verified rather than repeated. What was really there is a dead control on a lying screen.

The root: canStartServer() was a partial copy of that guard, missing the module queue and the lock, so the header asked the weaker of two answers to the same question. It now checks both, which removes the dead button without knowing anything about clones.

The two header states are asked BEFORE the !installed branch, and that is the point: during a receive the install marker makes isSystemInstalled() false, so the next line said "no library" while an entire system was arriving. Amber, because the server is down on purpose and the box is busy with something the user started.

Neither side is offered a restart — it is not a meaningful thing to do to a transfer. The receiver gets its progress screen, the donor its QR screen. Stop is not copied onto the header: it lives in the Clone flow, and navigating to a control beats owning a second one. The receiver is the half that carries the priority, being the only side with a percentage.

Not fixed here: leaving the receiver's progress screen can kill the connection, and nothing can then offer a retry. rsync could resume, but EnvironmentLock stores its owner with a session token and deletes the file when the token does not match — so a process death erases the only evidence that a clone was in flight, and what is left is the damaged-system dialog. ADFA-5106's shape, plus a missing foreground service. Their own work, not a pre-demo change.

…s offered a restart

Navigate away from the Clone tab mid-transfer and Home said the system had failed
to start, with a Retry that did nothing.

The ticket claimed that Retry boots the server. It does not — handleServerLaunchClick
refuses on EnvironmentLock.ownerHeld, and both clone sides take Owner.CLONE. Priority
came down to 3 once that was verified rather than repeated. What was really there is a
dead control on a lying screen.

The root: canStartServer() was a partial copy of that guard, missing the module queue
and the lock, so the header asked the weaker of two answers to the same question. It
now checks both, which removes the dead button without knowing anything about clones.

The two header states are asked BEFORE the !installed branch, and that is the point:
during a receive the install marker makes isSystemInstalled() false, so the next line
said "no library" while an entire system was arriving. Amber, because the server is
down on purpose and the box is busy with something the user started.

Neither side is offered a restart — it is not a meaningful thing to do to a transfer.
The receiver gets its progress screen, the donor its QR screen. Stop is not copied onto
the header: it lives in the Clone flow, and navigating to a control beats owning a
second one. The receiver is the half that carries the priority, being the only side
with a percentage.

Not fixed here: leaving the receiver's progress screen can kill the connection, and
nothing can then offer a retry. rsync could resume, but EnvironmentLock stores its
owner with a session token and deletes the file when the token does not match — so a
process death erases the only evidence that a clone was in flight, and what is left is
the damaged-system dialog. ADFA-5106's shape, plus a missing foreground service. Their
own work, not a pre-demo change.
…way back after it dies

Two fixes, both about a clone the app could not talk about.

THE HEADER. Navigating away from the Clone tab mid-transfer left Home saying the
system had failed to start, with a Retry that did nothing. The ticket claimed that
Retry boots the server — it does not; handleServerLaunchClick refuses on
EnvironmentLock.ownerHeld and both sides take Owner.CLONE. What was there is a dead
control on a lying screen, and the root is that canStartServer() was a partial copy
of that guard, missing the module queue and the lock. It checks both now, which
removes the dead button without knowing anything about clones.

Two header states, asked BEFORE the !installed branch — during a receive the install
marker makes isSystemInstalled() false, so the next line said "no library" while a
whole system was arriving. Amber: the server is down on purpose. Neither side is
offered a restart, which is not a meaningful thing to do to a transfer. The receiver
gets its progress screen, the donor its QR screen. Stop is not copied onto the
header; it lives in the Clone flow, and navigating to a control beats owning a second.

THE WAY BACK (plan B). A killed receive leaves a half-written tree that rsync can
resume from, and until now the only offered exit discarded it: recovery →
"Reinstall the system" → the tier chooser, which offers download and nothing else.
It now lands one step earlier, at the setup choice, where "Copy from a phone" is
available and the user re-scans; rsync continues from what is on disk.

EXTRA_REINSTALL travels through the extra hop, because without it runPipeline's
non-destructive guard sees the half-written directory, skips the extract and boots
the wreck. The confirm text no longer claims an internet connection is required —
it says what comes next instead.

Landing directly on the scan screen was considered and rejected for now: it requires
knowing the interrupted operation was a clone, and EnvironmentLock deletes its owner
record when the session token does not match. That evidence needs plan A first.

Six strings, translated into the 33 locales.
…into recovery

Plan B opened the exit and then blocked it. A killed clone-receive leaves the install
marker set, so `recovering` was true again the moment recovery's suggestion —
Reinstall → Copy from a phone — landed on LibraryActivity: dialog, recovery, wizard,
clone, dialog.

The predicate now skips when EXTRA_SETTING_UP is present. That extra already means
"the caller knows there is no usable system and is bringing this person somewhere to
fix it", which is exactly when a dialog announcing the system is broken has nothing
to add and everything to block. Leave and come back cold and the marker still routes
to recovery, correctly — they are no longer mid-attempt.

Not fixed with a wipe, which was the other candidate: wiping first would remove the
half-written tree, and that tree is the reason plan B exists. rsync resumes from it.
…om fragment memory

A receive that survived the app being closed left the install marker set, the
environment lock held and the server not booted, so the next launch read a
completed clone as a damaged install and refused to open it.

releaseCloneEnv() gated on cloneLockHeld/cloneGuardHeld — fragment fields that
die with the fragment. A fragment recreated mid-transfer re-attached to the
running rsync and reached the terminal with both false, so the release returned
on its first line. showReceiveTerminal() now re-derives both facts from disk
before releasing: reaching a receive terminal is itself the proof this side owns
the environment. release() is idempotent and a receive cannot coexist with an
install, so re-deriving cannot drop someone else's claim.

Also make rsync's per-file errors visible. Only the final summary line says
"rsync error:"; every per-file failure starts with a bare "rsync:", so none
matched and all were stored as lastFile — filed as the name of the file being
transferred and shown to the user as such. They now go to logcat and
LogRepository, and the exit code is logged with its classification, so a
non-zero code treated as complete no longer reads as a bug.

Exit 23 still counts as success: the clone behind this report was complete and
the errors were attribute-only. Whether to distinguish attribute failures from
missing files is its own change, once the logs show which we get.
…tore template

The transfer state was the last clone screen not built like the app's other long
operations: a bare ProgressBar, no animation, no wait card.

It now uses the backup/restore job template — the clone Lottie with a K2Go logo
composited over each end, an M3 LinearProgressIndicator, the centred status line
and the shared "this takes a while" card (existing strings, so no new
translations). The card's wording holds here: CloneShareService keeps the pull
alive and its notification returns to the app. The logo weights are the job
screen's own, mirrored, so the receiver lands where backup/restore put theirs and
the donor mirrors it over the green glow. No card background: renderReceive()
hides everything else while busy, so the block is the whole screen. Clone's four
dialogs move to MaterialAlertDialogBuilder.

The reduce-motion reading moves to util/Motion and LibraryActivity delegates to
it, rather than the new screen keeping a private copy of the same setting. The
animation is started and paused by whatever shows or hides the block, so a hidden
screen can't leave a loop running.

setBarIndeterminate() takes the indicator off screen to switch modes:
BaseProgressIndicator guards that transition while visible, and this screen
crosses it every run. Material's internals weren't verifiable here, so the switch
no longer depends on them.
…t go stale

Review follow-ups on the M3 transfer screen. The reduce-motion flag was read once in onCreateView and cached, but changing the setting doesn't recreate the fragment, so the copy could outlive the truth. It is re-read in onResume, the only moment it can change unnoticed, which also keeps the read off the progress-tick path. Turning animations off mid-transfer now pauses the loop.

pbar is typed as LinearProgressIndicator and uses setProgressCompat, which animates to the new value instead of jumping. The explicit switch out of indeterminate stays: setProgressCompat can also do it alone, but only after the current cycle, and the screen should not depend on that.
@luisguzman-adfa
luisguzman-adfa merged commit c9fbf85 into main Aug 14, 2026
3 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the fix/ADFA-5143-clone-sharing-has-a-name-and-no-retry branch August 14, 2026 15:51
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