test: .zip data file uploads are stored as ZIP (DataSpaceBackend #206) - #136
Merged
Merged
Conversation
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.
Source: CivicDataLab/DataSpaceBackend#206 (merge
92ed2b7e, merged todev2026-09-24). Base:CI.The merge's own dev deploy failed provider-smoke and its rollback job also failed. The later dev deploy of
8850b1d6, which contains #206, succeeded, so dev is running this change.What changed (from the diff)
createFileResourcesaccepts a file only when its extension and its sniffed MIME type map to the same format (file_validation,api/utils/file_utils.py). The sniff usedmagic.from_buffer, and the server's libmagic (5.46) reports a zip buffer asapplication/octet-stream. That maps to no format, so every.zipupload failed withUnsupported file format.#206 sniffs the stored file withmagic.from_filewhen it has a path, which reportsapplication/zip→ZIP.What this adds
tests/api/smoke/test_api_011_zip_upload.py(api+smoke):test_zip_datafile_is_accepted_as_zip: create a draft dataset, upload a small real.zipthrough the same GraphQL multipart request the dataset editor sends, and assert no errors andfileDetails.format == "ZIP".test_zip_bytes_named_csv_are_rejected: a control. The same zip bytes named.csvmust still be refused asUnsupported file format. This shows the first test passes because zips are recognised, not because validation stopped running. It passed before #206 too.Each test creates one draft dataset and deletes it in teardown. Not
readonly: it writes, so the prod gate (suite: readonly) never selects it.Why these categories: a backend upload-validation fix is API behaviour, so
api. It'ssmokeso it actually runs:api-smokeselects-m "smoke", and aregression-only test would never run on any event. No UI test: the dataset editor just passes the backend's error through.Proof (local, against dev)
Collected under CI's filter:
Green:
Red (assertions flipped: expect
CSV; expect the rejection to be absent):Reverted →
2 passed in 1.92s.Gaps
Rollback (smoke tests failed)job itself failed (run 36008274802). A later successful deploy covered it, but a failing rollback is worth a separate look.