Skip to content

Commit 1553e53

Browse files
committed
fix(ci): resolve typecheck and test failures
- Add missing @engram/{common,graph,logger} dependencies to @engram/temporal - Fix expectToReject type signature in @engram/testing to accept built-in Error constructors - Update rehydrator tests to use object format for query results (blobRef/snapshotAt) - Fix QueryBuilder test expectation for queries without match clause - Update observatory tests for parameterized LIMIT clause (limit_0)
1 parent 578c322 commit 1553e53

10 files changed

Lines changed: 27 additions & 18 deletions

File tree

apps/memory/src/turn-aggregator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { Mock } from "bun:test";
22
import { beforeEach, describe, expect, it, mock } from "bun:test";
3-
import { createTestGraphClient, createTestLogger } from "@engram/testing";
43
import type { ParsedStreamEvent } from "@engram/events";
54
import type { GraphClient } from "@engram/storage";
5+
import { createTestGraphClient, createTestLogger } from "@engram/testing";
66
import type { EventHandler, EventHandlerRegistry, HandlerContext, HandlerResult } from "./handlers";
77
import {
88
type NodeCreatedCallback,

apps/observatory/lib/graph-queries.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,8 +1831,8 @@ describeOrSkip("graph-queries", () => {
18311831
// Act
18321832
await getSessionsForWebSocket();
18331833

1834-
// Assert
1835-
expect(mockQuery).toHaveBeenCalledWith(expect.stringContaining("LIMIT"), { limit: 50 });
1834+
// Assert - QueryBuilder uses parameterized limits with suffix
1835+
expect(mockQuery).toHaveBeenCalledWith(expect.stringContaining("LIMIT"), { limit_0: 50 });
18361836
});
18371837

18381838
it("should respect custom limit", async () => {
@@ -1842,8 +1842,8 @@ describeOrSkip("graph-queries", () => {
18421842
// Act
18431843
await getSessionsForWebSocket(25);
18441844

1845-
// Assert
1846-
expect(mockQuery).toHaveBeenCalledWith(expect.stringContaining("LIMIT"), { limit: 25 });
1845+
// Assert - QueryBuilder uses parameterized limits with suffix
1846+
expect(mockQuery).toHaveBeenCalledWith(expect.stringContaining("LIMIT"), { limit_0: 25 });
18471847
});
18481848

18491849
it("should use lastEventAt from row when session has no last_event_at", async () => {

bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/graph/src/queries/builder.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ describe("QueryBuilder", () => {
132132
const qb = new QueryBuilder();
133133
const { cypher } = qb.return("1").build();
134134

135-
expect(cypher).toBe("MATCH RETURN 1");
135+
// QueryBuilder now omits empty MATCH clauses
136+
expect(cypher).toBe("RETURN 1");
136137
});
137138
});

packages/storage/tests/integration/blob.integration.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
* Run with: RUN_INTEGRATION_TESTS=1 bun test packages/storage/tests/integration/blob.integration.spec.ts
88
*/
99

10+
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
1011
import * as fs from "node:fs/promises";
1112
import * as path from "node:path";
12-
import { afterAll, beforeAll, describe, expect, it } from "bun:test";
13-
import { FileSystemBlobStore, GCSBlobStore, createBlobStore } from "../../src/blob";
13+
import { createBlobStore, FileSystemBlobStore, GCSBlobStore } from "../../src/blob";
1414
import { shouldRunIntegrationTests } from "./fixtures";
1515

1616
// Skip all tests if integration tests are not enabled

packages/storage/tests/integration/fixtures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* Supports both testcontainers (CI) and existing dev containers (local dev).
66
*/
77

8-
import { FalkorDB, type Graph } from "falkordb";
9-
import { connect, type NatsConnection } from "@nats-io/transport-node";
108
import { jetstream, jetstreamManager } from "@nats-io/jetstream";
11-
import { GenericContainer, type StartedTestContainer, Wait } from "testcontainers";
9+
import { connect, type NatsConnection } from "@nats-io/transport-node";
10+
import { FalkorDB, type Graph } from "falkordb";
1211
import pg from "pg";
12+
import { GenericContainer, type StartedTestContainer, Wait } from "testcontainers";
1313

1414
// Container instances (session-scoped)
1515
let falkordbContainer: StartedTestContainer | null = null;

packages/storage/tests/integration/nats.integration.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import { afterAll, afterEach, beforeAll, describe, expect, it } from "bun:test";
99
import {
10-
NatsClient,
1110
createNatsPubSubPublisher,
1211
createNatsPubSubSubscriber,
12+
NatsClient,
1313
type SessionUpdate,
1414
} from "../../src/nats";
1515
import {

packages/temporal/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
},
1212
"dependencies": {
1313
"zod": "4.2.1",
14+
"@engram/common": "*",
15+
"@engram/graph": "*",
16+
"@engram/logger": "*",
1417
"@engram/storage": "*",
1518
"@engram/vfs": "*"
1619
},

packages/temporal/src/rehydrator.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("Rehydrator", () => {
5353
});
5454

5555
it("should attempt to load snapshot if found", async () => {
56-
const mockSnapshot = ["blob-ref-123", 1000];
56+
const mockSnapshot = { blobRef: "blob-ref-123", snapshotAt: 1000 };
5757
// First call: snapshot found, second call: no diffs
5858
mockFalkorQuery.mockResolvedValueOnce([mockSnapshot]).mockResolvedValueOnce([]);
5959
mockBlobStore.load.mockResolvedValueOnce(
@@ -92,7 +92,7 @@ describe("Rehydrator", () => {
9292
});
9393

9494
it("should pass lastSnapshotTime to diff query", async () => {
95-
const mockSnapshot = ["blob-ref-123", 5000];
95+
const mockSnapshot = { blobRef: "blob-ref-123", snapshotAt: 5000 };
9696
mockFalkorQuery.mockResolvedValueOnce([mockSnapshot]).mockResolvedValueOnce([]);
9797
mockBlobStore.load.mockResolvedValueOnce(
9898
JSON.stringify({ root: { name: "", type: "directory", children: {} } }),
@@ -108,7 +108,7 @@ describe("Rehydrator", () => {
108108
});
109109

110110
it("should handle snapshot loading with JSON fallback when gzip fails", async () => {
111-
const mockSnapshot = ["blob-ref-json", 1000];
111+
const mockSnapshot = { blobRef: "blob-ref-json", snapshotAt: 1000 };
112112
mockFalkorQuery.mockResolvedValueOnce([mockSnapshot]).mockResolvedValueOnce([]);
113113

114114
const jsonContent = JSON.stringify({
@@ -121,7 +121,7 @@ describe("Rehydrator", () => {
121121
});
122122

123123
it("should throw RehydrationError when both gzip and JSON parsing fail", async () => {
124-
const mockSnapshot = ["blob-ref-invalid", 1000];
124+
const mockSnapshot = { blobRef: "blob-ref-invalid", snapshotAt: 1000 };
125125
mockFalkorQuery.mockResolvedValueOnce([mockSnapshot]).mockResolvedValueOnce([]);
126126

127127
mockBlobStore.load.mockResolvedValueOnce("invalid data that is neither gzip nor JSON");
@@ -265,7 +265,7 @@ describe("Rehydrator", () => {
265265
});
266266

267267
it("should handle non-Error exception when JSON parsing fails", async () => {
268-
const mockSnapshot = ["blob-ref-invalid", 1000];
268+
const mockSnapshot = { blobRef: "blob-ref-invalid", snapshotAt: 1000 };
269269
mockFalkorQuery.mockResolvedValueOnce([mockSnapshot]).mockResolvedValueOnce([]);
270270

271271
// Mock JSON.parse to throw a non-Error value

packages/testing/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { mock } from "bun:test";
3737

3838
// Simplified Mock type alias for common use cases
3939
type Mock = BunMock<(...args: unknown[]) => unknown>;
40+
4041
import type {
4142
FileTouchNode,
4243
ObservationNode,
@@ -512,7 +513,8 @@ class PromiseResolvedError extends Error {
512513
*/
513514
export async function expectToReject<E extends Error>(
514515
promise: Promise<unknown>,
515-
errorType: new (...args: unknown[]) => E,
516+
// biome-ignore lint/suspicious/noExplicitAny: Constructor types need any[] for variance compatibility with built-in error constructors
517+
errorType: new (...args: any[]) => E,
516518
messageMatch?: string | RegExp,
517519
): Promise<E> {
518520
try {

0 commit comments

Comments
 (0)