Preserve active solves across deploys#178
Merged
Merged
Conversation
Mirror new application data and pseudonymous metrics into PostgreSQL while MongoDB remains the source of truth. Add versioned migrations, Compose services, retention controls, and focused coverage for the migration path.
Describe the migration by its schema responsibility rather than the temporary dual-write rollout strategy. Keep the initial username index compatible with the final schema when migrations are replayed.
Replace the custom migration registry with a canonical Prisma schema and Prisma Migrate history. Run migrate deploy as a one-shot production service and enforce schema validation and drift checks in CI.
Normalize solve penalties and add stable cursor ordering. Mirror only dirty room participants, attempts, and results to avoid replaying room history on every save.
Move shared event and protocol constants to JSON so the Vite client uses ESM while the CommonJS server reads the same data. Import the Material UI theme provider through its supported direct package entry to avoid the optimizer's broken barrel initialization.
Add PostgreSQL dual writes and room metrics
Delay disconnect cleanup while clients reconnect and reconcile membership through the shared Redis adapter. Deploy application services sequentially without recreating stateful dependencies.
Expose dependency-aware HTTP readiness endpoints and a Socket.IO health round trip. Point Compose and nginx at the explicit health routes for deployment verification.
Persist and retry completed solves with idempotent acknowledgements across socket reconnects. Roll services selectively with health-gated rollback so routine deploys minimize room disruption.
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
GRAND_PRIX_ENABLED=trueis explicitly configureddegradedwithout taking the primary MongoDB/Redis path out of serviceUser-visible behavior
Socket deploys still cause a brief transport reconnect, but they no longer end the user's room session. A solve already in progress continues timing locally. If it finishes while disconnected, the next solve is blocked and the completed time is retained on the device until it can be submitted safely.
The local result is marked as delivery-attempted before its first emit, so an uncertain submission cannot be discarded accidentally. A definitive server rejection remains discardable across refreshes. Invalid manual times stay in the input for correction and never enter the outbox.
Grand Prix rooms are hidden and rejected in production while the mode is disabled. Normal rooms are unaffected.
Deployment behavior
DEPLOY_TARGET=autoresolves documentation-only changes tonone, browser-only changes toapi, and shared/server/deployment changes toall. Missing runtime containers promote an automatic deploy to a full bootstrap. Full deploys replace socket before API/static, health-check each service, and gracefully reload nginx after each handoff.Rollback tags preserve the exact image IDs that were running before deployment. Rollback also uses Compose files from the pre-deploy commit, so a bad command, environment definition, or health check can be reverted along with the image. Database migrations are intentionally not reversed and must remain backward-compatible.
Validation
yarn lintyarn test— 55 client tests and 70 server testsyarn buildscripts/test-deploy-classifier.shscripts/test-deploy.shdefaultcontextyarn cypress:run— 6 tests across both specsgit diff --check