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

test([test-route-suites-peer-fanout-mock-noise]): silence ~128 fake peer-sync-failure warnings

[._.]/ Adam Eivy3c9253736604
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index cf5f37ddfd..e228b69475 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -22,6 +22,8 @@ TBD
## Changed
+- **[test-route-suites-peer-fanout-mock-noise] Quieter test logs.** Two heavily-mocked route test suites stop printing ~128 misleading warnings per run that suggested peer-sync was failing.
+
- **Image Gen: hi-res presets opened to HiDream + Qwen-Image, plus a Qwen comic-page draft preset.** `client/src/lib/imageGenResolutions.js`'s `compatibilityKey` previously fell through to `flux1` for HIDREAM/QWEN, silently denying their natural `1024×1536` / `1536×1024` / `1536²` hi-res variants. Both runners now return their own keys, the three hi-res entries advertise compatibility for FLUX2 + QWEN + HIDREAM, and the Flux portrait/landscape entries (`832×1216`, `1216×832`) also open to them. Added a Qwen-only `1328×2048 (Qwen comic draft — experimental)` preset for US-comic-trim-aspect draft renders — past Qwen's documented ~1664 long-edge support window but coherent in practice on the 20B MMDiT; pair with a 1.5× upscale for final 1988×3056 output. Partial fix for `[hidream-qwen-client-runner-consumers]`; LoRA-picker side still pending.
- **Image Gen preview: step counter under the preview.** The live diffusion preview now shows a `step 32/50 · 64%` row below the image while a render is in flight. The progress payload already carried `step`/`totalSteps` from `imageGen/local.js`; just rendered them. Hidden for Codex / external paths that don't emit per-step events.
- **Qwen-Image stepwise preview decode.** `scripts/z_image_turbo.py` gained a Qwen-aware preview-decoder branch: Qwen-Image (and Img2Img / Edit siblings) packs latents to 3D `(B, num_patches, C*4)` like Flux, then unpacks to a 5-D video-VAE layout and unnormalizes with per-channel `latents_mean`/`latents_std` lists from `vae.config` before decoding. The generic `latents/scaling + shift` path matched neither step. New unpack helper (3D→5D) + Qwen-specific decoder; per-channel norm tensors are built CPU-side once and lazily migrated to (device, dtype) per call so the diffusion loop's ~30–50 fires don't rebuild from a list every step.
diff --git a/PLAN.md b/PLAN.md
index 68e156d9b8..5ad571cff4 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -173,7 +173,6 @@ Surfaced by the multi-reviewer release gate for v2.10.0. The CRITICAL/correctnes
- [x] [share-empty-scalar-helper] _(DONE post-v2.10.0 patch — moved to `server/lib/objects.js`)_ **Move `isEmptyScalar` out of `recordMerge.js` into a shared util.** `recordMerge.js`'s `isEmptyScalar` (null/undefined/empty-string/empty-array predicate) is now used by `resolveScalars` and `unionSeasons` and is a generic enough "is this value blank" check to live in `server/lib/objects.js` (or `validation.js`) for reuse. Low priority. (Batch-3/gemini NIT.)
- [x] [test-codereview-defaults-cache-isolation] _(DONE post-v2.10.0 patch)_ **`codeReview.test.js` doesn't reset the module-level `cachedDefaults` between tests.** `getCodeReviewDefaults` memoizes into `cachedDefaults` (invalidated only by a `settings:updated` event the test stubs as a no-op); `afterEach` resets `mockedSettings.current` but never clears the cache, so a future test adding a second `getCodeReviewDefaults()` call with different settings would silently read stale data. Export a test-only `__resetCodeReviewDefaultsCache()` and call it in `afterEach`. Latent (no current failure). (Batch-1/claude NIT.)
- [x] [test-codereview-local-route] _(DONE post-v2.10.0 patch)_ **`POST /api/code-review/local` has no route-level test.** Add a supertest-style test (mocking `runLocalCodeReview`/`getSettings`): empty `diff` → 400 (Zod), unknown `backend` → 400 (`z.enum`), `model` omitted falls back to the settings model, and `{ ok: false }` service result → 502. Also add `validation.test.js` assertions that `featureProviderConfigSchema.parse({ providerId:'', model:'' })` yields `undefined`s and `codeReviewSettingsSchema` rejects unknown keys (`.strict()`). (Batch-3 IMPROVEMENT/NIT.)
-- [ ] [test-route-suites-peer-fanout-mock-noise] **`pipeline.test.js` / `universeBuilder.test.js` log noisy `auto-subscribe after create failed: [vitest] error when mocking a module` warnings on every record-creating test (pre-existing on main — ~88 in pipeline.test.js alone, surfaced during the v2.10.0 patch code review).** Root cause: `createSeries`/`createUniverse` fire-and-forget `import('../sharing/peerSync.js').then(autoSubscribeRecordToAllPeers)`, and in these suites that dynamic import trips a hoisting-broken `vi.mock` factory elsewhere in the graph, so the `.catch` swallows it and logs. Tests still pass (non-fatal). The canonical fix is to mock `services/instances.js` (`mockNoPeers`) + `services/sharing/peerSync.js` (`mockNoPeerSync`) per the CLAUDE.md test contract — but the route graph statically imports a broad peerSync surface (`installPeerSyncListener`, `peerSyncEvents`, `listPeerSubscriptions`, `assetShaListForRecord`), so a full-replace mock drops needed exports and the `importActual`-spread form currently throws the same vitest mock-factory error. Needs a dedicated investigation into why `vi.importActual('../services/sharing/peerSync.js')` inside the factory errors here (likely a circular/hoist interaction with the other mocks) before the noise can be silenced. Out of scope for the v2.10.0 patch (pre-existing, non-fatal). Surfaced 2026-05-26.
### Importer provider/model picker — deferred follow-ups (2026-05-26)
diff --git a/server/routes/pipeline.test.js b/server/routes/pipeline.test.js
index c24c5dee80..087b0226f7 100644
--- a/server/routes/pipeline.test.js
+++ b/server/routes/pipeline.test.js
@@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest';
import express from 'express';
import { request } from '../lib/testHelper.js';
import { errorMiddleware } from '../lib/errorHandler.js';
+import { mockNoPeers, mockNoPeerSync } from '../lib/mockPathsDataRoot.js';
const fileStore = new Map();
@@ -13,6 +14,10 @@ tryReadFile: vi.fn().mockResolvedValue(null),
readJSONFile: vi.fn(async (path, fallback) => (fileStore.has(path) ? fileStore.get(path) : fallback)),
}));
+// Full-replace OK: this route graph doesn't statically import either module.
+vi.mock('../services/instances.js', () => mockNoPeers());
+vi.mock('../services/sharing/peerSync.js', () => mockNoPeerSync());
+
let uuidCounter = 0;
vi.mock('crypto', async () => {
const actual = await vi.importActual('crypto');
diff --git a/server/routes/universeBuilder.test.js b/server/routes/universeBuilder.test.js
index 8f31f5c5c9..32512e96d8 100644
--- a/server/routes/universeBuilder.test.js
+++ b/server/routes/universeBuilder.test.js
@@ -3,6 +3,7 @@ import express from 'express';
import { request } from '../lib/testHelper.js';
import { errorMiddleware } from '../lib/errorHandler.js';
import { enqueueJob } from '../services/mediaJobQueue/index.js';
+import { mockNoPeers, mockNoPeerSync } from '../lib/mockPathsDataRoot.js';
const fileStore = new Map();
@@ -14,6 +15,10 @@ tryReadFile: vi.fn().mockResolvedValue(null),
readJSONFile: vi.fn(async (path, fallback) => (fileStore.has(path) ? fileStore.get(path) : fallback)),
}));
+// Full-replace OK: this route graph doesn't statically import either module.
+vi.mock('../services/instances.js', () => mockNoPeers());
+vi.mock('../services/sharing/peerSync.js', () => mockNoPeerSync());
+
let uuidCounter = 0;
vi.mock('crypto', async () => {
const actual = await vi.importActual('crypto');