Skip to content

Minor update#67

Merged
AlanRockefeller merged 4 commits into
mainfrom
test
Apr 9, 2026
Merged

Minor update#67
AlanRockefeller merged 4 commits into
mainfrom
test

Conversation

@AlanRockefeller

@AlanRockefeller AlanRockefeller commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Exiting crop mode now preserves the image's 90° rotation while still resetting straighten and crop box adjustments.
  • Refactor

    • Centralized crop-mode reset logic for more consistent and reliable behavior when cancelling or toggling crop mode; UI refreshes appropriately.

@coderabbitai

coderabbitai Bot commented Apr 9, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a68b4bb6-d9b1-41f4-9ffe-6eb55e015c7c

📥 Commits

Reviewing files that changed from the base of the PR and between c0a3bdb and c20d602.

📒 Files selected for processing (1)
  • faststack/app.py

Walkthrough

Added _reset_crop_only() to exit crop mode and restore crop/straighten state while preserving 90° rotation; refactored _reset_crop_settings() to delegate to it and also clear rotation; updated cancel_crop_mode() and toggle_crop_mode() to use _reset_crop_only(); entering crop mode now increments ui_refresh_generation and triggers the preview worker.

Changes

Cohort / File(s) Summary
Crop-mode state refactor
faststack/app.py
Added _reset_crop_only() to clear crop box/straighten state without resetting 90° rotation. _reset_crop_settings() now calls _reset_crop_only() then resets backend/editor/UI rotation and straighten_angle. cancel_crop_mode() and toggle_crop_mode() updated to use _reset_crop_only(); toggle_crop_mode() also sets ui_state.isCropping = True, increments ui_refresh_generation, and kicks the preview worker when enabling crop mode.

Sequence Diagram(s)

sequenceDiagram
  participant UI
  participant AppController
  participant EditorBackend
  participant PreviewWorker

  UI->>AppController: enter crop mode (toggle_crop_mode)
  AppController->>AppController: _reset_crop_only()
  AppController->>EditorBackend: clear currentCropBox / reset straighten_angle (preserve rotation)
  AppController->>UI: ui_state.isCropping = True
  AppController->>UI: ui_refresh_generation += 1
  AppController->>PreviewWorker: kick preview worker for updated crop state

  UI->>AppController: cancel crop mode (cancel_crop_mode)
  AppController->>AppController: _reset_crop_only()
  AppController->>EditorBackend: clear currentCropBox / reset straighten_angle (preserve rotation)
  AppController->>UI: ui_state.isCropping = False
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Minor update #67 — Implements the same _reset_crop_only addition and refactor of _reset_crop_settings, cancel_crop_mode, and toggle_crop_mode, making it directly related.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Minor update' is vague and generic, failing to convey what the changeset actually accomplishes—it does not describe the specific crop mode and rotation state management refactoring. Use a more specific title that describes the main change, such as 'Refactor crop mode and rotation state management' or 'Preserve rotation when exiting crop mode'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@faststack/app.py`:
- Line 6847: _current behavior_: _reset_crop_settings() also clears rotation,
which causes rotation edits to be lost when toggling/canceling crop mode. Fix by
splitting responsibilities: add a new method (e.g., _reset_crop_mode() or
_reset_crop_only()) that clears only crop-specific state (crop box, aspect,
flip/scale if crop-specific) without touching rotation, and leave
_reset_crop_settings() (or create _reset_all_transform_settings()) as the full
reset that continues to clear rotation. Replace calls that run when
entering/exiting/canceling crop mode (the current callers of
_reset_crop_settings()) to call the new _reset_crop_only() so rotation is
preserved; keep any callers that truly need to clear rotation pointed at the
full-reset method. Ensure tests or UI flows that expect rotation to persist
after crop toggle now use the new crop-only reset.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cd071fef-284b-46f6-87a3-586ea2a0cc7a

📥 Commits

Reviewing files that changed from the base of the PR and between 3f3d851 and 30e8261.

📒 Files selected for processing (1)
  • faststack/app.py

Comment thread faststack/app.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30e8261213

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread faststack/app.py Outdated
# Reset to full image defaults (UI and Backend)
self.ui_state.currentCropBox = (0, 0, 1000, 1000)
self.image_editor.set_crop_box(None)
self._reset_crop_settings()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve existing rotation when entering crop mode

Calling _reset_crop_settings() here resets image_editor's rotation to 0, so entering crop mode now clears any previously applied 90°/180° rotation edits. In practice, if a user rotates an image and then toggles crop mode, the orientation is silently lost before cropping or canceling, which is a behavior regression from the previous code path that only cleared straighten_angle and crop selection.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
faststack/app.py (1)

6851-6855: ⚠️ Potential issue | 🟠 Major

Cancel no longer discards crop straighten changes.

cancel_crop_mode() says it exits without applying changes, but after this switch it only resets the crop box. Any straighten_angle set during the crop session is left in current_edits, so the preview stays straightened and a later save can persist an edit the user explicitly cancelled.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@faststack/app.py` around lines 6851 - 6855, The cancel_crop_mode flow
currently only calls _reset_crop_only() and leaves any straighten_angle in
current_edits, so cancelled straighten changes persist; update cancel_crop_mode
(or extend _reset_crop_only) to explicitly remove or reset
current_edits['straighten_angle'] (and any related preview state) before
incrementing ui_refresh_generation and calling _kick_preview_worker(), ensuring
the preview is reverted to the pre-crop orientation and that a later save cannot
persist the cancelled straighten; reference cancel_crop_mode, _reset_crop_only,
current_edits, straighten_angle, _kick_preview_worker, ui_refresh_generation,
and update_status_message when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@faststack/app.py`:
- Around line 6879-6883: The current code sets self.ui_state.isCropping = True,
then calls self._reset_crop_only() which clears isCropping, then re-sets it —
causing an unwanted exit+re-enter transition; fix by calling
self._reset_crop_only() first and then set self.ui_state.isCropping = True
(remove the initial pre-reset assignment) so crop mode is enabled only once and
avoids the false→true bounce.

---

Outside diff comments:
In `@faststack/app.py`:
- Around line 6851-6855: The cancel_crop_mode flow currently only calls
_reset_crop_only() and leaves any straighten_angle in current_edits, so
cancelled straighten changes persist; update cancel_crop_mode (or extend
_reset_crop_only) to explicitly remove or reset
current_edits['straighten_angle'] (and any related preview state) before
incrementing ui_refresh_generation and calling _kick_preview_worker(), ensuring
the preview is reverted to the pre-crop orientation and that a later save cannot
persist the cancelled straighten; reference cancel_crop_mode, _reset_crop_only,
current_edits, straighten_angle, _kick_preview_worker, ui_refresh_generation,
and update_status_message when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f14d347c-5fba-44ed-9cb2-403cce5abb9e

📥 Commits

Reviewing files that changed from the base of the PR and between 30e8261 and c0a3bdb.

📒 Files selected for processing (1)
  • faststack/app.py

Comment thread faststack/app.py Outdated
@AlanRockefeller AlanRockefeller merged commit 03ec45b into main Apr 9, 2026
2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 15, 2026
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.

1 participant