Skip to content

Show: refuse a show.start from that is not a slide - #1228

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
marcoarnulfo:feat/show-start-from
Oct 23, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
marcoarnulfo:feat/show-start-from

Conversation

@marcoarnulfo

@marcoarnulfo marcoarnulfo commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

show.start now refuses a from that is not a slide of the deck instead of quietly playing something else.

Before, {"from": -1}, {"from": 1.5} or {"from": "1"} started the show on slide 0, and a from past the end opened a show already on the end screen, with an ok answer both through the command and the control channel. Both paths now go through one check and answer with an error (`from` is not a valid index: -1, no slide 3), the same way the slide commands reject a bad index since #1063. A hidden slide is still accepted, since From Current Slide plays a hidden slide. from: null now means "no from" (the first slide of the show order) rather than slide 0; happy to switch if you'd rather keep that. With no document open, {"from": 0} now answers no slide 0 instead of an ok that did nothing; show.start {} is unchanged. An unknown custom show name still does nothing silently; I left that alone here.

Validation:

  • tests::show_start_refuses_a_from_that_is_not_a_slide: fails on main (show.start {"from": -1} answers ok and starts at slide 0), passes here
  • reverting only the control channel change makes it fail again ({"ok":true,"result":null} for -1)
  • cargo test -p deckcraft-ui-egui --lib -- show texture_limit slide_size, cargo clippy -p deckcraft-ui-egui --all-targets -- -D warnings, cargo fmt --all -- --check
  • (macOS, Apple silicon)

Summary by CodeRabbit

  • Bug Fixes

    • Starting a show with an invalid, negative, non-integer, or out-of-range slide position now returns an error instead of silently starting at another position. Hidden slides remain playable.
    • Missing or null positions use the usual starting point.
  • Documentation

    • Clarified the accepted slide positions for starting a show.

show.start {from} turned a negative or fractional index into slide 0 and an index past the end into a show that opened on the end screen, over the command and the control channel alike. Both now refuse it, as the slide commands do since storytold#1063; a hidden slide still plays.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between b47195f and 90d40e2.

📒 Files selected for processing: 3
  • crates/ui-egui/src/control.rs
  • crates/ui-egui/src/lib.rs
  • docs/control-protocol.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The show.start flow now validates explicit from positions and returns errors for invalid values. Missing or null positions use the usual start index. Valid hidden-slide positions remain playable.

Changes: Show start position validation

Layer / File(s) Summary
Validate and start a show
crates/ui-egui/src/lib.rs, crates/ui-egui/src/control.rs, docs/control-protocol.md
show.start validates explicit positions and uses the usual start index when from is absent or null. Tests cover invalid values, valid hidden slides, and both entry paths. The protocol documentation describes the validation rules.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: echelon, nikitkara

Merge Risk: ⚪ Minimal · up to 90d40

No actionable issue was identified in the show-start position change; it appears ready to merge after normal checks.

Security architecture risk: ⚪ Minimal · up to 90d40

The change restricts invalid slide-start requests before playback changes, without adding access or authority. No introduced or worsened security issue was found in the reviewed flow.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed operation remains scoped to playback of the active deck in the current application instance. Existing control clients gain no new command or transport authority; invalid positions now have less ability to alter presentation state.

Trust Boundaries and Controls

  • observed — Caller-controlled from values must parse as nonnegative integers, fit usize, and fall within the active deck's slide count before reaching the playback constructor. Both the command and direct control paths enforce this check and propagate rejection rather than reporting success.

Resilience and Maintainability Implications

  • observed — Existing timeout handling distinguishes abandoned queued requests from requests already taken by the application. Abandoned requests are skipped before dispatch; already-started requests retain an explicitly unknown outcome on timeout. The validation change preserves this recovery behavior.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Show: refuse a show.start from that is not a slide" matches the main change in the changeset. The raw summary and the PR objectives both show that show.start now rejects a from value that d…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Show: refuse a show.start from that is not a slide" matches the main change in the changeset. The raw summary and the PR objectives both show that show.start now rejects a from value that does not identify a slide, in both the command path (lib.rs run_ui) and the control-channel path (control.rs). Invalid, negative, non-integer, or out-of-range values return errors, hidden slides stay allowed, and docs/control-protocol.md is updated to match. The title is specific and concise, and it names the behavior change a teammate scanning history would need to see.

Full details: Docstring Coverage

Explanation

Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit ddeef2d into storytold:main Oct 23, 2026
3 checks passed
@echelon

echelon commented Oct 23, 2026

Copy link
Copy Markdown
Member

Landed on main — thank you for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft

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.

3 participants