Skip to content

Allow png previews#10561

Open
zhiltsov-max wants to merge 16 commits intozm/add-media-typefrom
zm/png-previews
Open

Allow png previews#10561
zhiltsov-max wants to merge 16 commits intozm/add-media-typefrom
zm/png-previews

Conversation

@zhiltsov-max
Copy link
Copy Markdown
Contributor

@zhiltsov-max zhiltsov-max commented May 4, 2026

Motivation and context

Depends on #10538

Currently, the server uses the jpg file extension for previews. Although, the format is good in general, files are limited to only 3 channels, so no alpha channel can be used. Previews with alpha channel can be reliably recolored by the presenter to a different color, if required.

  • Allowed both png and jpeg previews
  • Fixed invalid handling for exceptions in the /api/jobs/<id>/data endpoint

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@zhiltsov-max zhiltsov-max requested a review from SpecLad as a code owner May 4, 2026 17:36
@zhiltsov-max zhiltsov-max force-pushed the zm/png-previews branch 3 times, most recently from d5e18e0 to 6651158 Compare May 4, 2026 17:42
@zhiltsov-max zhiltsov-max changed the title Change default preview extension to png Allow png previews May 4, 2026
sveta-cvat and others added 15 commits May 4, 2026 20:55
Without this, tests with the XPASS result don't fail the testsuite,
which IMO makes xfail pointless - it's basically the same as skipping
the test.
I inadvertently broke this in #10106 by changing the order of file
operations in `PcdReader.convert_bin_to_pcd`. The current version of
`read_raw_images` saves the `.bin` file with a `.pcd` extension and then
tries to convert it to the PCD format. `convert_bin_to_pcd` opens the
output file first; but in this case the input and output paths are the
same, so this truncates the input file to 0 bytes before
`convert_bin_to_pcd` can read it.

We could probably reorder the opens again to fix this, but IMO, this
scheme with saving the `.bin` file with a `.pcd` extension is rather
confusing and it's better to fix this instead. Save the file with its
original extension and let `convert_bin_to_pcd` save the output to a new
file instead.

In addition, fix a bug in `HeaderFirstDownloader` that prevents a task
from being created if a `.bin` file is small. This is needed for the
test to work. The problem is that
`_HeaderFirstPcdDownloader.try_parse_header` always returns False, so if
the entire file fits within `headers_to_try[0]` bytes, the loop will
then try to download a range that doesn't exist. Fix it by detecting
that there is no more data left to download and exiting early.
- [x] I submit my changes into the `develop` branch
- [x] I have updated the documentation accordingly
- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.

---------

Co-authored-by: Petr Iosipov <[email protected]>
Apparently `@uiw/react-md-editor` has insecure defaults,
so an attacker can easily execute custom JavaScript as described here:
<https://uiwjs.github.io/react-md-editor/#security>.

Fix it using the method recommended in the docs.
Label attribute with value type Checkbox displays `True`/`False` which does not match the case on the canvas. The PR uses lowercase in label editor
## Summary
This is **PR 2** in the split series for the large test-infra branch.

Base PR:
- #10494 `Tests: stabilize local Python and Cypress baselines`

This PR is intentionally small and backend-only. It builds on top of PR
1 because PR 1 contains the baseline test fixes needed to validate the
later series reliably.

## What changed
- harden chunk job failure reconstruction in `cvat/apps/engine/cache.py`
- if rebuilding the original exception from stored type/args fails,
raise a stable `ChunkCreationError` instead of masking the real failure
with a secondary constructor error
- make S3 cloud-storage status probes fail fast in
`cvat/apps/engine/cloud_provider.py`
  - use a dedicated low-timeout client for status checks
- degrade only transport-level reachability failures
(`ConnectTimeoutError`, `EndpointConnectionError`, `ReadTimeoutError`)
- keep `ClientError` handling separate so existing `403/404` semantics
are preserved

## Why this PR exists separately
These changes are independent from the pytest runtime / kube / CI
refactor. They are backend robustness fixes and can be reviewed on their
own.

## Validation
Local checks completed on this branch:
- `py_compile`
- `black --check --diff`
- `isort --check --diff --resolve-all-configs`
- `pylint`
- `typos` on the changelog fragment
- `remark` on the changelog fragment

## Changelog
- added a dedicated PR fragment for the backend robustness changes
<!-- Raise an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the [Contribution guide](https://docs.cvat.ai/docs/contributing/).
-->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable for some reason, then ~~explicitly
strikethrough~~ the whole
line. If you don't do that, GitHub will show incorrect progress for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [ ] I submit my changes into the `develop` branch
- [ ] I have created a changelog fragment <!-- see top comment in
CHANGELOG.md -->
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] I have linked related issues (see [GitHub docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))

### License

- [ ] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.38 to 8.5.10.

Co-authored-by: Kirill Lakhov <[email protected]>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 27 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cvat/apps/engine/cache.py 71.73% 13 Missing ⚠️
cvat/apps/engine/task.py 77.77% 8 Missing ⚠️
cvat/apps/engine/cloud_provider.py 63.63% 4 Missing ⚠️
cvat/apps/engine/views.py 92.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@zhiltsov-max zhiltsov-max changed the base branch from develop to zm/add-media-type May 5, 2026 10:44
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.

8 participants