Prepare consistent Chunk sizes and fresh Fast Fetch integration

This commit is contained in:
vorotamoroz committed 2026-10-23 09:12:02 +00:00
1 parent ce0524d49f
commit d1e4c34054
24 files changed
+2042 -14

No files matched your search

+14 -4
View File
@@ -1,6 +1,7 @@
import {
decodeSettingsFromSetupURI,
DEFAULT_SETTINGS,
PREFERRED_SETTING_SELF_HOSTED,
} from "../setup/livesync-commonlib.ts";
function assert(condition: unknown, message: string): asserts condition {
@@ -9,8 +10,14 @@ function assert(condition: unknown, message: string): asserts condition {
Deno.test("generates a current self-hosted Setup URI through the published Commonlib contract", async () => {
const scriptPath = new URL("./generate_setupuri.ts", import.meta.url);
const candidateConfig = Deno.env.get("LIVESYNC_TEST_COMMONLIB_CONFIG");
const command = new Deno.Command(Deno.execPath(), {
args: ["run", "-A", scriptPath.pathname],
args: [
"run",
"-A",
...(candidateConfig ? ["--config", candidateConfig, "--no-lock"] : []),
scriptPath.pathname,
],
env: {
hostname: "https://couch.example.test",
username: "alice",
@@ -38,7 +45,9 @@ Deno.test("generates a current self-hosted Setup URI through the published Commo
const recoveryCode = stdout.match(/sls-id-v1:[0-9a-f]{64}/u)?.[0];
assert(recoveryCode, "the generator did not print an ID recovery code");
assert(
(effectiveSettings as typeof effectiveSettings & { idDerivationKey?: string }).idDerivationKey ===
(effectiveSettings as typeof effectiveSettings & {
idDerivationKey?: string;
}).idDerivationKey ===
recoveryCode.slice("sls-id-v1:".length),
"the CouchDB Setup URI did not contain the generated ID key",
);
@@ -47,8 +56,9 @@ Deno.test("generates a current self-hosted Setup URI through the published Commo
"the CouchDB Setup URI left the imported device unconfigured",
);
assert(
effectiveSettings.customChunkSize === 60,
"the Setup URI did not use the current self-hosted chunk-size recommendation",
effectiveSettings.customChunkSize ===
PREFERRED_SETTING_SELF_HOSTED.customChunkSize,
"the Setup URI did not use the self-hosted chunk-size preference from Commonlib",
);
assert(
effectiveSettings.chunkSplitterVersion === "v3-rabin-karp",