Skip to content

feat(bootstrap): expose resource provenance - #12100

Merged
jdx merged 4 commits into
mainfrom
codex/bootstrap-resource-provenance
Aug 17, 2026
Merged

feat(bootstrap): expose resource provenance#12100
jdx merged 4 commits into
mainfrom
codex/bootstrap-resource-provenance

Conversation

@jdx

@jdx jdx commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • retain the declaring config, config root, active config environment, and resolved source for dotfile and managed file/directory declarations
  • expose provenance in dotfile status and bootstrap plan/status JSON
  • show the declaring config in human-readable dotfile status and bootstrap file/plan tables
  • document the JSON contract and cover base and environment-specific declarations in e2e tests

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 --tests
  • mise run format
  • hk 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_files

AI-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 resolved source) is threaded through parsing and attached to ResourcePlan / status payloads. JSON from mise bootstrap plan, bootstrap files status, and mise dotfiles status includes an origin object; paths that are not valid UTF-8 serialize as mise: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_path derives active MISE_ENV segments 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

    • Bootstrap plan and status tables now show the originating configuration for each managed file or directory.
    • Dotfile status tables now display configuration origins for files and edits.
    • JSON output includes origin details such as configuration path, configuration root, environment, and resolved source file.
    • Source-backed templates now report their resolved source path.
  • Documentation

    • Added documentation describing origin metadata in bootstrap and dotfile JSON status output.
  • Tests

    • Added coverage for origin details across bootstrap and dotfile commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread src/system/managed_files.rs
@greptile-apps

greptile-apps Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds declaration provenance to dotfile and managed bootstrap resources and exposes it through JSON and human-readable status output.

  • Tracks the declaring config, config root, active configuration environment, and resolved source.
  • Uses a reserved lossless encoding for paths that cannot safely be emitted as ordinary strings.
  • Documents the JSON contract and adds end-to-end provenance coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/system/resources.rs Defines resource provenance and safely serializes valid, reserved-prefix, and non-UTF-8 paths without the failures reported in the previous threads.
src/system/managed_files.rs Retains managed file and directory origins through config merging and attaches them to generated plans.
src/system/files.rs Propagates dotfile declaration and resolved-source provenance through ordinary and glob-expanded requests.
src/system/edits.rs Adds declaring-config and optional source provenance to dotfile edit requests.
src/cli/dotfiles/status.rs Exposes dotfile and edit origins in JSON and adds their declaring config to human-readable tables.
src/cli/bootstrap.rs Adds declaring-config columns to bootstrap plan and managed-file status tables.
src/config/mod.rs Derives provenance environment labels from active environment-specific config filenames.

Reviews (4): Last reviewed commit: "fix(bootstrap): satisfy origin serialize..." | Re-trigger Greptile

Comment thread src/system/resources.rs
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 878e4032-56fd-43ca-939a-61170fdb0eff

📥 Commits

Reviewing files that changed from the base of the PR and between da2cf0a and 3b97f54.

📒 Files selected for processing (14)
  • docs/bootstrap/files.md
  • docs/dotfiles.md
  • e2e/cli/test_bootstrap_secrets
  • e2e/cli/test_bootstrap_system_files
  • e2e/cli/test_dotfiles_files
  • src/cli/bootstrap.rs
  • src/cli/dotfiles/add.rs
  • src/cli/dotfiles/status.rs
  • src/config/mod.rs
  • src/system/edits.rs
  • src/system/files.rs
  • src/system/managed_files.rs
  • src/system/resources.rs
  • src/system/shell_activation.rs

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change adds ResourceOrigin metadata to managed resources and edit requests. Configuration paths, roots, environments, and source paths flow into resource plans, JSON output, tables, documentation, and end-to-end tests.

Changes

Resource origin tracking

Layer / File(s) Summary
Origin contract and environment detection
src/system/resources.rs, src/config/mod.rs
Adds ResourceOrigin, optional plan origins, lossy path serialization, and environment extraction from configuration filenames.
Managed resource propagation
src/system/files.rs, src/system/managed_files.rs
Preserves origin metadata through configuration merging, source resolution, glob expansion, managed requests, and resource plans.
Edit and dotfile propagation
src/system/edits.rs, src/system/shell_activation.rs, src/cli/dotfiles/add.rs
Adds origin metadata to edit requests, shell activation requests, and dotfile file requests.
CLI output and validation
src/cli/bootstrap.rs, src/cli/dotfiles/status.rs, e2e/cli/*, docs/bootstrap/files.md, docs/dotfiles.md
Adds configuration columns and JSON origin output. Documentation and end-to-end tests cover configuration, root, environment, and source metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 3b97f

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

I’m a rabbit with a config trail,
Origins bloom in every file detail.
Sources hop through plans with care,
Roots and environments follow there.
JSON shines—thump, thump, hooray!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: exposing resource provenance for bootstrap resources.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread src/system/resources.rs Outdated
@github-actions

Copy link
Copy Markdown

Instruction counts

benchmark trend instructions Δ wall (min) Δ
env ▆▅▄▁▂▃▂▁▁▁▂▃▁█ 81,331,924 → 81,516,497 +0.23% 20.70 → 19.08ms -7.80%
hook-env ▃▂▁▃▃▃▂▂▄▂▃▄▃█ 82,922,949 → 83,055,839 +0.16% 20.12 → 19.92ms -0.99%
ls ▇█▆▂▃▂▂▁▁▁▁▁▁▄ 73,893,362 → 73,975,410 +0.11% 17.43 → 17.47ms +0.26%
registry ▃▃▁▁▁▂▂▂▇▇▇▆▇█ 44,076,556 → 44,099,981 +0.05% 12.72 → 12.39ms -2.55%
startup ▆▆▂▂▁▁▂▂▄▃▃▄▄█ 15,806,854 → 15,827,672 +0.13% 9.83 → 9.46ms -3.72%

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.

560aca70b3ce vs 9c4d65e24671 · measured on the runner, not pushed to the history.

@jdx
jdx enabled auto-merge (squash) August 17, 2026 18:44
@jdx
jdx merged commit 82ca17e into main Aug 17, 2026
31 checks passed
@jdx
jdx deleted the codex/bootstrap-resource-provenance branch August 17, 2026 18:49
jdx added a commit that referenced this pull request Aug 18, 2026
## 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 -->
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.

1 participant