Skip to content

Commit 4b33d80

Browse files
committed
test(fleet-write): a read-back battery that reports, never throws, when the read-back is gone
Claude-Session: https://claude.ai/code/session_01KTZmMfzVzjNvyaLyQ8mHvg Co-authored-by: Claude <noreply@anthropic.com>
1 parent 82b9d5d commit 4b33d80

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎scripts/pm/fleet-write/dispatch.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,19 +1384,19 @@ export async function selfTest() {
13841384
t('comment_edit: read at its address; a split character is NOT STORED, exit 4', [edit.state, edit.notStored, exitForResult(edit)], ['failure', true, EXIT_NOT_STORED]);
13851385
const CMTS = 'GET /repos/objectstack-ai/objectstack/issues/19701/comments';
13861386
const two = await drive({ ...OK_RUN, store: { [CMTS]: { status: 200, json: [{ id: 601, created_at: at(5_000), body: B }, { id: 602, created_at: at(6_000), body: B }] } } }, { stroke: strokeOf([{ op: 'comment', issue: 19701, body: B }, { op: 'comment', issue: 19701, body: B }]) });
1387-
t('comment: found by its content among those created since the dispatch; two identical comments match two DIFFERENT stored ones', [two.state, two.readBack.rows.map((r) => r.where)], ['success', ['objectstack-ai/objectstack#19701 comment 602', 'objectstack-ai/objectstack#19701 comment 601']]);
1387+
t('comment: found by its content among those created since the dispatch; two identical comments match two DIFFERENT stored ones', [two.state, two.readBack?.rows?.map((r) => r.where)], ['success', ['objectstack-ai/objectstack#19701 comment 602', 'objectstack-ai/objectstack#19701 comment 601']]);
13881388
const lost = await drive({ ...OK_RUN, store: { [CMTS]: { status: 200, json: [{ id: 603, created_at: at(5_000), body: SPLIT }] } } }, { stroke: strokeOf([{ op: 'comment', issue: 19701, body: B }]) });
1389-
t("⛔ a comment only its content can find is UNVERIFIED when nothing matches — exit 6, never not-stored — the one candidate's first difference named as a LEAD", [lost.state, exitForResult(lost), lost.readBack.rows[0].why.includes(`first differs at byte ${AT}`), lost.readBack.rows[0].why.includes('U+FFFD')], ['unverified', EXIT_UNCONFIRMED, true, true]);
1389+
t("⛔ a comment only its content can find is UNVERIFIED when nothing matches — exit 6, never not-stored — the one candidate's first difference named as a LEAD", [lost.state, exitForResult(lost), lost.readBack?.rows?.[0]?.why?.includes(`first differs at byte ${AT}`) ?? false, lost.readBack?.rows?.[0]?.why?.includes('U+FFFD') ?? false], ['unverified', EXIT_UNCONFIRMED, true, true]);
13901390
const stale = await drive({ ...OK_RUN, store: { [CMTS]: { status: 200, json: [{ id: 604, created_at: at(-120_000), body: B }] } } }, { stroke: strokeOf([{ op: 'comment', issue: 19701, body: B }]) });
13911391
t('…and a comment created BEFORE the dispatch (outside the slack) is never taken for this write', [stale.state, exitForResult(stale)], ['unverified', EXIT_UNCONFIRMED]);
13921392
const ISSUES = 'GET /repos/objectstack-ai/objectstack/issues';
13931393
const created = await drive({ ...OK_RUN, store: { [ISSUES]: { status: 200, json: [{ id: 9, number: 20999, title: 'Other', created_at: at(4_000), body: B }, { id: 8, number: 20998, title: 'Card', created_at: at(3_000), body: SPLIT }] } } }, { stroke: strokeOf([{ op: 'issue_create', title: 'Card', body: B }]) });
1394-
t('issue_create: the new issue found by the title sent and its body judged — a split character is NOT STORED on THAT issue, exit 4', [created.state, created.notStored, created.readBack.rows[0].where, exitForResult(created)], ['failure', true, 'objectstack-ai/objectstack#20998', EXIT_NOT_STORED]);
1394+
t('issue_create: the new issue found by the title sent and its body judged — a split character is NOT STORED on THAT issue, exit 4', [created.state, created.notStored, created.readBack?.rows?.[0]?.where, exitForResult(created)], ['failure', true, 'objectstack-ai/objectstack#20998', EXIT_NOT_STORED]);
13951395
const PULLS = 'GET /repos/objectstack-ai/objectstack/pulls';
13961396
const PR_TAIL = '\n\n---\n_Generated by [Claude Code](https://claude.ai/code/session_01KTZmMfzVzjNvyaLyQ8mHvg)_';
13971397
const prStroke = strokeOf([{ op: 'pr_create', title: 'T', head: 'claude/issue-1-x', base: 'main', body: B }]);
13981398
const pr = await drive({ ...OK_RUN, store: { [PULLS]: (q) => ({ status: 200, json: q.get('head') === 'objectstack-ai:claude/issue-1-x' ? [{ id: 31, number: 20600, created_at: at(4_000), body: `${B.replace(/\n+$/u, '')}${PR_TAIL}` }] : [] }) } }, { stroke: prStroke });
1399-
t("pr_create: found by owner:head; the platform's session-URL footer after every byte sent is success", [pr.state, pr.readBack.rows[0].cls, pr.readBack.rows[0].where], ['success', 'pr-create-footer-appended', 'objectstack-ai/objectstack#20600']);
1399+
t("pr_create: found by owner:head; the platform's session-URL footer after every byte sent is success", [pr.state, pr.readBack?.rows?.[0]?.cls, pr.readBack?.rows?.[0]?.where], ['success', 'pr-create-footer-appended', 'objectstack-ai/objectstack#20600']);
14001400
const noPr = await drive({ ...OK_RUN, store: { [PULLS]: { status: 200, json: [] } } }, { stroke: prStroke });
14011401
t('…and a pull the head does not find is unverified, exit 6', [noPr.state, exitForResult(noPr)], ['unverified', EXIT_UNCONFIRMED]);
14021402
const labels = await drive(OK_RUN, { stroke: strokeOf([{ op: 'labels_add', issue: 1, labels: ['a'] }]) });

0 commit comments

Comments
 (0)