814c924e4a
Keep askable cards after exhaustion, explain each probe, read the adopted credible range in reports and chat, and compare declared periods before the minute grid when the clock is unknown. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const migration = readFileSync(
|
|
new URL("../supabase/migrations/20260906020000_adopted_credible_range.sql", import.meta.url),
|
|
"utf8",
|
|
);
|
|
|
|
test("accept RPC gains an optional credible-range argument and never rewrites the opening window", () => {
|
|
assert.match(migration, /add column if not exists adopted_credible_range jsonb/);
|
|
assert.match(
|
|
migration,
|
|
/drop function if exists public\.accept_agentic_rectification_candidate_for_case_v2\(uuid, uuid, uuid, uuid, uuid\);/,
|
|
);
|
|
assert.match(
|
|
migration,
|
|
/create or replace function public\.accept_agentic_rectification_candidate_for_case_v2\(\s*p_user_id uuid,\s*p_case_id uuid,\s*p_result_id uuid,\s*p_candidate_id uuid,\s*p_request_id uuid,\s*p_credible_range jsonb default null/,
|
|
);
|
|
assert.match(migration, /adopted_credible_range = coalesce\(v_adopted, adopted_credible_range\)/);
|
|
assert.doesNotMatch(migration, /candidate_range\s*=\s*v_adopted/);
|
|
assert.match(
|
|
migration,
|
|
/grant execute on function public\.accept_agentic_rectification_candidate_for_case_v2\(uuid, uuid, uuid, uuid, uuid, jsonb\)\s+to service_role/,
|
|
);
|
|
});
|
|
|
|
test("read_report_candidate_range prefers adopted_credible_range then the opening window", () => {
|
|
assert.match(migration, /when c\.adopted_credible_range is not null/);
|
|
assert.match(migration, /then c\.adopted_credible_range/);
|
|
assert.match(migration, /else c\.candidate_range/);
|
|
assert.match(migration, /jsonb_build_object\('start_time', v_start, 'end_time', v_end\)/);
|
|
assert.match(
|
|
migration,
|
|
/grant execute on function public\.read_report_candidate_range\(uuid, uuid\)\s+to service_role/,
|
|
);
|
|
});
|