mirror of
https://github.com/sortedcord/omnia.git
synced 2026-07-21 19:42:48 +05:30
fix(tests): Incorporate TimeDeltaGenerator short-circuit for tests
This commit is contained in:
5
.codegraph/.gitignore
vendored
Normal file
5
.codegraph/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# CodeGraph data files — local to each machine, not for committing.
|
||||
# Ignore everything in .codegraph/ except this file itself, so transient
|
||||
# files (the database, daemon.pid, sockets, logs) never show up in git.
|
||||
*
|
||||
!.gitignore
|
||||
2
apps/gui/next-env.d.ts
vendored
2
apps/gui/next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@@ -239,7 +239,7 @@ ${candidatesList}
|
||||
}
|
||||
|
||||
const result = response.data;
|
||||
const db = (this.bufferRepo as unknown as { db: Record<string, unknown> }).db;
|
||||
const db = (this.bufferRepo as unknown as { db: { transaction: (fn: () => void) => void } }).db;
|
||||
|
||||
const ledgerEntries: LedgerEntry[] = [];
|
||||
for (const chunk of result.chunks) {
|
||||
|
||||
@@ -186,7 +186,7 @@ export class LedgerRepository {
|
||||
|
||||
if (rows.length === 0) return [];
|
||||
|
||||
const entryIds = rows.map((r) => r.id);
|
||||
const entryIds = rows.map((r) => r.id as string);
|
||||
const placeholders = entryIds.map(() => "?").join(",");
|
||||
const entitiesRows = this.db
|
||||
.prepare(
|
||||
@@ -205,7 +205,7 @@ export class LedgerRepository {
|
||||
entitiesMap.get(er.entry_id)!.push(er.entity_id);
|
||||
}
|
||||
|
||||
return rows.map((row) => this.mapRowToEntry(row, entitiesMap.get(row.id) || []));
|
||||
return rows.map((row) => this.mapRowToEntry(row, entitiesMap.get(row.id as string) || []));
|
||||
}
|
||||
|
||||
private fetchRawNeighbors(ownerId: string, timestamp: string): LedgerEntry[] {
|
||||
|
||||
@@ -88,10 +88,9 @@ describe("Actor Agent + Monologue Intent Integration (Tier 2)", () => {
|
||||
],
|
||||
};
|
||||
|
||||
// 3. Architect: dialogue is always valid (0 min), action is valid (2 min).
|
||||
// 3. Architect: dialogue is always valid (1 min), action is valid (2 min).
|
||||
// NOTE: monologue never reaches the validator/delta generator.
|
||||
const mockDialogueValidation = { isValid: true, reason: "Alice can speak." };
|
||||
const mockDialogueTimeDelta = { minutesToAdvance: 0, explanation: "Speech is instantaneous." };
|
||||
const mockActionValidation = { isValid: true, reason: "The ledger is within reach." };
|
||||
const mockActionTimeDelta = { minutesToAdvance: 2, explanation: "Reaching for the ledger takes 2 minutes." };
|
||||
|
||||
@@ -99,9 +98,8 @@ describe("Actor Agent + Monologue Intent Integration (Tier 2)", () => {
|
||||
mockActorProse, // 1. Actor generation
|
||||
mockDecodedSequence, // 2. IntentDecoder
|
||||
mockDialogueValidation, // 3. Architect.validateIntent (dialogue)
|
||||
mockDialogueTimeDelta, // 4. TimeDeltaGenerator (dialogue)
|
||||
mockActionValidation, // 5. Architect.validateIntent (action)
|
||||
mockActionTimeDelta, // 6. TimeDeltaGenerator (action)
|
||||
mockActionValidation, // 4. Architect.validateIntent (action)
|
||||
mockActionTimeDelta, // 5. TimeDeltaGenerator (action)
|
||||
]);
|
||||
|
||||
const actor = new ActorAgent(llmProvider, bufferRepo);
|
||||
@@ -143,7 +141,7 @@ describe("Actor Agent + Monologue Intent Integration (Tier 2)", () => {
|
||||
expect(intents[0].type).toBe("monologue");
|
||||
expect(writtenEntries[0].outcome).toBeUndefined();
|
||||
|
||||
// 4. Dialogue: valid, 0-minute delta, no outcome field.
|
||||
// 4. Dialogue: valid, 1-minute delta, no outcome field.
|
||||
expect(writtenEntries[1].outcome).toBeUndefined();
|
||||
|
||||
// 5. Action: valid, 2-minute delta, outcome attached.
|
||||
@@ -152,8 +150,8 @@ describe("Actor Agent + Monologue Intent Integration (Tier 2)", () => {
|
||||
reason: "The ledger is within reach.",
|
||||
});
|
||||
|
||||
// 6. Clock advanced by exactly 2 minutes (dialogue 0 + action 2).
|
||||
const expectedTime = new Date(startTime.getTime() + 2 * 60_000);
|
||||
// 6. Clock advanced by exactly 3 minutes (dialogue 1 + action 2).
|
||||
const expectedTime = new Date(startTime.getTime() + 3 * 60_000);
|
||||
expect(world.clock.get().toISOString()).toBe(expectedTime.toISOString());
|
||||
|
||||
// 7. All three intents persisted to Alice's memory buffer.
|
||||
|
||||
@@ -52,7 +52,6 @@ describe("Omnia Integration Tests (Tier 2)", () => {
|
||||
|
||||
// 2. Architect validation & delta generation responses
|
||||
const mockDialogueValidation = { isValid: true, reason: "Alice is able to speak to Bob." };
|
||||
const mockDialogueTimeDelta = { minutesToAdvance: 0, explanation: "Dialogue is instantaneous." };
|
||||
|
||||
const mockActionValidation = { isValid: true, reason: "The door is unlocked and reachable." };
|
||||
const mockActionTimeDelta = { minutesToAdvance: 3, explanation: "Creeping silently and opening a door takes 3 minutes." };
|
||||
@@ -60,7 +59,6 @@ describe("Omnia Integration Tests (Tier 2)", () => {
|
||||
const llmProvider = new MockLLMProvider([
|
||||
mockIntentSequence, // Used by IntentDecoder
|
||||
mockDialogueValidation, // Used by Architect.validateIntent (Dialogue)
|
||||
mockDialogueTimeDelta, // Used by TimeDeltaGenerator (Dialogue)
|
||||
mockActionValidation, // Used by Architect.validateIntent (Action)
|
||||
mockActionTimeDelta // Used by TimeDeltaGenerator (Action)
|
||||
]);
|
||||
@@ -77,7 +75,7 @@ describe("Omnia Integration Tests (Tier 2)", () => {
|
||||
// 2. Process first intent (dialogue)
|
||||
const result1 = await architect.processIntent(world, decodedSequence.intents[0]);
|
||||
expect(result1.isValid).toBe(true);
|
||||
expect(result1.timeDelta!.minutesToAdvance).toBe(0);
|
||||
expect(result1.timeDelta!.minutesToAdvance).toBe(1);
|
||||
|
||||
// 3. Process second intent (action)
|
||||
const result2 = await architect.processIntent(world, decodedSequence.intents[1]);
|
||||
@@ -85,7 +83,7 @@ describe("Omnia Integration Tests (Tier 2)", () => {
|
||||
expect(result2.timeDelta!.minutesToAdvance).toBe(3);
|
||||
|
||||
// 4. Verify local state clock advanced by the time deltas
|
||||
const expectedTime = new Date(startTime.getTime() + 3 * 60_000); // 3 minutes total
|
||||
const expectedTime = new Date(startTime.getTime() + 4 * 60_000); // 4 minutes total (dialogue 1 + action 3)
|
||||
expect(world.clock.get().toISOString()).toBe(expectedTime.toISOString());
|
||||
|
||||
// 5. Verify database state clock was advanced and persisted
|
||||
@@ -133,12 +131,10 @@ describe("Omnia Integration Tests (Tier 2)", () => {
|
||||
const mockActionValidation = { isValid: false, reason: "Hairpins cannot pick high-security locks." };
|
||||
// For intent2 (dialogue):
|
||||
const mockDialogueValidation = { isValid: true, reason: "Alice is free to talk." };
|
||||
const mockDialogueTimeDelta = { minutesToAdvance: 1, explanation: "Speaking takes 1 minute." };
|
||||
|
||||
const llmProvider = new MockLLMProvider([
|
||||
mockActionValidation, // Used by Architect.validateIntent (Action)
|
||||
mockDialogueValidation, // Used by Architect.validateIntent (Dialogue)
|
||||
mockDialogueTimeDelta // Used by TimeDeltaGenerator (Dialogue)
|
||||
]);
|
||||
|
||||
const architect = new Architect(llmProvider, repo);
|
||||
|
||||
Reference in New Issue
Block a user