Skip to content

fix(graph): roll back tag assignment when TagsAdded cannot be published - #13295

Merged
LukasHirt merged 2 commits into
owncloud:masterfrom
pujitha24:auto/issue-13286
Nov 3, 2026
Merged

LukasHirt merged 2 commits into
owncloud:masterfrom
pujitha24:auto/issue-13286

Conversation

@pujitha24

Copy link
Copy Markdown
Contributor

Description

AssignTags now restores the previous tags and answers 500 when the TagsAdded event cannot be published, mirroring what UnassignTags already does for TagsRemoved. Previously it logged the error and answered 200, leaving the file tagged but missing from the tag list and tag: search.

Related Issue

Motivation and Context

The search service only learns of tag changes through TagsAdded, and re-indexing does not pick up tag-only changes, so a lost event is never repaired.

How Has This Been Tested?

  • test environment: local, macOS
  • test case 1: new ginkgo test in services/graph/pkg/service/v0 with a failing publisher expects 500 and a metadata call restoring the old tags. It fails without the fix and passes with it (go test ./services/graph/pkg/service/v0/).
  • test case 2: success path still answers 200 with a single metadata write.
  • Not run: the NATS-based reproduction against a live server. The rollback is not atomic against concurrent tag changes, same as the existing removal path.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised: not needed

Fixes #13286

Motivation: AssignTags writes the tags to the file metadata and then
publishes TagsAdded. If the publish failed, it only logged the error and
answered 200. The search service learns of tag changes only through that
event, so the file carried the tag while the tag list and `tag:` search
never saw it. A re-index does not repair this because a tag change moves
neither mtime nor etag. The DELETE handler already treats a failed
publish as an error (restore previous tags, answer 500).

Approach: on a failed publish, AssignTags now restores the previous tags
and answers 500, mirroring publishTagsRemoved. As there, the rollback is
not atomic against concurrent tag changes.

Validation: added a ginkgo test in services/graph/pkg/service/v0 that
makes the publisher fail and expects 500 plus a SetArbitraryMetadata call
restoring the old tags. It fails without the change and passes with it.
`go test ./services/graph/pkg/service/v0/` passes. I did not run the
NATS-based reproduction from the issue against a live server.

Report: owncloud#13286
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5-5 (via Claude Code)
@pujitha24
pujitha24 requested a review from a team as a code owner November 2, 2026 19:21
@kw-security

kw-security commented Nov 2, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@LukasHirt LukasHirt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for fixing this issue! Just a minor request to add the link. Btw, I have seen you've been quite active with contributions to oCIS (thank you very much for this, we appreciate this a lot!), feel free to check out the following content we're currently running - https://github.com/orgs/owncloud/discussions/22 I'd recommend to submitting your contributions there.

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
@pujitha24

Copy link
Copy Markdown
Contributor Author

Added the PR link above the issue link in the changelog entry. And thanks for pointing me at the discussion, I'll look through it.

@LukasHirt
LukasHirt merged commit fdb990f into owncloud:master Nov 3, 2026
148 of 150 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assigning a tag answers 200, but the tag never reaches the tag list or search when publishing TagsAdded fails

3 participants