mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 08:22:20 +02:00
test(runner-e2e): reject coerced observation clock fields
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
eecd64509a
commit
8040aa903c
2 files changed
+3
-1
No files matched your search
@@ -238,6 +238,7 @@ export function validCopilotDenialSettlement(s: CopilotDenialSettlement): boolea
|
||||
|| before.companyId !== c.companyId || before.normalizedSessionId !== t.normalizedSessionId || before.sourceInstanceId !== t.sourceInstanceId
|
||||
|| before.failedToolSourceSeq !== t.failedToolSourceSeq || before.failedToolRowSha256 !== t.failedToolRowSha256
|
||||
|| ![t.rowSha256, t.failedToolRowSha256].every(v => /^sha256:[a-f0-9]{64}$/u.test(v))
|
||||
|| typeof before.apiReadCompletedMonotonicNs !== "string" || typeof s.stopDispatchMonotonicNs !== "string"
|
||||
|| !/^[1-9][0-9]{0,29}$/u.test(before.apiReadCompletedMonotonicNs) || !/^[1-9][0-9]{0,29}$/u.test(s.stopDispatchMonotonicNs)
|
||||
|| BigInt(before.apiReadCompletedMonotonicNs) >= BigInt(s.stopDispatchMonotonicNs)) return false;
|
||||
if (before.terminal !== null && (!before.terminal || before.terminal.eventType !== t.eventType || before.terminal.sourceSeq !== t.sourceSeq || before.terminal.rowSha256 !== t.rowSha256)) return false;
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("Copilot denial provider settlement and separate audited run Stop", ()
|
||||
const f = fixture(); f.preStop.terminal = null; f.events[4]!.createdAt = date(800);
|
||||
expect(() => readCopilotDenialSettlement(f)).toThrow(/settlement/);
|
||||
});
|
||||
it.each(["missing", "foreign", "hash", "sequence", "equal-clock", "reverse-clock"])("rejects %s pre-dispatch observation", kind => {
|
||||
it.each(["missing", "foreign", "hash", "sequence", "equal-clock", "reverse-clock", "non-string-clock"])("rejects %s pre-dispatch observation", kind => {
|
||||
const f = fixture();
|
||||
if (kind === "missing") (f as any).preStop = null;
|
||||
if (kind === "foreign") f.preStop.runId = "foreign";
|
||||
@@ -70,6 +70,7 @@ describe("Copilot denial provider settlement and separate audited run Stop", ()
|
||||
if (kind === "sequence") f.preStop.terminal!.sourceSeq++;
|
||||
if (kind === "equal-clock") f.stopDispatchMonotonicNs = f.preStop.apiReadCompletedMonotonicNs;
|
||||
if (kind === "reverse-clock") f.stopDispatchMonotonicNs = "1";
|
||||
if (kind === "non-string-clock") (f.preStop as any).apiReadCompletedMonotonicNs = ["1"];
|
||||
expect(() => readCopilotDenialSettlement(f)).toThrow(/settlement/);
|
||||
});
|
||||
it.each(["runId", "turnId", "normalizedSessionId", "sourceInstanceId", "eventType", "sourceEventId"])("rejects terminal %s mismatch", field => {
|
||||
|
||||
Reference in new issue
Block a user