Repository navigation
[Entity-Service] fix incident attachment upload in dual-write mode - #3022
Merged
rksk merged 1 commit intoOct 26, 2026
Merged
Conversation
In dual-write mode, incident, change_request and conversation attachment uploads went to the mirrored data source and then tried to insert a case_attachment row keyed by the work item id, which violates the case foreign key and surfaced as a 400. Searches for these types read the work_item_attachment table, which is no longer being synced, so new uploads never appeared. Treat these types like deployment in dual-write mode: create uploads to the mirror only and returns its response, search reads from the mirror. Plain postgres mode and case behaviour are unchanged. Temporary stopgap until a Postgres-backed storage for non-case work items exists.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
cloby99
approved these changes
Oct 26, 2026
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.
Purpose
In dual-write mode, uploading an attachment to an incident returned HTTP 400. Incident, change request and conversation uploads were sent to the mirrored data source and then a case attachment row keyed by the work item id was inserted, which violates the case foreign key. The file existed in the mirrored source but the caller saw an error. Listing attachments for these types read a synced table whose sync is stopped, so new uploads never appeared.
Goals
Creating and listing attachments for incident, change request and conversation works in dual-write mode.
Approach
Added one helper,
isMirrorOnlyAttachmentRef, covering deployment plus the three non-case work item types. In dual-write mode, create uploads to the mirrored source only (no actor resolution, no Postgres insert) and returns its response, and search reads from the mirrored source. Plain postgres mode and case behaviour are unchanged. This is a temporary stopgap until Postgres-backed attachment storage for non-case work items exists, at which point the helper's non-deployment arms should be removed. Diff: 4 files, +118/-11, entity-service only. Update and delete behaviour are not changed.User stories
N/A: bug fix.
Release note
Fixed attachment upload and listing for incidents, change requests and conversations in dual-write mode.
Documentation
N/A: no documented behaviour change.
Training
N/A: no training impact.
Certification
N/A: no impact on certification exams.
Marketing
N/A: bug fix.
Automation tests
Security checks
Samples
N/A: no samples.
Related PRs
None.
Migrations (if applicable)
N/A: no schema changes.
Test environment
Go unit tests on macOS.
Learning
N/A: follows the existing deployment stopgap pattern.