GRI-1856: media acceptance tests (AC-3-01..AC-3-07) #100

Merged
vivy merged 1 commit from test/GRI-1856-media-acceptance-tests into dev 2026-11-10 01:28:09 +00:00
Member

Independent acceptance tests for plan/tests/mvp-acceptance.md section 3 ("Media"), AC-3-01 through AC-3-07, derived from the spec table and plan/server/rest-api.md / plan/server/media-pipeline.md — not from reading crates/server/tests/media_integration.rs (the implementer-authored test file that merged with the feature in PR #95, flagged separately on GRI-1856).

New file crates/server/tests/media_acceptance_integration.rs, reusing the real-TCP harness (tests/support::TestServer) from PR #92/#96. Added support::send_bytes since multipart file bodies are not valid UTF-8 and the existing support::send only takes &str.

Criterion-to-test mapping

  • ac_3_01_uploading_an_image_stores_it_with_a_checksum_and_lists_one_image_item
  • ac_3_02_uploading_a_video_stores_the_original_with_its_checksum
  • ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_page (#[ignore]d, see below)
  • ac_3_04_adding_a_url_creates_a_url_item_with_no_stored_file
  • ac_3_05_an_upload_with_no_file_is_rejected_and_creates_no_item
  • ac_3_06_a_corrupt_pdf_fails_cleanly_and_creates_no_item
  • ac_3_07_an_unauthenticated_upload_is_refused_and_stores_nothing

Fail-first, run against dev as merged

$ SIGNAGE_TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable \
  cargo test -p server --test media_acceptance_integration -- --test-threads=1 --include-ignored
...
test ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_page ... FAILED

thread 'ac_3_03_...' panicked at crates/server/tests/media_acceptance_integration.rs:276:5:
assertion `left == right` failed: expected the PDF upload to be accepted, got 400 with body
{"code":"unsupported_media_type","message":"PDF upload is not wired to the page converter yet"}
  left: 400
 right: 201

test result: FAILED. 6 passed; 1 failed; 0 ignored

The other 6 pass for real against the real routes.

Findings (not blocking this PR)

  1. AC-3-03 is genuinely not implemented yet, and is #[ignore]d with that reason. POST /media refuses every PDF outright (pdf_not_yet_supported in crates/server/src/media/handlers.rs). The page converter is GRI-1868 / signage #15a (forge PR #97, open with a merge conflict as of 2026-11-10); wiring it in is tracked separately as signage #15b per the handler's own comment. Un-ignore once both land.
  2. AC-3-02's "background conversion job is created; the panel can show its progress" has no API surface to test against, at all. upload_media stores a video row synchronously and returns 201 immediately — classified, checksummed, listed — exactly like an image. There is no job id, status or progress field anywhere in MediaView. This is a contract gap, not a missing test: nothing in the REST or WebSocket surface documents what a client would read to show progress. I wrote the test for the part that is implemented (original stored with its checksum) and left the job/progress half out rather than encode an assertion against a field that doesn't exist. Flagging for the CTO to decide whether this needs a design addition before the MVP test week, or is deliberately deferred.

Repeating from my earlier comment on GRI-1856, for visibility here too: media_integration.rs (PR #95) was written by the feature's own implementer rather than independently from the spec, which is the separation this role exists to keep. This PR is the independent version, mapped to the acceptance-criteria IDs the implementer's tests don't use.

Independent acceptance tests for `plan/tests/mvp-acceptance.md` section 3 ("Media"), AC-3-01 through AC-3-07, derived from the spec table and `plan/server/rest-api.md` / `plan/server/media-pipeline.md` — not from reading `crates/server/tests/media_integration.rs` (the implementer-authored test file that merged with the feature in PR #95, flagged separately on GRI-1856). New file `crates/server/tests/media_acceptance_integration.rs`, reusing the real-TCP harness (`tests/support::TestServer`) from PR #92/#96. Added `support::send_bytes` since multipart file bodies are not valid UTF-8 and the existing `support::send` only takes `&str`. ## Criterion-to-test mapping - `ac_3_01_uploading_an_image_stores_it_with_a_checksum_and_lists_one_image_item` - `ac_3_02_uploading_a_video_stores_the_original_with_its_checksum` - `ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_page` (`#[ignore]`d, see below) - `ac_3_04_adding_a_url_creates_a_url_item_with_no_stored_file` - `ac_3_05_an_upload_with_no_file_is_rejected_and_creates_no_item` - `ac_3_06_a_corrupt_pdf_fails_cleanly_and_creates_no_item` - `ac_3_07_an_unauthenticated_upload_is_refused_and_stores_nothing` ## Fail-first, run against `dev` as merged ``` $ SIGNAGE_TEST_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable \ cargo test -p server --test media_acceptance_integration -- --test-threads=1 --include-ignored ... test ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_page ... FAILED thread 'ac_3_03_...' panicked at crates/server/tests/media_acceptance_integration.rs:276:5: assertion `left == right` failed: expected the PDF upload to be accepted, got 400 with body {"code":"unsupported_media_type","message":"PDF upload is not wired to the page converter yet"} left: 400 right: 201 test result: FAILED. 6 passed; 1 failed; 0 ignored ``` The other 6 pass for real against the real routes. ## Findings (not blocking this PR) 1. **AC-3-03 is genuinely not implemented yet, and is `#[ignore]`d with that reason.** `POST /media` refuses every PDF outright (`pdf_not_yet_supported` in `crates/server/src/media/handlers.rs`). The page converter is GRI-1868 / signage #15a (forge PR #97, open with a merge conflict as of 2026-11-10); wiring it in is tracked separately as signage #15b per the handler's own comment. Un-ignore once both land. 2. **AC-3-02's "background conversion job is created; the panel can show its progress" has no API surface to test against, at all.** `upload_media` stores a video row synchronously and returns 201 immediately — classified, checksummed, listed — exactly like an image. There is no job id, status or progress field anywhere in `MediaView`. This is a contract gap, not a missing test: nothing in the REST or WebSocket surface documents what a client would read to show progress. I wrote the test for the part that is implemented (original stored with its checksum) and left the job/progress half out rather than encode an assertion against a field that doesn't exist. Flagging for the CTO to decide whether this needs a design addition before the MVP test week, or is deliberately deferred. Repeating from my earlier comment on GRI-1856, for visibility here too: `media_integration.rs` (PR #95) was written by the feature's own implementer rather than independently from the spec, which is the separation this role exists to keep. This PR is the independent version, mapped to the acceptance-criteria IDs the implementer's tests don't use.
GRI-1856: media acceptance tests (AC-3-01..AC-3-07)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 5s
CI / cargo fmt (pull_request) Successful in 5s
CI / cargo deny (pull_request) Successful in 51s
CI / cargo deny advisories (pull_request) Failing after 43s
CI / repository boundary (pull_request) Successful in 7s
CI / cargo clippy (pull_request) Successful in 9m52s
CI / cargo test (pull_request) Successful in 10m35s
CI / frontend-web (pull_request) Successful in 9m42s
CI / CI (pull_request) Successful in 2s
CI / Notify gate failed (pull_request) Has been skipped
b601d9db00
vivy merged commit 7b3727cd4f into dev 2026-11-10 01:28:09 +00:00
vivy deleted branch test/GRI-1856-media-acceptance-tests 2026-11-10 01:28:10 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!100
No description provided.