fix: allow deleting predictions with missing model version#9735
Open
Snehadas2005 wants to merge 1 commit into
Open
fix: allow deleting predictions with missing model version#9735Snehadas2005 wants to merge 1 commit into
Snehadas2005 wants to merge 1 commit into
Conversation
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This was referenced May 10, 2026
4 tasks
kcw2034
added a commit
to kcw2034/label-studio
that referenced
this pull request
May 11, 2026
…ersion Issue HumanSignal#9717 — imported predictions whose model_version was missing could not be deleted via DELETE /api/projects/<pk>/model-versions. Three legacy import paths defaulted the field to the literal string 'undefined' while other paths stored NULL, and the FE echoed those values back to a delete endpoint that rejected anything falsy. Backend - Three import sites (data_import/api.py × 2, tasks/serializers.py) now store None instead of 'undefined' when the field is missing from input. - DELETE /api/projects/<pk>/model-versions accepts JSON null, empty string, and the legacy 'undefined' string as "no model version" and routes them through a single isnull-aware delete path. - Project.delete_predictions(None) sweeps NULL / '' / 'undefined' together so callers do not have to know about the pre-migration data layout. - Migration tasks/0062 backfills 'undefined' rows to NULL. Frontend - PredictionsList renders "No model version" with an explanatory tooltip for falsy and legacy-'undefined' values; the stale === "undefined" comparison is gone. Tests - projects/tests/test_api.py adds TestDeletePredictionsAPI covering specific version, JSON null, empty string, legacy 'undefined', mixed null-ish sweep, and missing-key 400. Related: review of upstream PR HumanSignal#9735. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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 issue #9717 where predictions from imported tasks couldn't be deleted due to a missing
model_version.Changes
api.py: Mademodel_versionoptional and added handling forundefined/nullstrings sent by the frontend.models.py: Updateddelete_predictionsto usemodel_version__isnull=Truewhen targeting null versions.Testing
Verified via
curlto simulate the React frontend payload:curl -X DELETE ... -d '{"model_version": "undefined"}'200 OKand{"deleted_predictions": X}.RestValidationError.Screenshots
DELETErequest returning a successful 200 status code instead of a 400 validation errorundefinedas a version and returns a valid count of deleted predictions