fix: prevent adding cameras with invalid model names (#1162)#1165
Open
COZYTRICKSTER wants to merge 6 commits intoopen-edge-platform:release-2025.2from
Open
fix: prevent adding cameras with invalid model names (#1162)#1165COZYTRICKSTER wants to merge 6 commits intoopen-edge-platform:release-2025.2from
COZYTRICKSTER wants to merge 6 commits intoopen-edge-platform:release-2025.2from
Conversation
Author
tdorauintc
requested changes
Mar 12, 2026
Contributor
tdorauintc
left a comment
There was a problem hiding this comment.
@COZYTRICKSTER thank you for your contribution.
For the sake of code maintainability and reliability, I would advice to try to reuse existing code for validation. Please see my comments.
Replace manual model validation in CamCreateForm.clean_camerachain() with parse_model_chain() from ppl_generator. This aligns validation with the existing pipeline parser and ensures future compatibility with potential chain syntax changes. Also includes minor indentation fixes.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds server-side validation to prevent cameras being created with a camerachain that references models not present in the configured model-config, avoiding “camera exists but nothing processes/tracks” states.
Changes:
- Add
CamCreateForm.clean_camerachain()validation that parses the model chain againstmodel_config.jsonand rejects invalid models. - Override
CamCreateView.form_invalid()to return HTTP 400 on validation failure.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| manager/src/django/forms.py | Adds camerachain validation by loading model-config and calling parse_model_chain() during camera creation. |
| manager/src/django/views.py | Returns 400 status for invalid camera-create form submissions. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
tdorauintc
approved these changes
Mar 25, 2026
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.


📝 Description
When adding a camera, the system allowed specifying a model name that does not exist in the configured model list (
model-config). The camera would still be created successfully even though the model was invalid.This could result in a confusing state where:
This change introduces validation during camera creation to ensure that the provided model name exists in
model-config. If the model is not found, the request is rejected with a validation error.Fixes #1162
🔍 Behavior Before / After
Before
model-config.After
model-config, the request is rejected with an appropriate validation error.✨ Type of Change
🧪 Testing Scenarios
Tested locally by attempting to add a camera with both valid and invalid model names. Verified that:
✅ Checklist