Skip to content

feat: add flint setup preflight migrations#233

Merged
zeitlinger merged 20 commits intomainfrom
codex/flint-setup-version-migrations
Apr 27, 2026
Merged

feat: add flint setup preflight migrations#233
zeitlinger merged 20 commits intomainfrom
codex/flint-setup-version-migrations

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

@zeitlinger zeitlinger commented Apr 25, 2026

Summary

Adds an internal flint-setup preflight check that owns Flint-managed repository setup state before other linters run.

  • Adds setup_version with explicit setup states: 0 for v1 bootstrap, 1 for the deployed v2 baseline, and 2 for the next setup migration state.
  • Treats missing setup_version in existing v2 flint.toml files as the deployed v2 baseline (1).
  • Runs flint-setup before other active linters and exits early when setup is dirty or was fixed.
  • Moves setup state behind versioned migration data and adds guard tests so future setup migrations require a version bump.
  • Moves one-to-one live tool-key replacements into registry builder metadata, with replacements inferred from each check's current install key.
  • Moves mise.toml sorting and # Linters grouping into the setup preflight.
  • Adds flint init --flint-rev <git-rev> for cargo-backed prerelease consumer validation, and makes plain flint init switch back to the released github:grafana/flint backend.
  • Keeps prerelease Flint pins minimal: --flint-rev writes only the cargo-backed Flint tool entry and does not add Cargo fetch environment config.
  • Treats cargo-backed Flint revision changes like released Flint version changes for baseline expansion.
  • Normalizes bare shellcheck to github:koalaman/shellcheck while the aqua-backed key is blocked on Windows.
  • Keeps .editorconfig-checker.json optional: existing configs are still passed to ec, but Flint no longer treats that JSON file as a generated baseline config.
  • Makes special-check fixability explicit at registry construction and keeps built-in checks from carrying fake binary names.

Validation

  • mise exec -- cargo test -q
  • mise run lint:fix
  • git diff --check
  • Prometheus client_java validation from current main with flint init -y --flint-rev 302c0da94a6cce98c7c770e9f63b1f9625896295 followed by mise run lint:fix

@zeitlinger zeitlinger marked this pull request as ready for review April 25, 2026 21:02
@zeitlinger zeitlinger requested a review from a team as a code owner April 25, 2026 21:02
Copilot AI review requested due to automatic review settings April 25, 2026 21:02
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 introduces a new internal flint-setup preflight check to own Flint-managed repository setup state (setup versioning, key migrations, and canonical mise.toml layout) and runs it before other linters.

Changes:

  • Add setup_version + versioned setup migrations, with flint-setup as an always-on preflight check that can fix setup drift.
  • Move one-to-one tool key replacements into registry metadata and expand normalization of mise.toml tool ordering / # Linters grouping into the setup preflight.
  • Add flint init --flint-rev <git-rev> to pin Flint via a cargo git revision for prerelease validation, and update docs/tests accordingly.

Reviewed changes

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

