feat(init): rust workflow steps, markdownlint migration, idempotence fix#195
Merged
zeitlinger merged 6 commits intodocs/split-and-v2-installfrom Apr 20, 2026
Merged
Conversation
Stacked on #187. ### Rust workflow steps `flint init` now adds `Swatinem/rust-cache` and `rustup component add clippy rustfmt` to `.github/workflows/lint.yml` when a Rust toolchain is detected in `mise.toml`. The push trigger gets a comment explaining why we run on main ("warms the Rust cache so PR branches get a cache hit"). Also bumps the generated `mise-action` pin to v2026.4.16 to match flint's own dogfood workflow. ### Markdownlint .yml migration Switches the generated markdownlint config from `.markdownlint.jsonc` to `.markdownlint.yml` for uniformity across consumer repos. Legacy variants (`.markdownlint.{json,jsonc,yaml}` and `.markdownlint-cli2.*`) are replaced on init. Only generated when editorconfig-checker is also selected, since the file's comment points to editorconfig-checker for line-length. ### [tools] normalization New `normalize_tools_section` sorts `mise.toml [tools]` alphabetically and inserts a `# Linters` header. Toolchain keys (rust/go/dotnet/node) stay above the header; lint-only binaries go below. Toolchain detection is registry-driven: a new `Check::toolchain()` / `Check::toolchain_components()` builder marks a mise_tool as a language runtime. `toolchain_keys()` collects them at runtime, plus `node` (which is added by `ensure_node_for_npm` outside the registry). The old `mise_install_components: Option<&str>` field merges into `toolchain: Option<Option<&str>>` — None = linter binary, Some(None) = toolchain without components, Some(Some(c)) = toolchain with components. ### Idempotence fix Before: first run generates `.github/workflows/lint.yml` but doesn't detect actionlint (no workflow yaml existed at detect time). Second run picks up the generated workflow → adds actionlint → non-idempotent. Fix: when init is about to generate the workflow, synthesize the workflow patterns into `present_patterns` so actionlint gets selected in the same run. Covered by new `tests/cases/general/init-idempotent/` e2e case. ### Tests - New e2e cases: `general/init-rust` (fresh rust project → full init), `general/init-idempotent` (fully-initialized repo → "No changes to apply") - init-rust test uses a fake `mise` shell-script stub to deterministically pin tool versions, via the existing `[fake_bins]` harness feature - Fixes a snapshot-writer bug in `write_test_toml` that was producing malformed test.toml (missing newlines, escape-processing strings) - New unit tests for `normalize_tools_section`, markdownlint migration, rust workflow generation Signed-off-by: Gregor Zeitlinger <[email protected]>
cargo-fmt reformats two over-long lines in generation.rs and reorders test imports in mod.rs. renovate-tracked-deps.json picks up the new Swatinem/rust-cache reference added to generate_lint_workflow. Signed-off-by: Gregor Zeitlinger <[email protected]>
Verifies that `flint init --yes` on a Rust project writes the expected [tools] section (runtimes above `# Linters` header), toolchain inline table for rust (version + components), [env], and [tasks] blocks. Signed-off-by: Gregor Zeitlinger <[email protected]>
- `node` now sorts into the linters group instead of above `# Linters`. It's only pinned by `ensure_node_for_npm` as a prereq for `npm:` backend linters, not as a first-class toolchain like rust (which runs `cargo` directly). Drop the explicit `node` insert from `toolchain_keys()`. - Mark the `[tasks]` parent table implicit so the empty section header is suppressed when only sub-tables (`[tasks.lint]`, `[tasks."lint:fix"]`) exist. - Fake mise in init-rust now requires `--pin` and exits non-zero if it's missing — catches regressions that would write soft `latest` pins. Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Adds `github:grafana/flint` at the running binary's CARGO_PKG_VERSION so all contributors run the same flint release. Skips when the key already exists (any pin) to respect user's explicit choice. Signed-off-by: Gregor Zeitlinger <[email protected]>
martincostello
approved these changes
Apr 20, 2026
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.
Summary
Stacked on #187. Three init improvements:
generate_lint_workflowtakeshas_rustparam — insertsSwatinem/rust-cache+rustup component add clippy rustfmtwhen Rust is detected..markdownlint.yml(from.json), drop line-length rule (deferred to editorconfig-checker). Removes legacy variants.normalize_tools_sectionsorts[tools]and inserts# Lintersheader once; re-runningflint initprints "No changes to apply."Registry refactor:
.toolchain()/.toolchain_components(..)builders replace hardcodedREUSED_RUNTIME_KEYS. Toolchain set is now derived from the registry viatoolchain_keys().Test plan
mise exec -- cargo testgreentests/cases/general/init-rust/asserts rust-aware initinit-idempotentfixture verifies re-run prints "No changes to apply."generate_lint_workflow_with_rustcovers workflow content (kept out of e2e snapshot to avoid renovate pin-bump flakes)