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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
test([strip-stray-tryreadfile-from-instances-mocks]): drop dead tryReadFile keys from two instances.js mock factories
[._.]/ Adam Eivy0e87fd796967
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8d1302d049..7923b19320 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -2,6 +2,8 @@## Changed+- **[strip-stray-tryreadfile-from-instances-mocks] Drop dead `tryReadFile: vi.fn().mockResolvedValue(null)` entries from two `instances.js` mock factories.** `server/services/sharing/subscriptions.test.js:25` and `server/services/sharing/integration.test.js:44` were a leftover copy-paste from when these tests used to mock `lib/fileUtils.js`; `instances.js` doesn't export `tryReadFile`, so the keys are no-ops that only confuse the next reader. Removed and reformatted both factories onto the project's standard multi-line `vi.mock(..., () => ({ ... }))` shape. The third site PLAN.md referenced — `server/services/mediaAnnotations.test.js` — turned out to be a false positive: its `tryReadFile` lives inside the legitimate `lib/fileUtils.js` mock, and its `instances.js` mock at line 15 is already clean. The 45 tests across the two edited files pass; nothing else changes.+- **[hoist-certmeta-to-top-level-lib] `readCertMeta()` hoisted to top-level `lib/certMeta.js` so `scripts/` and managed apps can share it.** The previous `server/lib/certMeta.js` baked `PATHS.data` at module load, so `scripts/print-access-url.js` couldn't reach it without crossing the scripts/server boundary and instead carried its own inline `try { JSON.parse(readFileSync(...)).mode } catch {}` block. Moved the module next to `lib/certPaths.js` (zero-dep, side-effect-free — same constraint set as the existing sibling) and changed the signature to `readCertMeta(metaPath)` so each caller passes the path it already resolved via `certPaths(PATHS.data).meta`. Four callers updated: `server/lib/peerSelfHost.js`, `server/lib/networkExposure.js`, `server/services/certRenewer.js` (two call sites), and `scripts/print-access-url.js` (drops the inline try/catch in favor of `readCertMeta(META_PATH)?.mode || ''`). The test file moved too and gained cases for the `metaPath` argument, `statSync`/`readFileSync` throwing (EACCES/EIO), and primitive JSON (parsed value gated on `typeof === 'object' && !Array.isArray`). The `JSON.parse` + try/catch is inlined rather than reusing `server/lib/fileUtils.js#safeJSONParse` — the JSDoc notes this is the cost of the zero-dep boundary that lets `scripts/` import the helper. `server/lib/{index.js, README.md}` barrel + catalog rows removed per the maintenance rule. All 6133 server tests + 270 client tests pass.- **[image-gen-mode-enum-unify] Unify the image-gen mode enum across server + client.** The bare `'codex'` / `'local'` / `'external'` string literals that lived at ~25 dispatch sites across `server/services/imageGen/{index,codex,local,external}.js`, `server/services/mediaJobQueue/index.js`, `server/services/pipeline/visualStages.js`, `server/services/universeCharacterSheet.js`, `server/routes/{imageGen,universeBuilder,sdapi,pipeline}.js`, `server/services/pipeline/issues.js`, `server/services/voice/tools.js`, and the matching client surfaces (`ImageGen.jsx`, `ImageGenTab.jsx`, `VisualGenSettings.jsx`, `ImageGenControls.jsx`, `MediaJobsQueue.jsx`, `MediaLightbox.jsx`, `PromptRefineModal.jsx`, `normalize.js`, `imageGenResolutions.js`, `wrImageDefaults.js`, `ComicScriptStage.jsx`, `UniverseBuilder.jsx`) now flow through a typed enum. Server adds `IMAGE_GEN_MODE = Object.freeze({ EXTERNAL, LOCAL, CODEX })` in a new `server/services/imageGen/modes.js` (standalone so the dispatcher and the provider modules can both import without a cycle), re-exported from `imageGen/index.js`; `IMAGE_GEN_MODES` (the Zod-validator alphabet) is now derived from `Object.values(IMAGE_GEN_MODE)` so the two can't drift. Client `IMAGE_GEN_MODE` in `client/src/lib/imageGenBackends.js` is `Object.freeze`d to match. Zod schemas in `pipeline.js` and `universeBuilder.js` now consume the constants too so a future mode addition is one edit. Provider binary names (`DEFAULT_BIN = 'codex'`) and model-fallback strings stay as bare literals — they're not modes. Three test mocks (`imageGen.test.js`, `sdapi.test.js`, `voice/tools.test.js`) updated to export the new constant. Codex review caught five additional dispatch sites the first pass missed; second pass is CLEAN. 6096/6096 server tests + 240/240 client tests pass.diff --git a/PLAN.md b/PLAN.mdindex 591eb3c009..724cc247aa 100644--- a/PLAN.md+++ b/PLAN.md@@ -12,8 +12,6 @@ _Nothing currently parked — pick the next item from the Backlog._### Code quality / dedup (from `/simplify` passes)-- [ ] [strip-stray-tryreadfile-from-instances-mocks] **[LOW][TESTS]** Three `vi.mock('../instances.js', ...)` factories carry a stray `tryReadFile: vi.fn().mockResolvedValue(null)` property — `server/services/mediaAnnotations.test.js:6`-ish (legacy mock shape), `server/services/sharing/integration.test.js:45`, `server/services/sharing/subscriptions.test.js:26`. `instances.js` does not export `tryReadFile` (it's a `fileUtils.js` export), so the key is a no-op copy-paste artifact. Drop it from the three mock factories. Surfaced by /simplify during `[unknown-instance-id-sentinel-extract]`; deferred because that PR was scoped to the sentinel extraction.-### v2.1.0 pre-release review residue (deferred from main→release multi-agent review, 2026-05-16)- [ ] [med-pipeline-server-services-pipeline-arcplanner-2] **[MED][PIPELINE]** `server/services/pipeline/arcPlanner.js:929-942` — `buildSeasonRemap` Pass 3 (positional fallback) silently invents wrong mappings when the LLM structurally reshapes the arc. Log a warning when Pass 3 fires; consider only firing when unmatched count ≤ 1.diff --git a/server/services/sharing/integration.test.js b/server/services/sharing/integration.test.jsindex 2778ba0c73..4597f3bff8 100644--- a/server/services/sharing/integration.test.js+++ b/server/services/sharing/integration.test.js@@ -42,7 +42,6 @@ vi.mock('../../lib/fileUtils.js', async () => {// Stub instances.getInstanceId so the exporter doesn't try to read the// real identity.json. Returns a fixed id for assertions.vi.mock('../instances.js', () => ({-tryReadFile: vi.fn().mockResolvedValue(null),getInstanceId: () => Promise.resolve('test-instance-id'),UNKNOWN_INSTANCE_ID: 'unknown',}));diff --git a/server/services/sharing/subscriptions.test.js b/server/services/sharing/subscriptions.test.jsindex 43b93a4804..bb0d526209 100644--- a/server/services/sharing/subscriptions.test.js+++ b/server/services/sharing/subscriptions.test.js@@ -23,7 +23,9 @@ vi.mock('../../lib/fileUtils.js', async () => {});});vi.mock('../instances.js', () => ({-tryReadFile: vi.fn().mockResolvedValue(null), getInstanceId: () => Promise.resolve('inst-test'), UNKNOWN_INSTANCE_ID: 'unknown' }));+ getInstanceId: () => Promise.resolve('inst-test'),+ UNKNOWN_INSTANCE_ID: 'unknown',+}));vi.mock('../mediaJobQueue/index.js', () => ({ getJob: () => null }));const buckets = await import('./buckets.js');