Show a summary per file
File Description
tests/cases/shellcheck/sourced-file/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/shellcheck/failure/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/shellcheck/config-dir/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/shellcheck/clean/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/renovate-deps/fast-only-relevant/files/mise.toml Add # Linters grouping in fixture.
tests/cases/renovate-deps/fast-only-irrelevant/files/mise.toml Add # Linters grouping in fixture.
tests/cases/general/update-obsolete-key/test.toml Adjust expected mise.toml output (header/grouping changes).
tests/cases/general/update-no-op/test.toml Update flint update no-op output expectation.
tests/cases/general/unsupported-alternate-config/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/time-flag/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/list/test.toml Update linter list output expectations (new flint-setup, built-in binary display).
tests/cases/general/init-rust/test.toml Update init expectations: setup_version in flint.toml and tool ordering.
tests/cases/general/exclude-paths/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/env-var-exclude/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/baseline-new-linter/changes/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/baseline-flint-settings-change/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/baseline-excluded-config-change/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/baseline-config-change/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/auto-review-unfixable/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/auto-review-two-linters/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/general/auto-fix-and-review/files/mise.toml Update ShellCheck tool key to canonical GitHub backend in fixture.
tests/cases/editorconfig-checker/formatter-exclusion/files/mise.toml Add # Linters grouping in fixture.
src/setup.rs Introduce setup version constants, migration lists, and guard tests.
src/runner.rs Add PreparedCheck::FlintSetup and integrate running it before other checks.
src/registry/types.rs Add SpecialCheck metadata, tool-key migration metadata, and install_key() helper.
src/registry/tests.rs Add tests for ShellCheck aliasing, tool-key migrations, optional ec config, and Flint pin detection.
src/registry/obsolete.rs Rework obsolete/unsupported key handling to combine setup + registry migrations.
src/registry/mod.rs Export new obsolete/unsupported key helpers; expand known Flint tool keys.
src/registry/mise.rs Treat cargo-backed Flint pins as version identities for baseline expansion.
src/registry/checks.rs Register flint-setup, migrate tool keys via registry metadata, and update special-check constructors.
src/main.rs Add --flint-rev; run flint-setup preflight early; improve binary display for built-ins.
src/linters/mod.rs Export new flint_setup module.
src/linters/lychee.rs Update tests to include setup_version in settings.
src/linters/flint_setup.rs New setup preflight linter implementation + tests.
src/init/mod.rs Thread --flint-rev through init; add setup migration application entry point; adjust update behavior.
src/init/migrations.rs Split setup migrations from repo migrations and parameterize obsolete/unsupported key lists.
src/init/generation.rs Move tools normalization responsibility away from many writers; update Flint self-pin behavior.
src/init/detection.rs Detect obsolete keys via new dynamic obsolete list.
src/init/config_files.rs Write setup_version into generated flint.toml and add write_setup_version().
src/config.rs Add setup_version to settings with default + test for missing field behavior.
docs/linters.md Document the new flint-setup linter and update wrapping/formatting for long lines.
docs/cli.md Document --flint-rev and adjust baseline-expansion wording for Flint pin changes.
README.md Update examples and linter table to include flint-setup and ShellCheck canonical key.
.github/config/flint.toml Set repo setup_version = 2.

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

Comment thread src/linters/flint_setup.rs Outdated
Comment thread docs/cli.md Outdated
Comment thread README.md
exit = 1
stderr = '''
[dotnet-format]
[dotnet-fmt]
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.

This looks a bit weird to me because the native command is dotnet format. Does it need to be changed to fmt?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no it doesn't - I think I went a bit too far in trying to make it look similar in flint - which is actually against the goal of making it look familiar to the users

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread tests/cases/lychee/broken-link/test.toml
@zeitlinger
Copy link
Copy Markdown
Member Author

@martincostello can you check again?

@zeitlinger zeitlinger merged commit 8d9cb41 into main Apr 27, 2026
13 checks passed
@zeitlinger zeitlinger deleted the codex/flint-setup-version-migrations branch April 27, 2026 10:19
This was referenced Apr 27, 2026
zeitlinger added a commit that referenced this pull request Apr 27, 2026
### Added

- add flint setup preflight migrations
([#233](#233))
- support managed linter configs and aqua-backed tool keys
([#228](#228))
- switch xmloxide to github backend
([#229](#229))
- add taplo formatter check
([#224](#224))
- *(init)* configure line length during init
([#218](#218))

### Fixed

- support renovate v43.136.3
([#223](#223))
- switch yaml-lint to ryl
([#226](#226))
- *(ruff)* install via github releases
([#227](#227))
- resolve init rollout regressions
([#220](#220))

### Other

- reduce fake-bin fixture coverage
([#240](#240))
- *(deps)* update dependency npm:renovate to v43.141.1
([#221](#221))
- guard fixture case groups
([#238](#238))
- *(deps)* update dependency grafana/flint to v0.20.4
([#235](#235))
- *(deps)* lock file maintenance
([#237](#237))
- *(deps)* update dependency mise to v2026.4.19
([#236](#236))
- *(deps)* update rust crate json5 to v1
([#232](#232))
- *(deps)* update taiki-e/install-action digest to 787505c
([#219](#219))
- *(deps)* update dependency grafana/flint to v0.20.3
([#225](#225))

> [!IMPORTANT]
> Close and reopen this PR to trigger CI checks.

---------

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