Apply received changes again while remediation mode is active

Remediation mode prevents the reconciliation scan which readiness depends upon,
so the application never becomes ready while the modification-time limit is set.
Since the result processor began waiting for readiness, nothing was applied in
that mode at all, not even changes older than the limit, which is what the mode
exists for. Result application no longer requires readiness while the limit is
configured, but it does require a usable local database, because a change applied
while a fetch has reset the database cannot gather its chunks and is dropped.
The limit itself is still enforced for every change.

A scheduled fetch also no longer offers Simple Fetch in this mode. Simple Fetch
reconciles the Vault with the local database after fetching, past the check which
refuses that scan, so it could store the current files or write changes newer than
the limit. The detailed flow states the restriction and offers to clear it first.
This commit is contained in:
Kim Jansheden
2026-09-25 06:51:48 +02:00
parent 2c2b9c90e4
commit 01a83b13fb
6 changed files with 105 additions and 3 deletions
@@ -35,7 +35,7 @@ type ReplicateResultProcessorSettings = Pick<
>;
type ReplicateResultProcessorServices = Pick<
LiveSyncBaseCore["services"],
"appLifecycle" | "path" | "replication" | "vault"
"appLifecycle" | "database" | "path" | "replication" | "vault"
>;
/**
@@ -115,10 +115,27 @@ export class ReplicateResultProcessor {
// If true, the processing queue processor bails the loop.
private _suspended: boolean = false;
/**
* Whether the application accepts replicated documents being applied.
*
* Remediation mode refuses the reconciliation scan which readiness depends upon, so the
* application stays unready for as long as the modification-time limit is configured.
* Applying the received documents is what that mode exists for, and `parseDocumentChange` keeps
* each one within the limit, so readiness is not required while the mode is active.
*/
private get acceptsResultApplication() {
if (this.services.appLifecycle.isReady()) return true;
if (this.context.currentSettings().maxMTimeForReflectEvents <= 0) return false;
// A fetch resets the local database, and a remote which reflects while fetching leaves this
// processor unsuspended throughout. A document applied then cannot gather its chunks and is
// dropped, so the database itself must still be usable.
return this.services.database.isDatabaseReady();
}
public get isSuspended() {
return (
this._suspended ||
!this.services.appLifecycle.isReady() ||
!this.acceptsResultApplication ||
this.context.currentSettings().suspendParseReplicationResult ||
this.services.appLifecycle.isSuspended()
);