Repository navigation
Probe -c targets that an enabled format converts to - #147
Merged
Merged
Conversation
`-x RAR -c ZIP` converted nothing unless ZIP was also enabled: config probed only handlers whose own formats were enabled, so Zip never reached handler_stages and the repack pass found no available target. The same gap hit every convert-only route (`-f BMP -c PNG`, `-f GIF -c JXL`, 7z and tar to zip, CBR/CB7/CBT to CBZ). Config now also probes each convert-chain handler of an enabled format whose output is a -c target. The doctor shares that scope instead of copying it, and its "needs -x" now names the source format an opt-in conversion is missing. JxlLossless no longer lists PNG as an input just to be probed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
picopt -x RAR -c ZIPconverted nothing unless ZIP was also passed to-x. Config probed only handlers whose own formats were enabled, soZipnever reachedhandler_stages, and the repack pass found no available target. Every convert-only route had the same gap: 7Z and TAR/TGZ/TBZ/TXZ to ZIP, CBR/CB7/CBT to CBZ, and image routes like-f BMP -c PNGor-f GIF -c JXL.picopt doctor -x RAR -c ZIPreportedFAIL RAR -c ZIP needs -x ZIP.Fix
enabled_handler_classes(formats, convert_to)inpicopt/config/handlers.pyalso probes each convert-chain handler of an enabled format whose output is a-ctarget.-f PNG -c JXL --convert-jpeg-to-jxlused to sayneeds -x JXL, which wouldn't help; it now saysJxlFromJpeg needs -x JPEG.JxlLosslessno longer lists PNG inINPUT_FILE_FORMATS; it was only there to get the handler probed. A PNG run without-c JXLno longer probes the JXL encoder.-x. The other examples keep CBZ because they also optimize existing CBZ files.This doesn't interfere with the #145 stand-ins: a stand-in writes the input's own format, so the existing rule already probes it.
Tests
test_convert_target_must_be_enabledis nowtest_convert_target_needs_no_extra_format.-x RAR -c ZIPand-f BMP -c PNG.-x ...,ZIPworkaround from four tests, so the tar→ZIP and per-directory CBR→CBZ tests now exercise the fix end to end.make fix,make lintandmake tyare clean.make test: 439 passed, 6 skipped (PDF render checks).🤖 Generated with Claude Code