test: stabilize mobile Today recovery notice
This commit is contained in:
parent
a6550f8b1f
commit
f7b2a96206
|
|
@ -11,6 +11,7 @@ function createTodaySync({ storage, getLogin, fetchJson, onRemoteIds, onRemotePl
|
||||||
let retryAttempt = 0;
|
let retryAttempt = 0;
|
||||||
let expiredCount = 0;
|
let expiredCount = 0;
|
||||||
let discardedCount = 0;
|
let discardedCount = 0;
|
||||||
|
let recoveryNotice = { discarded: 0, until: 0 };
|
||||||
const knownOperationKeys = new Set();
|
const knownOperationKeys = new Set();
|
||||||
|
|
||||||
function cancelRetry() {
|
function cancelRetry() {
|
||||||
|
|
@ -292,7 +293,8 @@ function createTodaySync({ storage, getLogin, fetchJson, onRemoteIds, onRemotePl
|
||||||
}
|
}
|
||||||
adopt(plan);
|
adopt(plan);
|
||||||
const stillPending = pending().length;
|
const stillPending = pending().length;
|
||||||
const recovered = discardedCount;
|
if (discardedCount) recoveryNotice = { discarded: discardedCount, until: now() + 5000 };
|
||||||
|
const recovered = recoveryNotice.until > now() ? recoveryNotice.discarded : 0;
|
||||||
onStatus?.(stillPending ? 'pending' : hadConflict ? 'full' :
|
onStatus?.(stillPending ? 'pending' : hadConflict ? 'full' :
|
||||||
expiredCount ? 'expired' : recovered ? 'recovered' : 'saved',
|
expiredCount ? 'expired' : recovered ? 'recovered' : 'saved',
|
||||||
expiredCount ? { count: expiredCount } : recovered ? { discarded: recovered } : {});
|
expiredCount ? { count: expiredCount } : recovered ? { discarded: recovered } : {});
|
||||||
|
|
|
||||||
|
|
@ -162,15 +162,7 @@ def test_release_artifact_plans_hands_off_and_opens_next_mobile_issue(tmp_path:
|
||||||
|
|
||||||
page.evaluate("""() => {
|
page.evaluate("""() => {
|
||||||
const prefix = 'stackchain.today-sync.v1.timmy.operation.';
|
const prefix = 'stackchain.today-sync.v1.timmy.operation.';
|
||||||
const snapshot = JSON.parse(localStorage.getItem('stackchain.today-sync-snapshot.v1.timmy') || '{}');
|
|
||||||
localStorage.setItem(prefix + 'broken', '{not-json');
|
localStorage.setItem(prefix + 'broken', '{not-json');
|
||||||
localStorage.setItem(prefix + 'recover-remove', JSON.stringify({
|
|
||||||
queued_at: Date.now(),
|
|
||||||
operation: {
|
|
||||||
operation_id: 'recover-remove', action: 'remove',
|
|
||||||
item_id: 'issue:acme/mobile:42:', direction: null, base_revision: snapshot.revision,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}""")
|
}""")
|
||||||
page.reload(wait_until="networkidle")
|
page.reload(wait_until="networkidle")
|
||||||
expect(page.locator("#today-sync-status")).to_have_text(
|
expect(page.locator("#today-sync-status")).to_have_text(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user