Skip to content

feat: Fix renovate-deps extractVersion handling#304

Open
zeitlinger wants to merge 1 commit into
mainfrom
feat/zizmor
Open

feat: Fix renovate-deps extractVersion handling#304
zeitlinger wants to merge 1 commit into
mainfrom
feat/zizmor

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

  • validate Renovate extractVersion against lookup metadata in renovate-deps
  • auto-fix mismatches by adding targeted packageRules.extractVersion overrides when Flint can infer one
  • align Flint's own Renovate configs for Biome and add fixture/e2e coverage

Why

Some Renovate-managed mise dependencies can stall when the upstream tag format no longer matches the configured extractVersion. Biome is one example: its GitHub tags don't match Renovate's generic aqua regex, so updates can silently stop.

What changed

  • store currentValue, currentVersion, and extractVersion in the tracked snapshot metadata used by renovate-deps
  • add a general mismatch check that compares extracted lookup versions against the tracked current value
  • in --fix mode, append a targeted packageRules override and rerun lookup when Flint can infer a better regex
  • add unit and e2e coverage for the Biome-shaped failure and autofix flow
  • align default.json and .github/renovate.json5 with an explicit Biome override
  • update the ktlint doc link and harden e2e git setup by disabling commit signing in temp repos

Impact

  • renovate-deps now catches stalled updates caused by stale or overly generic extractVersion rules
  • flint run --fix renovate-deps can repair some of those cases automatically
  • Flint's shared preset and repo Renovate config stay aligned for the Biome workaround

Validation

  • cargo test -p flint linters::renovate_deps::tests -- --nocapture
  • FLINT_CASES=renovate-deps/extract-version-autofix cargo test -p flint --test e2e cases -- --nocapture
  • cargo test -p flint --test e2e renovate_deps_local_default_runs_for_deleted_tracked_file -- --nocapture
  • pre-push mise run lint:fix

@zeitlinger zeitlinger changed the title [codex] Fix renovate-deps extractVersion handling feat: Fix renovate-deps extractVersion handling May 26, 2026
@zeitlinger zeitlinger force-pushed the feat/zizmor branch 5 times, most recently from 88fbdfb to 2f892a3 Compare May 26, 2026 12:36
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review May 26, 2026 16:38
@zeitlinger zeitlinger requested a review from a team as a code owner May 26, 2026 16:38
Copilot AI review requested due to automatic review settings May 26, 2026 16:38
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 PR enhances the renovate-deps linter to detect (and sometimes auto-fix) stalled Renovate updates caused by stale/mismatched extractVersion rules, with Biome as a motivating case, and updates Flint’s Renovate presets/config plus test coverage accordingly.

Changes:

  • Extend Renovate snapshot extraction to capture currentValue, currentVersion, and extractVersion, validate extractVersion consistency, and strip lookup-only fields before writing the committed snapshot.
  • Add --fix behavior to append targeted packageRules.extractVersion overrides when Flint can infer a better regex, then re-run lookup.
  • Add unit + e2e/fixture coverage and align default.json and .github/renovate.json5 with an explicit Biome override; harden e2e git setup.

Reviewed changes

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

Show a summary per file
File Description
tests/e2e.rs Disables commit signing in temp repos to make e2e git commits reliable.
tests/cases/renovate-deps/extract-version-autofix/test.toml New fixture asserting the extractVersion mismatch autofix flow and resulting config/snapshot behavior.
tests/cases/renovate-deps/extract-version-autofix/files/renovate.json5 New empty starting Renovate config fixture for the autofix case.
tests/cases/renovate-deps/extract-version-autofix/files/mise.toml New mise fixture containing a Biome tool version to exercise the failure mode.
src/registry/tests.rs Adds an alignment assertion ensuring the Biome override stays consistent between default.json and .github/renovate.json5.
src/linters/renovate_deps/tests.rs Adds unit tests for extended meta extraction, mismatch validation, and config patching.
src/linters/renovate_deps/snapshot.rs Extends DepMeta to include lookup fields and adds stripping helpers to keep committed snapshots stable.
src/linters/renovate_deps/rules.rs Introduces extractVersion mismatch detection/validation and inference logic for suggested overrides.
src/linters/renovate_deps/mod.rs Wires mismatch detection + autofix patching into the linter execution flow and ensures lookup-only fields are stripped before writing.
docs/linters/renovate-deps.md Documents the new extractVersion consistency check and the autofix behavior.
default.json Adds explicit Biome extractVersion override in the shared Renovate preset.
.github/renovate.json5 Mirrors the Biome override in the repo Renovate config to stay aligned with the shared preset.

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

Comment on lines +156 to +176
let Some(extracted) = extract_version_value(extract_version, current_version)
.with_context(|| format!("failed to evaluate extractVersion for dep {dep_name:?}"))?
else {
continue;
};

if extracted == current_value {
continue;
}

mismatches.push(ExtractVersionMismatch {
dep_name,
package_name: meta.package_name.clone(),
current_value: current_value.to_string(),
current_version: current_version.to_string(),
extract_version: extract_version.to_string(),
suggested_extract_version: infer_extract_version_from_current(
current_version,
current_value,
),
});
Comment on lines +770 to +773
if changed {
std::fs::write(config_path, serde_json::to_string_pretty(&parsed)? + "\n")
.with_context(|| format!("failed to write {}", config_path.display()))?;
}
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