GRI-2147: fail-first acceptance test for playlist default-duration inheritance #281
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!281
Loading…
Reference in a new issue
No description provided.
Delete branch "test/GRI-2147-playlist-default-duration-inheritance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fail-first acceptance test for forge #277 / GRI-2147 ("Playlist ignores a later change of the default playtime"), written from the forge issue's own "Fix" and "Done when" text, before nyssa's implementation — same convention as
settings_playback_acceptance_integration.rs.One test,
a_global_default_change_reaches_an_inheriting_playlist_but_not_an_overridden_oneincrates/server/tests/ws_integration.rs, covering the issue's "Done when" verbatim as one scenario:default_duration_secondsstaysNULLin the DB, not silently pinned to 20);Both halves are one test because only together do they fail first for the right reason: the "own override survives" half already holds on
devtoday, by accident — nothing today reacts to a playback-settings change at all, for any playlist. It's the inheriting half that cannot even be set up without the schema change, so that's where the test fails:playlists.default_duration_secondsisNOT NULLtoday, so inserting the fixture playlist with no override fails on that constraint — a Postgres23502 not_null_violation, not a made-up assertion.Deliberately independent of nyssa's wire-contract proposal (comment 14113 on forge #277): the open question there is the admin-facing
GET/PUT /playlists/{id}JSON shape, which this test never touches — it drivesplaylists.default_duration_secondsdirectly (insert_playlist, the same shortcutinsert_approved_devicealready takes for/devices), so it proves the resolve-at-push-time and re-push behaviour regardless of what that contract ends up being.Fail-first run
The other 15 tests in the same file still pass unmodified.
Criterion-to-test mapping
a_global_default_change_reaches_an_inheriting_playlist_but_not_an_overridden_oneNot covered here (out of scope for this PR, flagged on the forge issue): the campus-override half of "Fix" bullet 3 (only global is in "Done when"); the PPTX-bake-in-at-upload question (nyssa already scoped that out, conflicting with
feature/GRI-2011-pptx-to-slide-images); and a migration-backfill test for existing rows (no migration file exists yet to test against).Test plan
cargo fmt -- --check crates/server/tests/ws_integration.rscargo clippy -p server --tests --all-features -- -D warningscargo test -p server --test ws_integration -- --include-ignored(15 passed, 1 new fail-first failure, as expected)Good test, and it fails for the right reason. It cannot merge on its own: a red cargo test on dev breaks the rule that dev stays green. Land it together with the #277 fix: the implementation goes on top of this branch (or this commit is taken into the fix branch), and the PR merges when cargo test is green.
Request changes. The server part is good: inheritance at push time, the re-push on a global or campus change, the double-option PATCH, the migration note. CI is green and the branch is up to date with
dev. Two things stop the merge, and the first one means #277 is not fixed for the product owner.1. A playlist made in the panel still copies the default (blocking).
frontend-web/src/screens/PlaylistsScreen.tsx:149callscreatePlaylist(name, 10, …), andCreatePlaylistRequest.default_duration_secondsis still a requiredi32. So every new playlist gets its own value10(source: "own"), and a later change of the campus or global default never reaches it. That is exactly the case the product owner reported in the demo. The migration only fixes playlists that exist today.Fix: make
default_duration_secondsoptional onPOST(omitted ornull= inherit), and let the panel omit it. Add a test: create through the API without a value, change the campus default, and the playlist reports the new value withsource: "campus".2. The panel still reads the old number shape (blocking).
frontend-web/src/api/httpPlaylistsApi.ts:25,49typesdefault_duration_secondsasnumber, andPlaylistMediaTab.tsx:123,165uses it as a number (placeholder and item default). With this PR the server sends{value, source}, so the Media tab shows[object Object]and the per-item default is wrong.frontend-webCI is green only because the panel's tests mock the old shape.Fix: read
{value, source}in the wire types and mapvalueinto the playlist model. A test that feeds the new wire shape. Optional: show "inherited from campus/global" next to the value, likeCampusSettingsScreendoes.When both are in and CI is green on a head that is up to date with
dev, I merge.Re-review on
f3dded08: both change requests are fixed. POST without a value now stores NULL and returns the resolved {value, source} (9e5cfa9). The panel no longer sends 10 s on create and reads.valueeverywhere (f3dded0). CI green on all 7 required contexts. Approved.