Repository navigation
Fix tag merge timeout on unrelated segment payload IDs - #788
Open
jiwenjimiran wants to merge 2 commits into
Open
jiwenjimiran wants to merge 2 commits into
jiwenjimiran wants to merge 2 commits into
Conversation
jiwenjimiran
marked this pull request as ready for review
October 10, 2026 02:48
Contributor
Author
|
This one is pretty niche and I can work around it, but might bite other people if they are migrating tags in. Fine to close this one if it's unwanted. |
This branch has not been deployed
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
Tag merges currently prefilter stored segment JSON by looking for the source tag ID's digits anywhere in the payload. Imported AI segments contain unrelated numeric scene/span IDs. Merging a tag with ID 51 and only one segment caused the merge request to time out: PostgreSQL estimated roughly 1.55 million matching payload rows before Cove could check whether any were actual tag references.
This change also requires a recognized tag-bearing JSON key before loading a segment payload. It remains a conservative prefilter;
TagReferenceJsonRewriterstill checks and rewrites the actual reference. No database index or migration is added.On the affected library, the revised predicate scanned the segment table in 4.3 seconds and returned zero candidate payloads for tag ID 51. This addresses the observed timeout source; very large tag merges can still have other costs from transferring their direct relationships.
Linked issue
None; the failure was found during a local tag-merge pilot.
Type of change
AI usage
Testing done & evidence
dotnet test src/Cove.Tests/Cove.Tests.csproj --filter FullyQualifiedName~TagMergeServiceTests: 12 passed.EXPLAIN (ANALYZE, BUFFERS)against the affected library: revised predicate returned zero candidates in 4.3 seconds; the old digit-only plan estimated 1.55 million candidates.Checklist