Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: verify Windows image marker round-trip

[._.]/ Adam Eivyc73a82c74066
diff --git a/scripts/image_execution_marker.test.js b/scripts/image_execution_marker.test.js
index ce14fc11dd..f3d30adc2a 100644
--- a/scripts/image_execution_marker.test.js
+++ b/scripts/image_execution_marker.test.js
@@ -1,23 +1,36 @@
-import { execFileSync } from 'child_process';
+import { spawnSync } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { describe, expect, it } from 'vitest';
+import { parseImageExecutionMarker } from '../server/services/imageGen/local.js';
const scriptsDir = dirname(fileURLToPath(import.meta.url));
describe('local image execution marker', () => {
- const buildMarker = (requestedDevice, effectiveDevice, placement) => {
+ const emitMarker = (requestedDevice, effectiveDevice, placement) => {
const program = [
- 'import json, sys',
+ 'import sys',
`sys.path.insert(0, ${JSON.stringify(scriptsDir)})`,
- 'from _runner_common import build_image_execution_marker',
- `print(json.dumps(build_image_execution_marker('diffusers-image', ${JSON.stringify(requestedDevice)}, ${JSON.stringify(effectiveDevice)}, ${JSON.stringify(placement)}, [])))`,
+ 'from _runner_common import emit_image_execution_marker',
+ `emit_image_execution_marker('diffusers-image', ${JSON.stringify(requestedDevice)}, ${JSON.stringify(effectiveDevice)}, ${JSON.stringify(placement)}, [])`,
].join('; ');
- return JSON.parse(execFileSync('python3', ['-c', program], { encoding: 'utf8' }));
+ const result = spawnSync('python3', ['-c', program], { encoding: 'utf8' });
+ expect(result.status).toBe(0);
+ const marker = result.stderr.trim().split('\n').find((line) => line.startsWith('IMAGE_EXECUTION:'));
+ expect(marker).toBeDefined();
+ return marker;
};
- it('records the Windows split CUDA placement as confirmed', () => {
- expect(buildMarker('cuda', 'cuda', 'cuda+offload')).toMatchObject({
+ it('round-trips confirmed Windows CUDA placements through the server parser', () => {
+ expect(parseImageExecutionMarker(emitMarker('cuda', 'cuda', 'cuda'))).toMatchObject({
+ state: 'confirmed',
+ requestedDevice: 'cuda',
+ effectiveDevice: 'cuda',
+ placement: 'cuda',
+ cpuFallback: false,
+ runtime: { runtime: 'diffusers-image', versions: {} },
+ });
+ expect(parseImageExecutionMarker(emitMarker('cuda', 'cuda', 'cuda+offload'))).toMatchObject({
state: 'confirmed',
requestedDevice: 'cuda',
effectiveDevice: 'cuda',
@@ -26,25 +39,18 @@ describe('local image execution marker', () => {
runtime: { runtime: 'diffusers-image', versions: {} },
});
});
- it('records a CPU fallback as degraded without host or prompt data', () => {
- const program = [
- 'import json, sys',
- `sys.path.insert(0, ${JSON.stringify(scriptsDir)})`,
- 'from _runner_common import build_image_execution_marker',
- "print(json.dumps(build_image_execution_marker('flux2', 'cuda', 'cpu', 'cpu', [])))",
- ].join('; ');
- const marker = JSON.parse(execFileSync('python3', ['-c', program], { encoding: 'utf8' }));
+ it('round-trips a Windows CPU fallback as degraded without host or prompt data', () => {
+ const parsed = parseImageExecutionMarker(emitMarker('cuda', 'cpu', 'cpu'));
- expect(marker).toMatchObject({
- version: 1,
+ expect(parsed).toMatchObject({
state: 'degraded',
requestedDevice: 'cuda',
effectiveDevice: 'cpu',
placement: 'cpu',
cpuFallback: true,
- runtime: { runtime: 'flux2', versions: {} },
+ runtime: { runtime: 'diffusers-image', versions: {} },
});
- expect(marker).not.toHaveProperty('prompt');
- expect(marker).not.toHaveProperty('path');
+ expect(parsed).not.toHaveProperty('prompt');
+ expect(parsed).not.toHaveProperty('path');
});
});