Skip to content

Refactor: Apply auto raw edit only on raw by default#27

Merged
duartebarbosadev merged 9 commits intomainfrom
refactor-apply-auto-raw-edit-only-on-raw-by-default
Aug 27, 2025
Merged

Refactor: Apply auto raw edit only on raw by default#27
duartebarbosadev merged 9 commits intomainfrom
refactor-apply-auto-raw-edit-only-on-raw-by-default

Conversation

@duartebarbosadev
Copy link
Copy Markdown
Owner

This pull request refactors RAW image processing to be automatic and standardized throughout the codebase, eliminating the need for external flags or parameters to trigger auto-edits. The changes ensure that RAW images are always detected by file extension and receive brightness and contrast adjustments during preview, thumbnail, and rotation detection. Documentation and testing guidelines are updated to reflect these changes, and related configuration and UI elements are simplified.

RAW Processing Refactor:

  • RAW image auto-editing is now always applied based on file extension detection (is_raw_extension()) throughout the image pipeline, rotation detection, and thumbnail/preview generation. Manual flags such as apply_auto_edits have been removed from public APIs and internal methods. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

  • Documentation (DEVELOPER_GUIDE.md) updated to clarify that RAW processing is automatic for supported extensions, and the relevant constant (RAW_AUTO_EDIT_BRIGHTNESS_STANDARD) is now mentioned as part of configuration. [1] [2]

Configuration and UI Simplification:

  • Removed unused configuration keys and defaults for manual auto-edit toggling from app_settings.py. [1] [2] [3]
  • Removed the "Enable Auto RAW Edits" UI option from README.md to reflect the new automatic behavior.

Testing and Guidelines Updates:

  • Added new test requirements for automatic RAW processing validation and a critical Windows testing requirement: all test files must begin with import pyexiv2 to prevent native library crashes.
  • Updated troubleshooting and guidelines to include RAW processing and Windows test suite requirements.

Summary Statement Update:

  • The developer guide summary now reflects the introduction of automatic RAW processing and updated testing patterns.

@duartebarbosadev duartebarbosadev changed the title Refactor apply auto raw edit only on raw by default Refactor: Apply auto raw edit only on raw by default Aug 27, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors RAW image processing to be automatic and standardized throughout the codebase, eliminating the need for external apply_auto_edits parameters. The changes ensure that RAW images are always detected by file extension and receive appropriate brightness and contrast adjustments.

  • Removes apply_auto_edits parameters from public APIs and internal methods across the image pipeline, worker management, and UI components
  • Implements automatic RAW detection using is_raw_extension() function throughout the codebase
  • Updates all test files to include required import pyexiv2 statement for Windows compatibility

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_worker_manager_automatic_raw.py New comprehensive test suite validating WorkerManager API changes and automatic RAW processing
tests/test_file_scanner_automatic_raw.py New test suite for FileScanner automatic RAW detection functionality
tests/test_automatic_raw_processing.py New test suite for core automatic RAW processing validation
tests/test_similarity_controller.py Updated test methods to remove auto_edits parameter
Multiple test files Added required import pyexiv2 statement for Windows compatibility
src/ui/worker_manager.py Removed apply_auto_edits parameters from worker management methods
src/ui/ui_components.py Updated worker classes to use automatic RAW detection
src/ui/main_window.py Removed auto-edits toggle functionality and updated image processing calls
src/core/image_pipeline.py Implemented automatic RAW detection using is_raw_extension()
src/core/file_scanner.py Removed apply_auto_edits parameter from scanning methods
Configuration files Removed deprecated auto-edit settings and updated documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +113 to +143
def test_async_scan_directory_blur_detection_signature(self):
"""Test that async blur detection calls don't use apply_auto_edits_for_raw_preview."""
# This test ensures that if the async method is used, it also doesn't pass the old parameter
scanner = FileScanner(None)

with (
patch("src.core.file_scanner.BlurDetector.is_image_blurred") as mock_blur,
patch("src.core.file_scanner.SUPPORTED_EXTENSIONS", {".jpg"}),
):
mock_blur.return_value = False
scanner.blur_detection_threshold = 100.0

# Manually test the blur detection call pattern that would be used in async method
# This simulates what happens in _scan_directory_async
test_path = "/test/file.jpg"

# This is the pattern from the async method - it should not pass apply_auto_edits_for_raw_preview
scanner.__class__.__dict__["_scan_directory_async"].__code__.co_varnames

# The important thing is that the method signature was updated
# Let's verify by checking that we can call blur detection with just threshold
from src.core.image_features.blur_detector import BlurDetector

with patch.object(BlurDetector, "is_image_blurred") as mock_blur_method:
mock_blur_method.return_value = False

# This should work without apply_auto_edits_for_raw_preview parameter
BlurDetector.is_image_blurred(test_path, threshold=100.0)

# Verify the method was called correctly
mock_blur_method.assert_called_once_with(test_path, threshold=100.0)
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

Line 130 accesses scanner.__class__.__dict__[\"_scan_directory_async\"].__code__.co_varnames but never uses the result. This appears to be dead code that should be removed, or if it was meant to be an assertion, it should be completed.

Copilot uses AI. Check for mistakes.
".cr2",
".cr3",
".nef",
".nrw", # Nikon RAW
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

[nitpick] The comment format is inconsistent. Other RAW extensions in the list don't have manufacturer comments. Either add comments to all extensions or remove this one for consistency.

Suggested change
".nrw", # Nikon RAW
".nrw",

Copilot uses AI. Check for mistakes.
@duartebarbosadev duartebarbosadev marked this pull request as ready for review August 27, 2025 20:16
@duartebarbosadev duartebarbosadev merged commit 51cb854 into main Aug 27, 2025
3 checks passed
@duartebarbosadev duartebarbosadev deleted the refactor-apply-auto-raw-edit-only-on-raw-by-default branch August 27, 2025 20:16
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.

2 participants