Skip to content

fix(init): normalize node runtime before linters#267

Merged
zeitlinger merged 2 commits intomainfrom
codex/init-node-before-linters
May 6, 2026
Merged

fix(init): normalize node runtime before linters#267
zeitlinger merged 2 commits intomainfrom
codex/init-node-before-linters

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

What changed

This updates flint init so the node runtime is added before [tools] normalization when an npm: backend tool such as npm:renovate is selected.

Why

init already ensured node indirectly through the later migration pass, but that happened after [tools] normalization. The result was a valid mise.toml with node appended under the # Linters block instead of being grouped with runtime tools above it.

Impact

Generated mise.toml files now keep node in the runtime section while still adding it automatically for npm: tools.

Root cause

The init flow normalized [tools] before calling the helper that inserts node, so the final write order was wrong even though the dependency was present.

Validation

  • cargo test init::tests::node_added_for_npm_tools_is_normalized_above_linters_header -- --exact
  • cargo test init::tests::normalize_tools_section_moves_node_above_linters_header -- --exact
  • cargo test init::tests::compute_desired_tools_comprehensive_includes_slow -- --exact
  • mise run lint:fix

@zeitlinger zeitlinger marked this pull request as ready for review May 6, 2026 07:53
@zeitlinger zeitlinger requested a review from a team as a code owner May 6, 2026 07:53
Copilot AI review requested due to automatic review settings May 6, 2026 07:53
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

Adjusts the flint init write flow so that when an npm: backend tool (e.g., npm:renovate) is selected, the required node runtime is inserted before [tools] normalization—keeping node grouped with runtime tools above the # Linters block in generated mise.toml.

Changes:

  • Call ensure_node_for_npm(project_root) before normalize_tools_section(&mise_path) during init.
  • Include node_added in the “No changes to apply.” noop decision.
  • Add a unit test intended to validate node placement relative to the linters header for npm: tools.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/init/mod.rs Reorders init steps to ensure node is added prior to [tools] normalization and updates noop detection.
src/init/tests.rs Adds a test around npm:renovate + ensure_node_for_npm + normalization to assert node remains above # Linters.

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

Comment thread src/init/tests.rs Outdated
@zeitlinger zeitlinger merged commit c215197 into main May 6, 2026
13 checks passed
@zeitlinger zeitlinger deleted the codex/init-node-before-linters branch May 6, 2026 13:10
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