Skip to content

cherry-pick of tag sync job fixes: empty bucket read - #170

Merged
mdolina merged 5 commits into
mainfrom
fix/tag-sync-empty-bucket
Oct 2, 2026
Merged

mdolina merged 5 commits into
mainfrom
fix/tag-sync-empty-bucket

Conversation

@mdolina

@mdolina mdolina commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

The shared Cassandra query helper drops read errors, so a failed read
looked like an empty result. Tag sync aborted the whole run with
cassandra_suspect_empty_bucket when a bucket listed in TagBucketMetadata
read as empty, and other failed reads silently skipped tags or buckets.

Tagging reads now go through queryRows, which returns read errors. A
failed read aborts the sync with cassandra_error and the driver message;
a bucket that really is empty is skipped, counted in emptyBuckets and
logged. Tag API reads return an error instead of partial or empty
results when Cassandra fails.
GET /taggingService/tags/sync/status/{runId} returns one run record, so a
caller can poll a run without reading the whole history. 404 when the id is
not in the retained history; store errors are sanitized like /sync/status.
A failed read stored "cassandra_error: <driver error>" as the abort
reason, which the status endpoints return to clients; driver errors can
name hosts and keyspaces. The reason is now just cassandra_error and the
driver error is logged under the run's audit_id.
queryRows now returns read errors instead of dropping them, and the tag
APIs write errors into the response body, so a Cassandra outage could
expose hosts and keyspaces. queryRows now logs the driver error with the
query text and returns a generic "tag store read failed" error.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Some member-read paths still convert Cassandra failures into 404 or incomplete successful responses.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Improves tag-sync reliability by distinguishing Cassandra failures from genuinely empty buckets and adds per-run status polling.

Changes:

  • Propagates and sanitizes Cassandra read errors.
  • Skips and counts stale empty buckets.
  • Adds a run-specific status endpoint and documentation.
File Description
taggingapi/​tag/​tag_sync.go Handles empty buckets and sanitized abort reasons.
taggingapi/​tag/​tag_sync_test.go Tests error handling and empty buckets.
taggingapi/​tag/​tag_sync_state.go Uses error-aware state reads.
taggingapi/​tag/​tag_sync_handler.go Adds sanitized status-loading and run lookup.
taggingapi/​tag/​tag_sync_handler_test.go Tests missing run IDs.
taggingapi/​tag/​tag_member_service.go Adopts error-aware tag-store reads.
taggingapi/​tag/​query_rows.go Implements error-aware Cassandra queries.
taggingapi/​tag/​query_rows_test.go Tests read-error sanitization.
taggingapi/​router.go Registers run-specific status route.
contrib/​docs/​tagging_service_API_documentation.md Documents status and empty-bucket behavior.
common/​const_var.go Defines the run ID route key.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread taggingapi/tag/tag_member_service.go
Comment thread taggingapi/tag/tag_member_service.go

@coolwater coolwater left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. ✅
Reviewed the changes and did not find any blocking issues. The update improves tag sync resilience by correctly distinguishing stale/empty buckets from Cassandra read failures, adds good coverage around run status retrieval and error sanitization, and supports safer operational use of tag refresh workflows. The logic and tests look consistent with the intended behavior.

@mdolina
mdolina merged commit 6728433 into main Oct 2, 2026
7 of 8 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 2, 2026
@mdolina
mdolina deleted the fix/tag-sync-empty-bucket branch October 2, 2026 17:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants