Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
AI-generated review (Claude Opus 5.5). Not a maintainer decision.
No blocking problems found (not certain).
PDF export now returns a bad-parameters error for slides values that are not a list or a range string. Omitted, null and blank values still select all visible slides.
- crates/engine/src/cmd/file.rs:402-403: arm order is right. Non-blank strings are handled by the guarded arm, blank strings and null fall through to None, and every other JSON type returns BadParams.
- crates/engine/src/cmd/file.rs:835-846: the test checks the error variant, the command name and that the existing destination keeps its bytes. It removes the scratch directory before asserting, so a failure does not leave files behind.
- crates/engine/src/cmd/file.rs:400: array entries that are not non-negative integers are still dropped silently. A list such as ["1"] gives an empty selection rather than an error; that could be a follow-up.
- Other exporters that accept a
slidesoption may share the old fallback and would need the same change.
Claims checked:
- verified: A number, boolean or object
slidesvalue now returns a bad-parameters error instead of exporting every visible slide. (crates/engine/src/cmd/file.rs:403Some(_) => return Err(bad("file.export", ...))catches every remaining JSON type. The test at crates/engine/src/cmd/file.rs:840-843 asserts En… - verified: Omitted, null and blank range values keep their previous meaning (no slide filter). (crates/engine/src/cmd/file.rs:401 handles non-blank strings first. crates/engine/src/cmd/file.rs:402
None | Some(Value::Null | Value::String(_)) => Nonemaps omitted, null and blank strings to None, as the old `_… - verified: The original code treated invalid types as an omitted selector. (The removed line at crates/engine/src/cmd/file.rs:402 (
_ => None) mapped every non-array, non-blank-string value to None.) - unverified: The error is reported before the destination is written, so an existing file stays unchanged. (The file.export call site that orders pdf_options before the write is not in the diff. The new test at crates/engine/src/cmd/file.rs:835-846 asserts the original bytes remain after the failed export.)
Reviewed at 7b98875.
Recommendation: merge, after a maintainer's decision.
DeckCraft’s PDF export rejects malformed
slidesvalues before writing the destination.A number, boolean, or object was treated as an omitted selector. A caller could therefore export every visible slide and overwrite the destination by mistake. The PDF option parser now accepts the existing list and range forms and reports unsupported types. Omitted,
null, and blank range values keep their previous meaning.invalid_pdf_slide_selector_keeps_the_existing_destinationexercisesfile.exportagainst a seeded file and checks the error and original bytes. Eight isolated Rust checks passed using the PDF option parser and realserde_json; the original code accepted all three invalid types. The full DeckCraft engine suite, file-writing regression, and Clippy were not run locally.Summary by CodeRabbit