Expose a typed Sync Service API#77
Open
AntonNiklasson wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reshapes the packages/sync package into a small, typed application boundary (SyncService) intended for dependency injection by future consumers (e.g., the dashboard server), while keeping storage/engine composition details internal.
Changes:
- Introduces a
SyncServiceAPI with normalized read models, explicit sync operations, and lifecycle management (start/stop/close). - Centralizes domain model types (
PullRequest,Notification, etc.) and reuses them in GitHub normalization. - Migrates the sync CLI to consume the service contract and updates root build to include the sync package.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/sync/src/service.ts | Adds the new SyncService boundary, request tracking, and lifecycle semantics. |
| packages/sync/src/service.test.ts | Adds focused tests for read-model normalization, lifecycle delegation, and background error containment. |
| packages/sync/src/providers/github/normalize.ts | Aligns normalization types with shared models and aliases NormalizedPr to the public PullRequest. |
| packages/sync/src/models.ts | Introduces shared, normalized domain model types for PRs and notifications. |
| packages/sync/src/index.ts | Narrows the public surface to the service boundary + exported model/engine types. |
| packages/sync/src/index.test.ts | Updates public surface tests to validate only the service constructor is exported at runtime. |
| packages/sync/src/cli.ts | Migrates CLI commands from direct engine composition to the SyncService API. |
| packages/sync/README.md | Documents the new service contract and usage expectations for consumers. |
| package.json | Ensures the sync package is built as part of the root build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+94
to
+98
| async function stop(): Promise<void> { | ||
| if (closed) return; | ||
| await engine.stop(); | ||
| await waitForPending(); | ||
| } |
Comment on lines
+87
to
+88
| const engineOptions = (request: SyncRequest | undefined) => | ||
| request ? { instance: request.instanceId, kind: request.kind } : undefined; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SyncServiceapplication boundaryThis intentionally does not integrate the API server. It establishes the boundary that a later integration can consume through dependency injection.
Validation
pnpm typecheckpnpm test(203 tests)pnpm lintpnpm fmt:checkpnpm buildpnpm --filter sync cli --help