Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/cala/e2e/phase5-exit.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ class StubPreprocessor {
// the shape and magnitude of the data W2 and W4 see.
return input;
}
processFrameF32WithStages(input: Float32Array): Float32Array {
// Identity 3-stage: final || hotPixel || motion all echo input.
const out = new Float32Array(input.length * 3);
out.set(input, 0);
out.set(input, input.length);
out.set(input, input.length * 2);
return out;
}
free(): void {
// noop
}
Expand All @@ -252,6 +260,24 @@ class StubFitter {
drainApply(_handle: unknown): Uint32Array {
return new Uint32Array([0, 0, 0]);
}
drainApplyEvents(_handle: unknown): {
report: [number, number, number];
events: Array<Record<string, unknown>>;
} {
// Phase 5 fit stub never proposes mutations — extend is a
// heartbeat-only stub in that phase — so this matches `drainApply`
// and emits no structural events.
return { report: [0, 0, 0], events: [] };
}
reconstructLastFrame(): Float32Array {
return new Float32Array(0);
}
componentIds(): Uint32Array {
return new Uint32Array(0);
}
lastTrace(): Float32Array {
return new Float32Array(0);
}
takeSnapshot(): { epoch(): bigint; numComponents(): number; pixels(): number; free(): void } {
return {
epoch: () => this.currentEpoch,
Expand Down Expand Up @@ -295,6 +321,8 @@ class StubExtender {
vi.mock('@calab/cala-core', () => ({
initCalaCore: vi.fn(async () => undefined),
calaMemoryBytes: vi.fn(() => 0),
drainApplyEventsTyped: (fitter: { drainApplyEvents: (q: unknown) => unknown }, queue: unknown) =>
fitter.drainApplyEvents(queue),
AviReader: StubAviReader,
Preprocessor: StubPreprocessor,
Fitter: StubFitter,
Expand Down
39 changes: 39 additions & 0 deletions apps/cala/e2e/phase6-exit.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ class StubPreprocessor {
processFrameF32(input: Float32Array): Float32Array {
return input;
}
processFrameF32WithStages(input: Float32Array): Float32Array {
const out = new Float32Array(input.length * 3);
out.set(input, 0);
out.set(input, input.length);
out.set(input, input.length * 2);
return out;
}
free(): void {}
}

Expand All @@ -197,6 +204,36 @@ class StubFitter {
this.currentEpoch += 1n;
return new Uint32Array([1, 0, 0]);
}
drainApplyEvents(_handle: unknown): {
report: [number, number, number];
events: Array<Record<string, unknown>>;
} {
fitterDrainApplyCount += 1;
const id = Number(this.currentEpoch);
this.currentEpoch += 1n;
return {
report: [1, 0, 0],
events: [
{
kind: 'birth',
id,
class: 'cell',
support: [0],
values: [1],
patch: [0, 0],
},
],
};
}
reconstructLastFrame(): Float32Array {
return new Float32Array(0);
}
componentIds(): Uint32Array {
return new Uint32Array(0);
}
lastTrace(): Float32Array {
return new Float32Array(0);
}
takeSnapshot(): { epoch(): bigint; numComponents(): number; pixels(): number; free(): void } {
return {
epoch: () => this.currentEpoch,
Expand Down Expand Up @@ -239,6 +276,8 @@ class StubExtender {
vi.mock('@calab/cala-core', () => ({
initCalaCore: vi.fn(async () => undefined),
calaMemoryBytes: vi.fn(() => 2 * 1024 * 1024),
drainApplyEventsTyped: (fitter: { drainApplyEvents: (q: unknown) => unknown }, queue: unknown) =>
fitter.drainApplyEvents(queue),
AviReader: StubAviReader,
Preprocessor: StubPreprocessor,
Fitter: StubFitter,
Expand Down
42 changes: 42 additions & 0 deletions apps/cala/e2e/phase6-extend.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ class StubPreprocessor {
processFrameF32(input: Float32Array): Float32Array {
return input;
}
processFrameF32WithStages(input: Float32Array): Float32Array {
const out = new Float32Array(input.length * 3);
out.set(input, 0);
out.set(input, input.length);
out.set(input, input.length * 2);
return out;
}
free(): void {}
}

Expand Down Expand Up @@ -202,6 +209,39 @@ class StubFitter {
this.currentEpoch += 1n;
return new Uint32Array([1, 0, 0]);
}
drainApplyEvents(_handle: unknown): {
report: [number, number, number];
events: Array<Record<string, unknown>>;
} {
fitterDrainApplyCount += 1;
// Synthesize one birth event per drain — mirrors the behavior
// the Phase 6 test was written against, plus the real Phase 7
// structural event surface for the bus.
const id = Number(this.currentEpoch);
this.currentEpoch += 1n;
return {
report: [1, 0, 0],
events: [
{
kind: 'birth',
id,
class: 'cell',
support: [0],
values: [1],
patch: [0, 0],
},
],
};
}
reconstructLastFrame(): Float32Array {
return new Float32Array(0);
}
componentIds(): Uint32Array {
return new Uint32Array(0);
}
lastTrace(): Float32Array {
return new Float32Array(0);
}
takeSnapshot(): { epoch(): bigint; numComponents(): number; pixels(): number; free(): void } {
return {
epoch: () => this.currentEpoch,
Expand Down Expand Up @@ -239,6 +279,8 @@ class StubExtender {
vi.mock('@calab/cala-core', () => ({
initCalaCore: vi.fn(async () => undefined),
calaMemoryBytes: vi.fn(() => 1024 * 1024),
drainApplyEventsTyped: (fitter: { drainApplyEvents: (q: unknown) => unknown }, queue: unknown) =>
fitter.drainApplyEvents(queue),
AviReader: StubAviReader,
Preprocessor: StubPreprocessor,
Fitter: StubFitter,
Expand Down
Loading
Loading