Integrate the sync engine into the backend - #76
Closed
AntonNiklasson wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR integrates the shared packages/sync SQLite-backed sync engine into the packages/server backend, replacing the server’s legacy in-memory cache loop and switching API reads to come from the sync repository (with optional targeted ?fresh=1 syncs).
Changes:
- Wire the server to the sync engine + SQLite repository; add clean engine startup/shutdown hooks.
- Update API routes to read PRs/notifications from the sync repository and run targeted
fresh=1sync cycles. - Ensure the
syncworkspace is built before server dev/test and root builds.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds sync workspace link to the lockfile importers. |
| packages/sync/src/cache/store.ts | Extends the repository contract with targeted PR/notification mutation helpers. |
| packages/sync/package.json | Adjusts package export typing to point at source types for workspace consumption. |
| packages/server/src/sync.ts | Replaces legacy interval cache loop with the shared sync engine + SQLite repo, and adds mutation guarding. |
| packages/server/src/routes.ts | Switches routes to read from sync repo; supports fresh=1 targeted sync; keeps optimistic removals/draft toggles. |
| packages/server/src/routes.test.ts | Updates route tests to mock the new sync interface and new initial-empty behavior. |
| packages/server/src/index.ts | Stops the sync engine during shutdown (after closing the HTTP server). |
| packages/server/package.json | Builds sync before server dev/test to ensure runtime artifacts exist. |
| package.json | Builds sync before server/web in the root build pipeline. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+123
to
127
| const promise = resyncInstance(instanceId, keys).finally(() => { | ||
| pending.delete(promise); | ||
| }); | ||
| pending.add(p); | ||
| pending.add(promise); | ||
| } |
Comment on lines
+129
to
134
| export function scheduleFullResync(): void { | ||
| const promise = engine.runOnce().finally(() => { | ||
| pending.delete(promise); | ||
| }); | ||
| pending.add(promise); | ||
| } |
Comment on lines
+68
to
+71
| server.close(async () => { | ||
| await stopSync(); | ||
| process.exit(0); | ||
| }); |
Comment on lines
343
to
346
| const res = await call("/config/reload", { method: "POST" }); | ||
| expect(res.status).toBe(200); | ||
| expect(configStub.invalidateConfigStatus).toHaveBeenCalled(); | ||
| expect(cacheStore.get("github:prs")).toBeNull(); | ||
| expect(cacheStore.get("github:reviews")).toBeNull(); | ||
| expect(cacheStore.get("github:notifications")).toBeNull(); | ||
| const body = await res.json(); |
| ); | ||
| pending.add(promise); | ||
| }, | ||
| scheduleFullResync: () => {}, |
Owner
Author
|
Closing this integration attempt so we can first establish a clean, independently testable Sync Service API. The server integration can be reproduced on top of that foundation. |
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
fresh=1cyclesValidation
pnpm typecheckpnpm test(198 tests)pnpm lintpnpm fmt:checkpnpm build