test(db): real PostgreSQL read of an adopted segment's chart tiers via the service client (BUG-1138/1139)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eEAG8HD3mm8gsKXgk8uU8
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2004a6edc1
commit
f8b4f46d0d
@@ -5,6 +5,7 @@ import { fileURLToPath } from "node:url";
|
||||
import test from "node:test";
|
||||
import { closeLocalPostgresDataPool, createLocalPostgresDataClient } from "../src/lib/db/local-postgres-client-core.ts";
|
||||
import { buildInferenceState } from "../src/lib/rectification-agentic/core/build-state.ts";
|
||||
import { clearAdoptedChartTierCache, loadAdoptedChartTiers } from "../src/lib/rectification-adopted-chart-tiers.ts";
|
||||
import { startPostgresFixture } from "./helpers/postgres-fixture.ts";
|
||||
|
||||
const docker = spawnSync("docker", ["version"], { stdio: "ignore" }).status === 0;
|
||||
@@ -93,6 +94,14 @@ test(`segment adoption persists a noncandidate midnight minute atomically withou
|
||||
p_user_id: randomUUID(), p_case_id: caseId, p_result_id: row.result_id,
|
||||
});
|
||||
assert.equal(wrongOwnerIdentity.data, null);
|
||||
// BUG-1138/1139: reports and chat read this adoption's chart tiers through the
|
||||
// service client: profile provenance (column grant) + case dossier RPC.
|
||||
const provenanceRow = await service.from("profiles").select("active_birth_provenance").eq("id", userId).maybeSingle();
|
||||
assert.equal(provenanceRow.error, null);
|
||||
clearAdoptedChartTierCache();
|
||||
assert.deepEqual(await loadAdoptedChartTiers(service, {
|
||||
userId, provenance: (provenanceRow.data as Record<string, unknown>).active_birth_provenance,
|
||||
}, () => assert.fail("tier read must not warn")), { source: "segment-v1", resultMatch: "adopted", unreliable: [] });
|
||||
assert.equal(fixture.psql(`select birth_time || ':' || active_birth_time || ':' || active_birth_date || ':' ||
|
||||
(active_birth_provenance->>'candidate_time') || ':' || (active_birth_provenance->>'candidate_date') from public.profiles where id='${userId}'`), "00:10:00:00:10:00:2000-06-15:00:10:2000-06-15");
|
||||
assert.equal(fixture.psql(`select selected_time || ':' || representative_time from public.agentic_rectification_results where id='${row.result_id}'`), "00:10:00:23:55:00");
|
||||
|
||||
Reference in New Issue
Block a user