Fix --rga-no-cache flag causing "No cache?" error instead of disabling cache#338
Merged
Fix --rga-no-cache flag causing "No cache?" error instead of disabling cache#338
Conversation
…g cache
When cache is disabled (via --rga-no-cache) or the file is not a real file,
adapt_caching() set cache to None but then immediately called
cache.context("No cache?")? which unconditionally errored on the None value.
This is a regression introduced in cde0e20 ("partial move to async", Oct 2022).
The pre-async code in dfc10cb correctly used:
if let Some(mut cache) = cache { /* cached path */ } else { /* no-cache path */ }
The async rewrite replaced this with:
let mut cache = cache.context("No cache?")?;
dropping the else branch that ran the adapter without caching.
Fix by matching on the Option: when cache is Some, use the existing
read/write-through-cache path; when None, run the adapter directly without
any caching via loop_adapt() + concat_read_streams().
Fixes #337
https://claude.ai/code/session_014Yhbd16V3ekdKsdBtgt8Lq
…g cache
When cache is disabled (via --rga-no-cache) or the file is not a real file,
adapt_caching() set cache to None but then immediately called
cache.context("No cache?")? which unconditionally errored on the None value.
This is a regression introduced in cde0e20 ("partial move to async", Oct 2022).
The pre-async code in dfc10cb correctly used:
if let Some(mut cache) = cache { /* cached path */ } else { /* no-cache path */ }
The async rewrite replaced this with:
let mut cache = cache.context("No cache?")?;
dropping the else branch that ran the adapter without caching.
Fix by early-returning from the else branch: when cache is disabled, run the
adapter directly via loop_adapt() + concat_read_streams() without caching.
The cached code path is unchanged.
Note: adapt_caching() is only called from rga_preproc() for the top-level
file. Recursive files inside archives go through loop_adapt() directly, so
in practice only --rga-no-cache triggers the None/disabled path.
Fixes #337
https://claude.ai/code/session_014Yhbd16V3ekdKsdBtgt8Lq
0b8fd73 to
a52b40d
Compare
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.
When cache is disabled (via --rga-no-cache) or the file is not a real file,
adapt_caching() set cache to None but then immediately called
cache.context("No cache?")? which unconditionally errored on the None value.
This is a regression introduced in cde0e20 ("partial move to async", Oct 2022).
The pre-async code in dfc10cb correctly used:
if let Some(mut cache) = cache { /* cached path / } else { / no-cache path */ }
The async rewrite replaced this with:
let mut cache = cache.context("No cache?")?;
dropping the else branch that ran the adapter without caching.
Fix by matching on the Option: when cache is Some, use the existing
read/write-through-cache path; when None, run the adapter directly without
any caching via loop_adapt() + concat_read_streams().
Fixes #337
https://claude.ai/code/session_014Yhbd16V3ekdKsdBtgt8Lq