fix: save events locally without active session#1664
Merged
Conversation
1117873 to
5a8d50e
Compare
Run the bundled MongoDB container as a single-node replica set so the backend's transaction-based event save path works in local self-host installs. Update installer env generation and refresh handling to add the Mongo replica set key and ensure local Mongo URIs include replicaSet=rs0 without wiping existing user data. Clean up failed optimistic event creates locally instead of calling the backend delete endpoint for events that were never saved, avoiding a misleading login-required alert after save failures.
5a8d50e to
45e4ed2
Compare
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
Why
A browser can keep
compass.auth.hasAuthenticated=truefrom an older hosted/dev/self-host session even when the new local backend has no valid session. In that state, anonymous event creation was routed to the backend and failed with401, causing the optimistic event to disappear. Without an active session, event writes should stay local.Validation
localStorage.compass.auth.hasAuthenticated=truewithout a valid session.POST /api/eventrequest was sent.bunx biome check packages/web/src/common/repositories/event/event.repository.util.ts packages/web/src/common/repositories/event/event.repository.util.test.tsbun run test:coreKnown: direct
bun test --cwd packages/web ...still hits the existing web test harness global issue (jest/ browser globals), unrelated to this change.