test(skill): cover receipt cascade deletion boundaries
This commit is contained in:
@@ -40,6 +40,10 @@ const ids = {
|
||||
cascadeCase: "11111111-1111-4111-8111-111111111113",
|
||||
cascadeTurn: "33333333-3333-4333-8333-333333333335",
|
||||
cascadeRequest: "44444444-4444-4444-8444-444444444445",
|
||||
caseDeleteSession: "22222222-2222-4222-8222-222222222225",
|
||||
caseDeleteCase: "11111111-1111-4111-8111-111111111114",
|
||||
caseDeleteTurn: "33333333-3333-4333-8333-333333333336",
|
||||
caseDeleteRequest: "44444444-4444-4444-8444-444444444446",
|
||||
};
|
||||
const oldHash = "a".repeat(64);
|
||||
const newHash = "b".repeat(64);
|
||||
@@ -487,6 +491,10 @@ test("immutable Skill migration enforces RPC-only identity, legacy adoption, and
|
||||
`delete from public.agentic_rectification_skill_run_receipts where case_id = ${sqlLiteral(openedCaseId)};`,
|
||||
/agentic_rectification_skill_receipts_are_append_only/,
|
||||
);
|
||||
expectOwnerError(
|
||||
`delete from public.agentic_rectification_skill_upgrade_receipts where case_id = ${sqlLiteral(ids.legacyCase)};`,
|
||||
/agentic_rectification_skill_receipts_are_append_only/,
|
||||
);
|
||||
expectOwnerError(
|
||||
`truncate table public.agentic_rectification_skill_upgrade_receipts;`,
|
||||
/agentic_rectification_skill_receipts_are_append_only/,
|
||||
@@ -495,6 +503,34 @@ test("immutable Skill migration enforces RPC-only identity, legacy adoption, and
|
||||
`truncate table public.agentic_rectification_skill_run_receipts;`,
|
||||
/agentic_rectification_skill_receipts_are_append_only/,
|
||||
);
|
||||
expectOwnerError(
|
||||
`truncate table public.agentic_rectification_cases cascade;`,
|
||||
/agentic_rectification_skill_receipts_are_append_only/,
|
||||
);
|
||||
|
||||
insertSession(ids.caseDeleteSession, ids.user);
|
||||
insertCase({
|
||||
id: ids.caseDeleteCase,
|
||||
userId: ids.user,
|
||||
sessionId: ids.caseDeleteSession,
|
||||
hash: oldHash,
|
||||
});
|
||||
fixture.psql(`insert into public.agentic_rectification_turns (id, case_id, user_message, status, model_name)
|
||||
values (${sqlLiteral(ids.caseDeleteTurn)}, ${sqlLiteral(ids.caseDeleteCase)}, 'case cascade user', 'pending', 'fixture-model');`);
|
||||
serviceSql(`select public.insert_agentic_rectification_skill_run_receipt(
|
||||
${sqlLiteral(ids.user)}::uuid, ${sqlLiteral(ids.caseDeleteCase)}::uuid,
|
||||
${sqlLiteral(ids.caseDeleteTurn)}::uuid, ${sqlLiteral(ids.caseDeleteRequest)}::uuid,
|
||||
'turn', 'jyotish-birth-time-rectification', '9.0.0', ${sqlLiteral(oldHash)}, ${sqlLiteral(sourceCommit)}
|
||||
);`);
|
||||
fixture.psql(`delete from public.agentic_rectification_cases where id = ${sqlLiteral(ids.caseDeleteCase)};`);
|
||||
assert.equal(
|
||||
fixture.psql(`select concat_ws(':',
|
||||
(select count(*) from public.agentic_rectification_cases where id = ${sqlLiteral(ids.caseDeleteCase)}),
|
||||
(select count(*) from public.agentic_rectification_turns where id = ${sqlLiteral(ids.caseDeleteTurn)}),
|
||||
(select count(*) from public.agentic_rectification_skill_run_receipts where case_id = ${sqlLiteral(ids.caseDeleteCase)})
|
||||
)`),
|
||||
'0:0:0',
|
||||
);
|
||||
|
||||
fixture.psql(`delete from public.agentic_rectification_turns where id = ${sqlLiteral(ids.verifiedTurn)};`);
|
||||
assert.equal(
|
||||
|
||||
Reference in New Issue
Block a user