Merge pull request 'feat: CI browser journey is nondeterministic after Today cross-device merge' (#1041) from timmy/1040-ci-browser-journey-is-nondeterministic-after-tod into main
This commit is contained in:
commit
66968d90c0
|
|
@ -173,7 +173,7 @@ function createTodaySync({ storage, getLogin, fetchJson, onRemoteIds, onRemotePl
|
|||
const recordKey = storageKey + '.operation.' + encodeURIComponent(operation.operation_id);
|
||||
let saved = false;
|
||||
try {
|
||||
storage.setItem(recordKey, JSON.stringify({ operation, queued_at: now() }));
|
||||
storage.setItem(recordKey, JSON.stringify({ operation, queued_at: now() + operations.length }));
|
||||
knownOperationKeys.add(recordKey);
|
||||
saved = true;
|
||||
coordinator?.notify('today');
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ FEATURE_SOURCES = {
|
|||
"static/today-rollover.js", "static/later-work.js", "static/later-picker.js", "static/drafts.js", "static/unfiled-captures.js", "static/unfiled-draft-sync.js",
|
||||
"static/assign-and-start.js", "static/filed-claim.js", "static/queue-today.js", "static/create-and-start.js",
|
||||
"static/draft-filing-session.js", "static/draft-capacity-dialog.js", "static/work-selection.js",
|
||||
"static/today-work.js", "static/pick-work.js", "static/batch-find-work.js",
|
||||
"static/today-work.js", "static/today-sync.js", "static/pick-work.js", "static/batch-find-work.js",
|
||||
"static/search-batch-plan.js", "static/mention-composer.js", "static/issue-evidence-review.js", "static/issue-evidence-editor.js",
|
||||
"static/issue-attachment.js", "static/checklist-conflict.js", "static/issue-outbox.js", "static/authored-outbox.js", "static/issue-sheet.js", "static/mobile-issue-detail-nav.js", "static/issue-filing-review.js", "static/issue-filing-receipt.js",
|
||||
),
|
||||
|
|
|
|||
|
|
@ -83,6 +83,31 @@ sync.enqueue('add', 'issue:r:1:');
|
|||
}
|
||||
|
||||
|
||||
def test_operations_queued_in_the_same_millisecond_preserve_enqueue_order():
|
||||
script = f"""
|
||||
const createTodaySync = require({json.dumps(str(TODAY_SYNC))});
|
||||
const values = new Map();
|
||||
const storage = {{
|
||||
get length() {{ return values.size; }}, key: index => [...values.keys()][index] || null,
|
||||
getItem: key => values.get(key) || null,
|
||||
setItem: (key, value) => values.set(key, value), removeItem: key => values.delete(key),
|
||||
}};
|
||||
const operationIds = ['z-add-first', 'a-move-second'];
|
||||
const sync = createTodaySync({{
|
||||
storage, getLogin: () => 'timmy', now: () => 1000,
|
||||
createOperationId: () => operationIds.shift(),
|
||||
fetchJson: async () => ({{revision: 0, ids: []}}),
|
||||
}});
|
||||
sync.enqueue('add', 'issue:r:1:');
|
||||
sync.enqueue('move', 'issue:r:1:', 'up');
|
||||
process.stdout.write(JSON.stringify(sync.pending().map(operation => operation.operation_id)));
|
||||
"""
|
||||
|
||||
assert json.loads(subprocess.run(
|
||||
["node", "-e", script], check=True, capture_output=True, text=True
|
||||
).stdout) == ["z-add-first", "a-move-second"]
|
||||
|
||||
|
||||
def test_today_capacity_configuration_syncs_offline_and_adopts_remote_plan():
|
||||
script = f"""
|
||||
const createTodaySync = require({json.dumps(str(TODAY_SYNC))});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user