feat(bootstrap): expose resource provenance - #12100
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b957ead. Configure here.
Greptile SummaryAdds declaration provenance to dotfile and managed bootstrap resources and exposes it through JSON and human-readable status output.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (4): Last reviewed commit: "fix(bootstrap): satisfy origin serialize..." | Re-trigger Greptile |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change adds ChangesResource origin tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change is additive and has no expected user or production behavior impact; one localized serializer signature cleanup remains to satisfy lint expectations, so the PR is merge-ready after normal checks. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
## Summary - add `[bootstrap].config_roots` for composing declarative bootstrap resources from independent config roots - load each root's normal active environment-specific config files while preserving source-relative paths and provenance - compose only `[dotfiles]`, `[bootstrap.files]`, and `[bootstrap.directories]` - deduplicate equivalent declarations and report conflicting sibling declarations with both origins - document the behavior and add schema plus end-to-end coverage This is a focused follow-up to #12100 and the design discussion in #12099. ## Semantics ```toml [bootstrap] config_roots = ["bundles/*"] ``` Selected roots contribute bootstrap file resources independently. They do not gain precedence from array or glob order. Tools, tasks, packages, services, hooks, and repos from selected roots are not collected. ## Validation - `cargo clippy --workspace --all-features --all-targets -- -D warnings` - `mise run test:e2e e2e/cli/test_bootstrap_config_roots` - `mise run test:e2e e2e/cli/test_dotfiles_files e2e/cli/test_dotfiles_edits e2e/cli/test_bootstrap_system_files e2e/cli/test_bootstrap_secrets` - `mise run render:schema` - changed-file hk checks (schema, Prettier, rustfmt, cargo check, Markdown lint) - `shellcheck e2e/cli/test_bootstrap_config_roots` - `shfmt -d e2e/cli/test_bootstrap_config_roots` *AI-assisted — Tool: Codex; model: openai/GPT-5; version: unavailable.* <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes how bootstrap/dotfile resources are loaded and merged across config hierarchies, with new failure modes on conflicts; scope is limited to declarative file resources and is covered by e2e tests. > > **Overview** > Adds **`[bootstrap].config_roots`** so bootstrap can merge **`[dotfiles]`**, **`[bootstrap.files]`**, and **`[bootstrap.directories]`** from multiple independent directories (single-level `*` globs or explicit paths), each loaded with the active **`MISE_ENV`** layers. > > Each matched root gets its own config hierarchy and **scoped `vars` / `config_root` for templates**; sibling roots do not override each other by list order. **Identical declarations dedupe**; **conflicts** on the same target (dotfile, edit id, managed file/dir) **fail with both declaring configs**. Tools, tasks, repos, and other sections are **not** pulled from those roots. > > **`files_from_config`**, **`edits_from_config`**, and managed-file/directory aggregation now **`Result`** and iterate **`bootstrap_config_maps`** instead of only the main **`config_files`**. Root expansion reuses hardened **`config_roots`** logic (canonical paths, escape rejection). Schema, **`docs/bootstrap.md`**, and an e2e test cover composition, env overlays, exclusions, and conflicts. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 28445c8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for composing bootstrap configuration from multiple independent roots. * Bootstrap processing now includes dotfiles, managed files, and directories across active environments. * Equivalent duplicate declarations are combined automatically, with root-specific templating preserved. * **Bug Fixes** * Conflicting declarations now produce clear errors identifying their sources. * Configuration and bootstrap commands consistently report loading and composition errors. * **Documentation** * Documented configuration-root matching, ordering, supported resources, exclusions, and conflict behavior. * **Tests** * Added end-to-end coverage for merging, environment-specific configuration, exclusions, and conflict handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->

Summary
Why
Discussion #12099 proposes composing declarative bootstrap resources from multiple selected config roots. Composition needs declaration provenance before mise can produce deterministic cross-root conflict diagnostics or explain why a resource is active. This implements the discussion's smaller foundational step without changing the existing config hierarchy or introducing accidental precedence between sibling roots.
This PR intentionally does not collect sibling config roots. A follow-up can build a conflict-aware composition layer on top of the retained origins.
Validation
cargo check --testsmise run formathk run check --safe --format json --files0-from <(git diff --name-only -z HEAD)mise run test:e2e e2e/cli/test_dotfiles_files e2e/cli/test_bootstrap_system_filesAI-assisted — Tool: Codex; model: openai/GPT-5; version: unavailable.
Note
Low Risk
Read-only metadata and display changes; no change to apply precedence or convergence behavior.
Overview
Adds declaration provenance for dotfiles, managed bootstrap files/directories, and dotfile edits so layered configs can be inspected without hand-reconstructing precedence.
A new
ResourceOrigin(declaring config,config_root, environment from the config filename, optional resolvedsource) is threaded through parsing and attached toResourcePlan/ status payloads. JSON frommise bootstrap plan, bootstrap files status, andmise dotfiles statusincludes anoriginobject; paths that are not valid UTF-8 serialize asmise:path-bytes:<base64url>on Unix for lossless round-tripping. Human tables gain a Config column on bootstrap plan/files status and dotfiles status.environments_for_config_pathderives activeMISE_ENVsegments from config filenames (e.g.mise.dev.toml). Docs describe the JSON contract; e2e tests assert origins for templates, system files, and env-specific dotfiles.Reviewed by Cursor Bugbot for commit 560aca7. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Documentation
Tests