Skip to content

Commit d85b700

Browse files
committed
test(runtime): sign the cube-door route pin's caller in
The analytics dispatcher faces now refuse an anonymous caller with 401 before the analytics service is reached (ADR-0056 D2), so the route pin stubs the `auth` slot the way the sibling analytics route pins do. The route, the service and the engine stay real. Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H Co-authored-by: Claude <noreply@anthropic.com>
1 parent 08e9894 commit d85b700

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/runtime/src/analytics-cube-measure-field-type-door.test.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ const quiet = { debug() {}, info() {}, warn() {}, error() {}, child() { return q
8686

8787
// ── harness (the shape `analytics-authored-cube-format-granularity.test.ts` uses) ──
8888

89+
// The analytics domain refuses an anonymous caller first (ADR-0056 D2), so this
90+
// harness signs its caller in the way that file does: an `auth` slot in the
91+
// shape `resolveExecutionContext` reads answers a session for every request.
92+
// Only identity is stubbed; the route, the service and the engine are real.
93+
const SIGNED_IN_AUTH = { api: { getSession: async () => ({ user: { id: 'usr_analytics_caller' } }) } };
94+
8995
type Handler = (req: unknown, res: unknown) => unknown;
9096

9197
function makeFakeServer() {
@@ -101,8 +107,8 @@ function makeFakeServer() {
101107

102108
function makeCtx(fakeServer: unknown, analytics: unknown) {
103109
const kernel = {
104-
getService: (name: string) => (name === 'analytics' ? analytics : undefined),
105-
getServiceAsync: async (name: string) => (name === 'analytics' ? analytics : undefined),
110+
getService: (name: string) => (name === 'analytics' ? analytics : name === 'auth' ? SIGNED_IN_AUTH : undefined),
111+
getServiceAsync: async (name: string) => (name === 'analytics' ? analytics : name === 'auth' ? SIGNED_IN_AUTH : undefined),
106112
};
107113
return {
108114
getKernel: () => kernel,

0 commit comments

Comments
 (0)