Repository navigation
refactor(api): update tag name with a single UPDATE statement - #42449
Merged
asukaminato0721 merged 1 commit intoSep 18, 2026
Merged
asukaminato0721 merged 1 commit into
asukaminato0721 merged 1 commit into
Conversation
Replace the load-mutate-commit flow in TagService.update_tags with a targeted UPDATE ... RETURNING executed via update(Tag).where(...).values(name=...), matching the existing convention in DatasetService.update_dataset. synchronize_session="fetch" keeps the returned Tag instance in sync, so callers still observe the new name right after the call. Fixes langgenius#38419
Contributor
Pyrefly Type Coverage
|
asukaminato0721
enabled auto-merge
September 17, 2026 22:36
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #42449 +/- ##
=======================================
Coverage 87.40% 87.40%
=======================================
Files 5462 5462
Lines 315635 315635
Branches 63612 63612
=======================================
+ Hits 275867 275868 +1
Misses 34385 34385
+ Partials 5383 5382 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wylswz
approved these changes
Sep 18, 2026
CodeTrainerMan
deleted the
refactor/use-update-stmt-in-tag-service-38419
branch
September 18, 2026 09:56
CodeTrainerMan
restored the
refactor/use-update-stmt-in-tag-service-38419
branch
October 10, 2026 10:44
CodeTrainerMan
deleted the
refactor/use-update-stmt-in-tag-service-38419
branch
October 10, 2026 10:44
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
Fixes #38419
TagService.update_tagspreviously loaded theTagentity, mutatedtag.name, and relied on the flush/commit to write it back. This PR applies the rename with a single targeted statement instead:DatasetService.update_dataset.synchronize_session="fetch"keeps the returnedTaginstance in sync, so callers keep observing the new name right after the call. Verified with a minimal SQLAlchemy repro: the emitted SQL is a singleUPDATE ... RETURNINGand the in-memory entity already reports the new value before the commit.Tagmodel has no ORM event listener and noupdated_atcolumn, so skipping the attribute mutation does not drop any side effect.update_tagsis changed.save_tags,delete_tagand the binding helpers are untouched, because they insert or delete rows where there is nothing to gain.Verified locally:
ruff check,ruff format --checkandpyrefly checkonapi/services/tag_service.py(0 diagnostics). The fullmake lint/make type-checkwere not run locally because the optional vdb dependencies cannot be built in this Windows environment; CI covers them.Screenshots
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint gods