Skip to content

feat(lychee): add local cache for local runs#268

Merged
zeitlinger merged 1 commit into
mainfrom
codex/lychee-local-cache
May 6, 2026
Merged

feat(lychee): add local cache for local runs#268
zeitlinger merged 1 commit into
mainfrom
codex/lychee-local-cache

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

What changed

This adds a flint-managed local cache path for lychee to speed up repeated local link checks.

  • enable a local lychee cache outside CI when the lychee config does not already set cache = true
  • skip the flint-managed cache on CI
  • add FLINT_LYCHEE_SKIP_LOCAL_CACHE=true as a local opt-out
  • create .lychee_cache/.gitignore on first use and print a one-time notice with the opt-out hint
  • keep lychee config resolution working for both project-root-relative and FLINT_CONFIG_DIR-relative paths

Why

Lychee supports a disk cache, but many repos will not have it enabled in their lychee config. Flint already orchestrates lychee behavior, so this lets local runs pick up a cache by default without changing shared repo config that would also affect CI.

Impact

Local lychee runs should get faster after the first run. CI behavior stays unchanged, and repos that already opt into lychee's own cache = true continue to use that instead of flint's local cache wrapper.

Validation

  • FLINT_CASES=lychee cargo test cases
  • cargo test
  • mise run lint:fix

@zeitlinger zeitlinger force-pushed the codex/lychee-local-cache branch 2 times, most recently from c5dee92 to a48a1bf Compare May 6, 2026 09:27
@zeitlinger zeitlinger marked this pull request as ready for review May 6, 2026 09:33
@zeitlinger zeitlinger requested a review from a team as a code owner May 6, 2026 09:33
Copilot AI review requested due to automatic review settings May 6, 2026 09:33
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

Adds a flint-managed local disk cache for lychee during local (non-CI) runs to speed up repeated link checks, with an env-var opt-out and behavior that defers to lychee when caching is already enabled in the user’s lychee.toml.

Changes:

  • Enable a local .lychee_cache/ directory + --cache flag outside CI (unless opted out or cache = true is already set in lychee config).
  • Adjust lychee config-path resolution to work with both project-root-relative and FLINT_CONFIG_DIR-relative config setups.
  • Extend and add case tests to cover cache creation behavior and the “config enables cache” bypass; update docs to describe the new behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/cases/lychee/local-missing-token-warns/test.toml Updates expected stderr to include the one-time local cache creation notice.
tests/cases/lychee/local-cache-created/test.toml New case asserting cache dir creation, .gitignore creation, working dir change, and --cache flag injection.
tests/cases/lychee/local-cache-created/files/README.md Input file for the new local-cache-created case.
tests/cases/lychee/local-cache-created/files/mise.toml Tooling fixture for the new local-cache-created case.
tests/cases/lychee/local-cache-created/files/lychee.toml Lychee config fixture (without cache = true) for the new local-cache-created case.
tests/cases/lychee/config-cache-skips-flint-local-cache/test.toml New case asserting that cache = true in config prevents flint’s local cache wrapper behavior.
tests/cases/lychee/config-cache-skips-flint-local-cache/files/README.md Input file for the config-cache-skips case.
tests/cases/lychee/config-cache-skips-flint-local-cache/files/mise.toml Tooling fixture for the config-cache-skips case.
tests/cases/lychee/config-cache-skips-flint-local-cache/files/lychee.toml Lychee config fixture enabling cache to exercise the bypass.
tests/cases/lychee/clean/test.toml Updates expected stderr to include the cache creation notice.
tests/cases/lychee/broken-link/test.toml Updates expected stderr to include the cache creation notice.
src/registry/checks.rs Documents the new local-cache behavior in the check registry docs.
src/linters/lychee.rs Implements cache planning (CI skip, opt-out, config detection), config path resolution, and working-dir/input adjustments.
README.md Removes inline linter config examples and points readers to docs/linters.md.
docs/linters.md Documents the new local lychee cache behavior and opt-out env var.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/linters/lychee.rs Outdated
Comment thread src/linters/lychee.rs Outdated
Comment thread src/linters/lychee.rs Outdated
@zeitlinger zeitlinger force-pushed the codex/lychee-local-cache branch from a48a1bf to 9782fcb Compare May 6, 2026 10:08
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger force-pushed the codex/lychee-local-cache branch from 9782fcb to e1c4f37 Compare May 6, 2026 10:35
@zeitlinger zeitlinger merged commit 8f40f1d into main May 6, 2026
13 checks passed
@zeitlinger zeitlinger deleted the codex/lychee-local-cache branch May 6, 2026 11:05
This was referenced May 8, 2026
zeitlinger pushed a commit that referenced this pull request May 11, 2026
## 🤖 New release

* `flint`: 0.21.0 -> 0.22.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.22.0](v0.21.0...v0.22.0)
- 2026-05-11

### Added

- replace codespell with typos
([#269](#269))
- *(lychee)* add local cache for local runs
([#268](#268))

### Fixed

- *(renovate-deps)* surface real renovate failure in error output
([#278](#278))
- *(ci)* drop double release-plz update from release:pr
([#276](#276))
- *(init)* normalize node runtime before linters
([#267](#267))
- *(renovate)* support block-scalar mise sha256 values
([#266](#266))
- *(mise)* migrate flint-managed tools to supported backends
([#258](#258))
- validate renovate dependency rule coverage
([#263](#263))
- make flint-setup state-based
([#252](#252))
- *(init)* let rustfmt own Rust line length
([#250](#250))
- run renovate-deps for deleted tracked files
([#247](#247))
- validate CI env and isolate check types
([#253](#253))
- *(init)* remove stale head sha from CI snippets
([#248](#248))
- *(init)* enable yamllint indentation rule
([#251](#251))

### Other

- streamline README getting started
([#280](#280))
- *(deps)* update taiki-e/install-action digest to fa0dd4c
([#282](#282))
- *(deps)* lock file maintenance
([#285](#285))
- *(deps)* update dependency mise to v2026.5.2
([#284](#284))
- *(deps)* update dependency go to v1.26.3
([#283](#283))
- *(deps)* update taiki-e/install-action digest to e3134ec
([#281](#281))
- pass git-token and forge to release-plz
([#274](#274))
- *(deps)* update taiki-e/install-action digest to 3fa6878
([#275](#275))
- *(deps)* bump renovate to 43.150.0
([#273](#273))
- [**breaking**] drop --fast-only flag and tighten renovate-deps timing
([#270](#270))
- *(deps)* update rust crate tokio to v1.52.2
([#272](#272))
- upgrade lychee to v0.24.2
([#265](#265))
- *(deps)* update taiki-e/install-action digest to cca35ed
([#254](#254))
- *(deps)* update dependency aqua:owenlamont/ryl to v0.8.0
([#261](#261))
- *(deps)* update dependency mise to v2026.4.28
([#262](#262))
- *(deps)* update dependency golangci-lint to v2.12.1
([#264](#264))
- *(deps)* update dependency aqua:owenlamont/ryl to v0.7.0
([#259](#259))
- *(renovate)* simplify quickstart and batch weekly linter updates
([#257](#257))
- *(deps)* update dependency npm:renovate to v43.141.6
([#255](#255))
- expand positioning and comparisons
([#239](#239))
- *(deps)* update taiki-e/install-action digest to 1f2425c
([#246](#246))
- move release-plz flow into mise tasks
([#234](#234))
- *(deps)* update taiki-e/install-action digest to 481c34c
([#231](#231))
- *(deps)* update dependency ruff to v0.15.12
([#245](#245))
- *(deps)* update dependency npm:renovate to v43.141.5
([#244](#244))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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