Merge pull request #6 from jesse-ux/codex/fix-dynamic-rectification-token

fix: restore dynamic birth-time questions in production
This commit is contained in:
jesse-ux
2026-07-20 01:54:45 +08:00
committed by GitHub
4 changed files with 32 additions and 1 deletions
@@ -9,6 +9,7 @@ import {
eventScorePayload,
} from "../src/lib/birth-time-journey-engine-model.ts";
import type { JourneyEngineFetch } from "../src/lib/birth-time-journey-engine-model.ts";
import { resolveDynamicRectificationToken } from "../src/lib/birth-time-dynamic-token.ts";
test("journey engine serializes only stored event-scoring inputs", () => {
const payload = eventScorePayload({
@@ -191,6 +192,12 @@ test("missing dynamic token fails both endpoints before fetch", async () => {
assert.equal(harness.calls.length, 0);
});
test("dynamic token derives only from a server-side service role fallback", () => {
assert.equal(resolveDynamicRectificationToken("configured-token", "service-role"), "configured-token");
assert.match(resolveDynamicRectificationToken(undefined, "service-role") ?? "", /^[a-f0-9]{64}$/);
assert.equal(resolveDynamicRectificationToken(undefined, undefined), null);
});
test("legacy wire calls never receive dynamic authorization", async () => {
const calls: { readonly path: string; readonly init: RequestInit }[] = [];
const engine = createJourneyEngineMethods(createJourneyEngineWire({