Skip to content

refactor: extract shadow control-plane into standalone omo-control-plane service#40

Open
EZotoff wants to merge 2 commits into
masterfrom
refactor/extract-control-plane
Open

refactor: extract shadow control-plane into standalone omo-control-plane service#40
EZotoff wants to merge 2 commits into
masterfrom
refactor/extract-control-plane

Conversation

@EZotoff
Copy link
Copy Markdown
Owner

@EZotoff EZotoff commented Apr 21, 2026

Summary

Extracts the shadow control-plane from omo-pulse into a new standalone service: omo-control-plane.

Why

  • Separation of concerns: omo-pulse handles monitoring and dashboard data; omo-control-plane handles orchestration advisories.
  • Independent deployment: The control plane can be started, stopped, and scaled independently.
  • Clearer communication: Each repo has a single, well-defined purpose.

What changes

  • Removes src/server/control-plane/ module (5 files)
  • Removes control-plane imports, instantiation, and 3 API routes from src/server/api.ts
  • Removes control-plane test file and route tests from src/__tests__/api.test.ts
  • Increases Bun.serve idleTimeout to 255s (prevents disconnection on slow first payload)

The new service

  • Repo: https://github.com/EZotoff/omo-control-plane
  • Runtime: Bun + Hono, port 4302
  • Data source: HTTP fetch from omo-pulse /api/projects
  • Features preserved: shadow policy engine, persistent ledger with compaction, degraded-path resilience, query-param filtering, per-project advisory routes
  • Tests: 25/25 pass

Rollback

Reverting this commit restores the embedded control-plane. The extracted service is additive — omo-pulse has zero runtime dependency on it.

EZotoff added 2 commits April 21, 2026 13:17
Extracted to omo-control-plane as a standalone service. Removes
createShadowControlPlane import, instantiation, and three /control-plane*
API routes from omo-pulse's API server. Increases Bun.serve idleTimeout
to 255s to prevent disconnection on slow first payload.
Control-plane tests now live in omo-control-plane. Removes vi.mock for
../server/control-plane, four control-plane route test cases, and the
deleted control-plane.test.ts reference from the test suite.
Copilot AI review requested due to automatic review settings April 21, 2026 11:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors omo-pulse by removing the embedded “shadow control-plane” functionality so orchestration/advisory logic can live in the standalone omo-control-plane service, and adjusts server keep-alive behavior to better tolerate slow first responses.

Changes:

  • Removes embedded control-plane wiring/routes/tests from omo-pulse (leaving monitoring/dashboard concerns in this repo).
  • Increases Bun server idleTimeout to 255s in both dev + start entrypoints.
  • Updates API/test code organization and lockfile metadata as part of the refactor.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/server/start.ts Sets Bun idleTimeout to 255s for longer-lived connections in the prod entrypoint.
src/server/dev.ts Sets Bun idleTimeout to 255s for the dev API server.
src/server/api.ts Removes control-plane-related API surface (and reformats/organizes API module).
src/tests/api.test.ts Removes/adjusts API route tests and mocking to match the new API surface.
bun.lock Adds configVersion metadata (lockfile format update).

[RISK:medium]

[SCORES]
{"security":4.5,"safety":4.5,"performance":3.5,"featureQuality":4.0,"confidence":3.5}
[/SCORES]

[SUMMARY]
The extraction/refactor direction looks consistent with the stated separation-of-concerns goal, and repo-wide searches show no remaining control-plane references. The main follow-ups are operational/maintainability oriented: make the new max idleTimeout configurable/documented, and prefer type-safe Vitest mocking helpers over unknown casts.
[/SUMMARY]

Comment thread src/server/start.ts
fetch: app.fetch,
hostname: "127.0.0.1",
port,
idleTimeout: 255,
Comment thread src/server/dev.ts
fetch: app.fetch,
hostname: "127.0.0.1",
port,
idleTimeout: 255,
Comment thread src/__tests__/api.test.ts
Comment on lines +69 to +71
const mockedCreateMultiProjectService = createMultiProjectService as unknown as {
mockReturnValue: (value: unknown) => void
}
Comment thread src/__tests__/api.test.ts
Comment on lines +159 to 163
;(listSources as unknown as { mockReturnValue: (value: unknown) => void }).mockReturnValue([
{ id: "src-1", label: "My Project", updatedAt: 1000 },
])
vi.mocked(getDefaultSourceId).mockReturnValue("src-1")
;(getDefaultSourceId as unknown as { mockReturnValue: (value: unknown) => void }).mockReturnValue("src-1")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants