Skip to content

fix(perspective-crop): run imported Perspective Crop steps in Batch and droplet runs - #20736

Open
Higgs32584 wants to merge 1 commit into
storytold:mainfrom
Higgs32584:fix/20730-droplet-perspective-crop
Open

Higgs32584 wants to merge 1 commit into
storytold:mainfrom
Higgs32584:fix/20730-droplet-perspective-crop

Conversation

@Higgs32584

@Higgs32584 Higgs32584 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

A droplet or Batch step list made from an action with a loaded Perspective Crop now crops instead of failing.

Fixes #20730.

What the user saw: running a droplet built from an action that holds an imported (ATN) Perspective Crop step failed that step with "a recorded Perspective Crop descriptor may only run during action playback".

Cause: perspective_crop (follow-up to #20166) accepted the recorded descriptor only when recording.playing > 0. A droplet runs its stored steps as an explicit step list: through file.automate.batch with steps (not a named action, so playing stays 0), or for Destination None through s.execute in run_droplet_open. Neither raises playing.

Change: the guard in crates/engine-core/src/cmd/perspective_crop_cmds.rs also accepts recording.batch_depth > 0. Both Batch's run (folder and open-documents sources) and run_droplet_open raise batch_depth for their steps, so both droplet paths are covered by this one condition. A direct call with the descriptor outside any playback or batch is still refused. Script runs of saved steps (mentioned as "likely" in the issue) are not changed here.

Test: perspective_crop_atn_runs_in_a_batch_step_list_but_not_directly in crates/engine-core/src/cmd/atn_cmds/perspective_crop_step_tests.rs loads an ATN Perspective Crop, checks that a direct call with the imported params is refused, then runs the same step through file.automate.batch with a steps list on the open document and checks the run has no errors and the canvas shrank. Without the fix it fails with the refusal error in the batch's errors.

Verification (local):

  • Ran: cargo test -p photocraft-engine-core --lib perspective_crop (60 passed; the new test failed before the fix), cargo clippy -p photocraft-engine-core --all-targets -- -D warnings (clean), cargo fmt --check (clean).
  • Not run locally: the full photocraft-engine-core test suite, cargo xtask layers, cargo xtask wasm, the panic_hunt sweep, and the corpus tests; left to CI.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Recorded Perspective Crop steps now run in batch workflows. Direct command calls outside action playback or batch execution remain unavailable.

…nd droplet runs

A droplet plays its action's stored steps as a step list through Batch (or
directly for Destination None), where no named action raises the playback
counter, so a loaded Perspective Crop step was refused. Batch and droplet
runs raise batch_depth; accept the recorded descriptor there too. A direct
call outside playback is still refused.

Fixes storytold#20730

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Perspective Crop descriptor guard now permits execution during batch processing when action playback is inactive. A test verifies that direct execution remains rejected and that execution through an explicit batch step list succeeds.

Changes: Perspective Crop batch execution

Layer / File(s) Summary
Batch guard and execution test
crates/engine-core/src/cmd/perspective_crop_cmds.rs, crates/engine-core/src/cmd/atn_cmds/perspective_crop_step_tests.rs
The descriptor guard rejects execution only when playback is inactive and batch depth is zero. The test checks direct rejection, then runs the descriptor through an explicit batch step list and verifies no errors and reduced document dimensions.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Issue 18090 concerns headless playback of stored Perspective Crop parameters. This change enables the explicit batch execution path, but does not cover its interactive dialog-toggle session.

Suggested reviewers: yoriswind, hnoerenberg

Merge Risk: Minimal · up to e9fa3

Imported Perspective Crop steps now run in Batch and droplet runs, while direct calls outside playback or a batch are still refused. No merge-blocking risk was found. Script runs of saved steps are intentionally unchanged.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: imported Perspective Crop steps now run in Batch and droplet runs. The raw summary and objectives confirm the guard in perspective_crop_cmds.rs now accepts the recorde…
Linked Issues check Passed [#20730] Requirement: a droplet or Batch step list must not refuse an imported (ATN) Perspective Crop step. The guard in crates/engine-core/src/cmd/perspective_crop_cmds.rs now accepts the recorded …
Out of Scope Changes check Passed The PR changes two files according to the summary: the Perspective Crop guard (+2/-1) and a new test (+16/-0). Both match #20730 directly. The PR description and objectives describe no other change. T…
Full details: Title check

Explanation

The title names the main change: imported Perspective Crop steps now run in Batch and droplet runs. The raw summary and objectives confirm the guard in perspective_crop_cmds.rs now accepts the recorded descriptor during batch execution (batch_depth > 0), which covers the Batch and run_droplet_open paths. The title does not mention that script runs are deliberately unchanged, but it does not need to cover every detail. The fix prefix matches the change.

Full details: Linked Issues check

Explanation

[#20730] Requirement: a droplet or Batch step list must not refuse an imported (ATN) Perspective Crop step. The guard in crates/engine-core/src/cmd/perspective_crop_cmds.rs now accepts the recorded descriptor when recording.batch_depth &gt; 0, in addition to recording.playing &gt; 0. This is the fix the issue proposes. The PR summary also lists a new test, perspective_crop_atn_runs_in_a_batch_step_list_but_not_directly, in crates/engine-core/src/cmd/atn_cmds/perspective_crop_step_tests.rs. It checks that a direct call is still refused and that file.automate.batch with steps runs the step without errors and shrinks the canvas. Script runs of saved steps are deferred, as the issue allows. Limits of this review: the source diff could not be read (changed blobs unavailable), and the guard line itself was not confirmed. The claim that run_droplet_open and Batch raise batch_depth is taken from the PR description and the summary, not from code I read. The reported local test results were not reproduced.

Full details: Out of Scope Changes check

Explanation

The PR changes two files according to the summary: the Perspective Crop guard (+2/-1) and a new test (+16/-0). Both match #20730 directly. The PR description and objectives describe no other change. The summary states no declaration changes to exported or public entities. Limit: the source diff could not be read, so the line-level content is supported only by the summary and PR description.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between deea726 and e9fa309.

Files selected for processing: 2

  • crates/engine-core/src/cmd/atn_cmds/perspective_crop_step_tests.rs
  • crates/engine-core/src/cmd/perspective_crop_cmds.rs

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

This branch has not been deployed

No deployments
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.

Imported Perspective Crop steps are refused when a droplet runs the action

1 participant