Back to Signal Feed
CodeTracked since May 19, 2026

Prevent backend server auto-start on import

Refactor the InsForge backend startup flow so importing `backend/src/server.ts` no longer starts the service; app creation is moved to `backend/src/app.ts` and `initializeServer()` in `server.ts` only runs when the module is the process entrypoint, with a regression test added for import-safe behavior.

backend/src/app.tsbackend/src/server.tscreateAppinitializeServer

What Happened

  • Refactor the InsForge backend startup flow so importing `backend/src/server.ts` no longer starts the service; app creation is moved to `backend/src/app.ts` and `initializeServer()` in `server.ts` only runs when the module is the process entrypoint, with a regression test added for import-safe behavior.
  • Refactor the InsForge backend startup flow so importing `backend/src/server.ts` no longer starts the service; app creation is moved to `backend/src/app.ts` and `initializeServer()` in `server.ts` only runs when the module is the process entrypoint, with a regression test added for import-safe behavior.
  • 1 evidence item attached for review.

What is Different

Before

Scattered source updates, isolated context, and manual follow-up across multiple feeds.

Now

Split app initialization from runtime startup by extracting Express setup into `app.ts`, adding an entrypoint guard in `server.ts` so startup and signal handlers only register when executed directly, and adding a test that import does not trigger server boot or handler registration.

Why Track This

Why It Matters

Developers and automated test/jobs can import backend server code without unintentionally launching the HTTP process, so local tests and tooling stop blocking on already-bound ports or lingering processes during import. Technically, the startup path is now isolated to direct execution of `server.ts` via `isEntrypoint()`, while `createApp` remains exported for compatibility from the entry module; operators should continue watching whether all valid launch entrypoints still call the startup path correctly and whether any remaining module imports still perform other hidden side effects during load.

Impact

Developers and automated test/jobs can import backend server code without unintentionally launching the HTTP process, so local tests and tooling stop blocking on already-bound ports or lingering processes during import. Technically, the startup path is now isolated to direct execution of `server.ts` via `isEntrypoint()`, while `createApp` remains exported for compatibility from the entry module; operators should continue watching whether all valid launch entrypoints still call the startup path correctly and whether any remaining module imports still perform other hidden side effects during load.

What To Watch Next

  • Watch whether backend/src/app.ts becomes a repeated pattern.
  • Track follow-up changes around AI Debugging and Error Localization.
  • Compare future signals against this evidence trail.
  • Re-check risk flags: entrypoint_check_bypass_in_custom_launchers, missing_import_safety_for_new_entrypoints.
Open Topic TimelineOpen Technical EventOpen Original Sourceentrypoint_check_bypass_in_custom_launchers / missing_import_safety_for_new_entrypoints / startup_side_effects_remaining_in_migrated_modules

Supporting Evidence