mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-27 11:20:42 +01:00
When reusing a Codex sandbox, the workspace-restore step now performs an auth-merge check before adopting the sandbox's auth.json. The merge fails closed when: - host or sandbox Codex auth is unusable (missing token or account) - the subscription payload shapes differ between host and sandbox - subscription account identities do not match Additional hardening: node absence on PATH during the embedded decision script now exits non-zero instead of silently falling through. Co-change comments link parseAuth (the embedded script) to hasUsableAuthPayload (codex-home.ts) so a future auth-format change cannot silently diverge between the two implementations. Co-Authored-By: Paperclip <noreply@paperclip.ing>
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { findExistingComment } from '../run-quality-gates.mjs';
|
|
|
|
test('findExistingComment: paginates until it finds the commitperclip comment', async () => {
|
|
const seenPaths = [];
|
|
const comment = await findExistingComment(async (path) => {
|
|
seenPaths.push(path);
|
|
if (path.endsWith('page=1')) {
|
|
return Array.from({ length: 100 }, (_, index) => ({
|
|
id: index + 1,
|
|
user: { login: 'someone-else' },
|
|
body: 'unrelated',
|
|
}));
|
|
}
|
|
if (path.endsWith('page=2')) {
|
|
return [{
|
|
id: 200,
|
|
user: { login: 'commitperclip[bot]' },
|
|
body: 'Looks good.\n\n— commitperclip',
|
|
}];
|
|
}
|
|
return [];
|
|
}, 'token', 'paperclipai/paperclip', 6469);
|
|
|
|
assert.equal(comment.id, 200);
|
|
assert.deepEqual(seenPaths, [
|
|
'/repos/paperclipai/paperclip/issues/6469/comments?per_page=100&page=1',
|
|
'/repos/paperclipai/paperclip/issues/6469/comments?per_page=100&page=2',
|
|
]);
|
|
});
|
|
|
|
test('findExistingComment: returns null when no signed comment exists', async () => {
|
|
const comment = await findExistingComment(async () => ([
|
|
{
|
|
id: 1,
|
|
user: { login: 'commitperclip[bot]' },
|
|
body: 'Unsigned status update',
|
|
},
|
|
]), 'token', 'paperclipai/paperclip', 6469);
|
|
|
|
assert.equal(comment, null);
|
|
});
|