Skip to content

Use the remapped URI for the cache key (#1818)#2109

Merged
thomas-zahner merged 9 commits into
lycheeverse:masterfrom
josrepo:bugfix/cache-requested-urls
Apr 2, 2026
Merged

Use the remapped URI for the cache key (#1818)#2109
thomas-zahner merged 9 commits into
lycheeverse:masterfrom
josrepo:bugfix/cache-requested-urls

Conversation

@josrepo

@josrepo josrepo commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Fixes and adds a test for #1818.

@katrinafyi katrinafyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After some thinking, the approach is sound.

Since this adds a new call to remap, I was worried that this would be applying the remap to a URL which was already remapped. It does do two remaps, but both remaps are done from the initial URL so it should be sound, if a touch inefficient.

There's another PR concerning remaps at #2094, but I think it shouldn't conflict.

Thanks for looking into this!

Comment thread lychee-bin/src/commands/check.rs Outdated

@katrinafyi katrinafyi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@thomas-zahner do you have thoughts about this approach, in particular after #2094? I don't love repeating the remap separately outside of check(). if we hypothetically add more pre-check transforms, they would also have to be duplicated for the cache key. however, it is hard to extract the remapped URL from check() for use as the cache key, because it does the remap then immediately does the check.

so it's a bit tricky. I would be okay with merging this pr as-is and keeping these issues in the back of our mind. but what do you think?

Comment thread lychee-bin/src/commands/check.rs
Comment thread lychee-bin/src/commands/check.rs Outdated
@josrepo

josrepo commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

@katrinafyi Thanks for the feedback!

I have removed the redundant clone() call and added a more descriptive comment.

I don't love repeating the remap

I agree. Though I didn't see an easy way to move the remap further up without a larger refactor so I settled on the current approach.

I'm not sure why cargo test is failing either, it is passing when I run locally...

@thomas-zahner

Copy link
Copy Markdown
Member

Yes I agree that it's fine to remap twice.

I'm not sure why cargo test is failing either, it is passing when I run locally...

cargo test doesn't cover all tests as features are skipped. You can use make test to get the same behaviour as in CI. I've fixed the issue in fb22a60.

Additionally, I tried to clean some things up, not directly related to this PR in 9fd5596.

@josrepo

josrepo commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

cargo test doesn't cover all tests as features are skipped. You can use make test to get the same behaviour as in CI.

I see, thanks for pointing out.

I've fixed the issue in fb22a60.

Many thanks!

@katrinafyi

Copy link
Copy Markdown
Member

@thomas-zahner Can we revert 9fd5596? It might be worthwhile, but I think it's too much to tack onto the tail of an otherwise small PR.

Otherwise, lgtm. Thanks @josrepo!

@thomas-zahner thomas-zahner force-pushed the bugfix/cache-requested-urls branch from c1288fb to 59a4e8b Compare April 2, 2026 13:31
@thomas-zahner

thomas-zahner commented Apr 2, 2026

Copy link
Copy Markdown
Member

@thomas-zahner Can we revert 9fd5596? It might be worthwhile, but I think it's too much to tack onto the tail of an otherwise small PR.

Yeah makes sense 👍
I've extracted the commit to #2123

@thomas-zahner thomas-zahner merged commit 1a903e4 into lycheeverse:master Apr 2, 2026
7 checks passed
@thomas-zahner

Copy link
Copy Markdown
Member

Thank you @josrepo for the nice contribution! 🚀

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.

3 participants