Repository navigation
Conversation
When a session is unshared and then reshared, stale data from the previous share appeared mixed with the new data. The share_event and share_compaction storage entries were not being cleaned up during unshare, causing old sync events to be replayed when the session was reshared. This commit: - Adds cleanup for share_compaction entries in Share.remove() - Adds cleanup for share_event entries in Share.remove() - Adds memory storage adapter for local testing - Adds test for reshare scenario Fixes anomalyco#11372
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
There was a problem hiding this comment.
Pull request overview
This PR fixes a data consistency bug where stale data from a previous share appeared when a session was unshared and then reshared. The root cause was that share_event and share_compaction storage entries were not being cleaned up during unshare operations.
Changes:
- Added cleanup of
share_compactionandshare_eventstorage entries in theShare.remove()function - Added a memory storage adapter for local development and testing (activated via
OPENCODE_STORAGE_ADAPTER=memory) - Added a comprehensive test that verifies resharing works correctly with fresh data after unsharing
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/enterprise/src/core/share.ts | Added cleanup of share_compaction entry and all share_event entries in the Share.remove() function to ensure complete data cleanup on unshare |
| packages/enterprise/src/core/storage.ts | Added memory storage adapter implementation for local testing and development, providing an in-memory Map-based storage that matches the behavior of S3/R2 adapters |
| packages/enterprise/test/core/share.test.ts | Added comprehensive test case that verifies resharing after unsharing works correctly with fresh data, ensuring old compaction and events don't leak through |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@thdxr ready for your review |
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
What does this PR do?
Fixes #11372
When a session is unshared and then reshared, stale data from the previous share appeared mixed with the new data.
This happened because
share_eventandshare_compactionstorage entries were not being cleaned up during unshare,causing old sync events to be replayed when the session was reshared.
Changes:
share_compactionentries inShare.remove()share_evententries inShare.remove()Memory storage adapter:
A simple in-memory storage adapter was added to enable local development and testing of the enterprise package
without requiring R2/S3 credentials. It is only activated when explicitly setting
OPENCODE_STORAGE_ADAPTER=memory- production deployments are unaffected and will continue using r2 or s3 adapters.If this is not okay then tell me to remove it.
How did you verify your code works?
You can take a look at the attached video.
Screen.Recording.1404-11-11.at.2.19.01.AM.mov
/share/unshare/undoand edit the previous message ("hi 2" in the shared video)/share