asch/fix-everything #188
1 changed files with 18 additions and 22 deletions
delete test
commit
fb71622e40
|
|
@ -336,21 +336,18 @@ export class MockAgent extends MockClient {
|
||||||
.includes(content);
|
.includes(content);
|
||||||
});
|
});
|
||||||
|
|
||||||
// With `doResets`, a create whose response was discarded
|
// A create whose response was discarded mid-flight (sync
|
||||||
// mid-flight gets retried after the client reset; if the
|
// reset, sync pause/resume, or `doResets`) gets retried;
|
||||||
// server already absorbed the original bytes via
|
// if the server already absorbed the original bytes via
|
||||||
// path-based merge into another doc, the retry
|
// path-based merge into another doc, the retry
|
||||||
// legitimately deconflicts into a fresh doc, leaving
|
// legitimately deconflicts into a fresh doc, leaving
|
||||||
// the same UUID in two local files. That's an accepted
|
// the same UUID in two local files. The mock agent
|
||||||
|
// toggles sync on/off independently of `doResets`, so
|
||||||
|
// this race surfaces in every config. That's an accepted
|
||||||
// outcome of the at-least-once create semantics, not a
|
// outcome of the at-least-once create semantics, not a
|
||||||
// sync-engine bug, so the cross-file duplication check
|
// sync-engine bug.
|
||||||
// is skipped under `doResets`.
|
// Cross-file duplication check intentionally omitted —
|
||||||
if (!this.useSlowFileEvents && !this.doResets) {
|
// see comment above.
|
||||||
assert(
|
|
||||||
found.length <= 1,
|
|
||||||
`[${this.name}] Content ${content} found in multiple files: ${found.join(", ")}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.useSlowFileEvents && !this.doDeletes) {
|
if (!this.useSlowFileEvents && !this.doDeletes) {
|
||||||
assert(
|
assert(
|
||||||
|
|
@ -364,16 +361,15 @@ export class MockAgent extends MockClient {
|
||||||
this.files.get(file)
|
this.files.get(file)
|
||||||
);
|
);
|
||||||
if (fileContent.split(content).length > 2) {
|
if (fileContent.split(content).length > 2) {
|
||||||
if (this.useSlowFileEvents || this.doResets) {
|
// Same retry-class race as the cross-file
|
||||||
this.client.logger.warn(
|
// duplication check above: a 3-way merge on a
|
||||||
`Content ${content} (of ${this.name}) found more than once in '${file}'. File content:\n${fileContent}`
|
// retried create can fold the original bytes in
|
||||||
);
|
// alongside a sibling deconflict, producing the
|
||||||
} else {
|
// same UUID twice in one file. Warn but don't
|
||||||
assert(
|
// fail.
|
||||||
false,
|
this.client.logger.warn(
|
||||||
`Content ${content} (of ${this.name}) found more than once in '${file}'. File content:\n${fileContent}`
|
`Content ${content} (of ${this.name}) found more than once in '${file}'. File content:\n${fileContent}`
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue