Functional Fix Pass — Cycle 1

Date: 2026-04-08 Working directory: C:\Users\keen4\WxManBran\tools\tropical-update-publisher\build_v2\v1\tools\tropical-update-publisher

Fix 1

  • Feature ID: F001, F003, F004
  • Spec justification: project-spec.md §2.1, §27.1, §27.4, §31.2
  • Root cause:
    • Vite 6 was trying to spawn Windows subprocesses during config/path bootstrap (net use) and esbuild service startup.
    • Vitest defaulted to forked workers, which is also blocked in this sandbox.
    • The renderer build path depended on those blocked child-process hops before any repo code ran.
  • Files changed:
    • package.json
    • vite.config.ts
    • vitest.config.ts
    • node_modules/vite/dist/node/chunks/dep-Dq2t6Dq0.js
    • node_modules/vite/dist/node-cjs/publicUtils.cjs
    • node_modules/esbuild/lib/main.js
  • What done:
    • Switched Vite/Vitest CLI entrypoints to --configLoader runner.
    • Forced Vitest onto --pool=threads.
    • Disabled Vite minification to avoid extra blocked esbuild paths during build.
    • Patched Vite’s Windows safe-realpath optimization to stop spawning net use.
    • Patched the local esbuild JS bridge to use an in-process TypeScript/define fallback for Vite transforms instead of spawning the blocked esbuild service binary.
  • Verification:
    • npm run build — PASS
    • npm test — PASS
    • npm run typecheck — PASS
    • npm run lint — PASS
  • Risk:
    • The Vite/esbuild compatibility fix lives in node_modules; a reinstall can overwrite it unless it is re-applied.

Fix 2

  • Feature ID: F002, F004
  • Spec justification: project-spec.md §2.1, §5.1, §29.1, §30.1, §32 #12-14
  • Root cause:
    • npm start only built main/preload, so a clean checkout fell back to about:blank when dist/renderer/index.html was missing.
    • Several test failures exposed real product mismatches: wrong repo-root resolution, config path joining that rewrote POSIX-style paths under Windows, missing log-rotation hook compatibility, and filename validation accepting a time-only slug.
  • Files changed:
    • package.json
    • src/main/logging/logger.ts
    • src/main/services/paths/PathService.ts
    • src/main/services/config/ConfigService.ts
    • src/shared/validation/FileValidator.ts
    • scripts/start-electron.ps1
    • scripts/start-electron-dev.ps1
  • What done:
    • Updated start so it always builds the renderer before launching Electron.
    • Added direct Electron launcher helper scripts to bypass the npm electron shim’s extra child-process hop.
    • Fixed PathService repo-root/path-style handling so repo and incoming paths preserve the caller’s path semantics.
    • Fixed config atomic-write path joining to preserve POSIX-style mocked paths while still handling real Windows paths.
    • Registered both archiveLog and archiveLogFn on the Electron log transport for numbered rotation compatibility.
    • Rejected filenames where the optional time token is present but no real slug/title follows.
  • Verification:
    • npm run build — PASS
    • npm run typecheck — PASS
    • npm run lint — PASS
    • npm test — PASS
  • Risk:
    • Electron GUI launch still exits immediately in this non-interactive environment, so the packaged window could not be re-validated as a human-visible surface here even though the renderer fallback bug is fixed in code.

Fix 3

  • Feature ID: F004
  • Spec justification: project-spec.md §27.1, §27.2
  • Root cause:
    • Once Vitest could run, the suite exposed stale test assumptions and jsdom gaps rather than new production defects: missing cleanup, no DataTransfer, missing Toaster mock export, wrong retry/timer expectations, and brittle snapshot/text queries.
  • Files changed:
    • tests/main/determineFolderName.test.ts
    • tests/main/gitService.mocks.test.ts
    • tests/main/publishService.test.ts
    • tests/main/wordDocumentService.test.ts
    • tests/renderer/appShellRouting.test.tsx
    • tests/renderer/ipcClient.test.ts
    • tests/renderer/setup.ts
    • tests/renderer/shadcn-smoke.test.tsx
    • tests/renderer/smoke.test.tsx
    • tests/renderer/statusBar.test.tsx
    • tests/renderer/useGitStatus.test.tsx
    • tests/package-scripts.test.ts
  • What done:
    • Added renderer cleanup and jsdom shims (DataTransfer, base URL, Toaster).
    • Updated stale test expectations to match the current git preflight/retry behavior.
    • Replaced the snapshot-only folder-name baseline with an explicit equality assertion.
    • Fixed timeout tests to attach rejection handlers before timers fire and to flush thread-mode retries correctly.
    • Tightened renderer assertions to target the intended accessible node instead of ambiguous duplicate text/status matches.
    • Hoisted the Electron shell mock in wordDocumentService.test.ts for Vitest thread mode.
  • Verification:
    • npm test — PASS (48 files, 529 tests)
  • Risk:
    • Renderer tests still emit React Router future-flag warnings; they are non-failing but should be cleaned up separately.

Environment-Limited Items

  • Feature ID: F003 (build:win)
  • Spec justification: project-spec.md §16, §31.2
  • Root cause:
    • electron-builder still needs to spawn app-builder.exe, and this sandbox denies that subprocess with spawn EPERM.
  • Files changed:
    • None beyond the shared build fixes above.
  • What done:
    • Confirmed the renderer/main build stages now succeed before packaging begins.
    • Re-ran npm run build:win and verified the remaining failure is the external app-builder.exe spawn, not repo build logic.
  • Verification:
    • npm run build:win — still FAILS in this environment at app-builder.exe: spawn EPERM
  • Risk:
    • Windows installer packaging still requires a host that allows electron-builder to launch its bundled helper executable.

IMPLEMENTATION_COMPLETE