This is a submission for DEV's Summer Bug Smash: Clear the Lineup (https://dev.to) powered by Sentry (https://sentry.io).
Project Overview
For this hackathon, I contributed to CVAT (Computer Vision Annotation Tool), an industry-standard open-source platform used by teams worldwide to annotate image and video datasets for machine learning models.
The Bug
While working inside CVAT's raw label text editor, users encountered a frustrating validation issue (#11034). When attempting to input perfectly valid numerical range configurations (such as 1;4;1), the validation engine incorrectly treated the numbers as duplicate strings.
Because the code mistook the formatted range layout for repetitive data, it triggered a false alarm and threw an incorrect Label name must be unique error. This completely blocked users from saving valid label schemas.
My Fix
I implemented a precise patch inside the validateLabels function located in raw-viewer.tsx to handle these range strings intelligently.
Instead of letting the validation array look at the raw input string directly, I introduced a targeted regular expression filter (/^\d+;\d+;\d+$/). This logic automatically identifies incoming numerical range structures and temporarily swaps them with unique, randomized placeholder tokens during the uniqueness check phase.
This simple yet effective intercept successfully clears the false-duplicate blocker while keeping CVAT's core security validation perfectly intact.
The codebase successfully compiled with the new change, and all automated testing suites on the repository have officially passed verification!
Top comments (0)