feat: add scoped image sync endpoint

This commit is contained in:
2026-08-06 14:58:41 +00:00
parent 5078f6f3b1
commit 2fb618aa5c
11 changed files with 229 additions and 6 deletions
+16
View File
@@ -124,3 +124,19 @@ test('same-branch force pushes and payload SHA mismatches are rejected', async (
/Payload commit does not match remote branch tip/,
);
});
test('signed sync callers can only fast-forward the active branch and requests are idempotent', async (t) => {
const f = await fixture();
t.after(() => rm(f.root, { recursive: true, force: true }));
await writeFile(join(f.seed, 'icons', 'sync.jpg'), 'sync');
await git(f.seed, 'add', '.');
await git(f.seed, 'commit', '-m', 'sync target');
await git(f.seed, 'push', 'origin', 'master');
const target = await git(f.seed, 'rev-parse', 'HEAD');
const result = await f.service.deploySync({ requestKey: 'core:sync-request-1', expectedCommit: target });
assert.equal(result.changed, true);
assert.equal(await git(f.deployed, 'rev-parse', 'HEAD'), target);
assert.equal((await f.service.deploySync({ requestKey: 'core:sync-request-1' })).duplicate, true);
assert.equal(f.service.publicStatus().activeBranch, 'master');
});