-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor(prepare): remove touch_outputs and update docs to reflect blake3 hashing #8535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,8 +1,7 @@ | ||||||
| # Prepare <Badge type="warning" text="experimental" /> | ||||||
|
|
||||||
| The `mise prepare` command ensures project dependencies are ready by checking if lockfiles | ||||||
| are newer than installed outputs (e.g., `package-lock.json` vs `node_modules/`) and running | ||||||
| install commands if needed. | ||||||
| The `mise prepare` command ensures project dependencies are ready by hashing source files | ||||||
| (e.g., `package-lock.json`) and running install commands when changes are detected. | ||||||
|
|
||||||
| ## Quick Start | ||||||
|
|
||||||
|
|
@@ -87,37 +86,33 @@ run = "npx prisma generate" | |||||
|
|
||||||
| ### Provider Options | ||||||
|
|
||||||
| | Option | Type | Description | | ||||||
| | --------------- | -------- | ------------------------------------------------------------------------------- | | ||||||
| | `auto` | bool | Auto-run before `mise x` and `mise run` (default: false) | | ||||||
| | `sources` | string[] | Files/patterns to check for changes | | ||||||
| | `outputs` | string[] | Files/directories that should be newer than sources | | ||||||
| | `run` | string | Command to run when stale | | ||||||
| | `env` | table | Environment variables to set | | ||||||
| | `dir` | string | Working directory for the command | | ||||||
| | `description` | string | Description shown in output | | ||||||
| | `touch_outputs` | bool | Touch output mtimes after a successful run so they appear fresh (default: true) | | ||||||
| | `depends` | string[] | Other provider names that must complete before this one runs | | ||||||
| | `timeout` | string | Timeout for the run command, e.g., `"30s"`, `"5m"` (default: no timeout) | | ||||||
| | Option | Type | Description | | ||||||
| | ------------- | -------- | ------------------------------------------------------------------------- | | ||||||
| | `auto` | bool | Auto-run before `mise x` and `mise run` (default: false) | | ||||||
| | `sources` | string[] | Files/patterns to check for changes | | ||||||
| | `outputs` | string[] | Files/directories that must exist for the provider to be considered fresh | | ||||||
| | `run` | string | Command to run when stale | | ||||||
| | `env` | table | Environment variables to set | | ||||||
| | `dir` | string | Working directory for the command | | ||||||
| | `description` | string | Description shown in output | | ||||||
| | `depends` | string[] | Other provider names that must complete before this one runs | | ||||||
| | `timeout` | string | Timeout for the run command, e.g., `"30s"`, `"5m"` (default: no timeout) | | ||||||
|
|
||||||
| ## Freshness Checking | ||||||
|
|
||||||
| mise uses modification time (mtime) comparison to determine if outputs are stale: | ||||||
| mise uses blake3 content hashing to determine if sources have changed since the last | ||||||
| successful run. Hashes are stored in `.mise/prepare-state.toml`. | ||||||
|
|
||||||
| 1. Find the most recent mtime among all source files | ||||||
| 2. Find the most recent mtime among all output files | ||||||
| 3. If any source is newer than all outputs, the provider is stale | ||||||
| 1. Compute blake3 hashes of all source files | ||||||
| 2. Compare against stored hashes from the last successful run | ||||||
| 3. If any file was added, removed, or changed, the provider is stale | ||||||
|
|
||||||
| This means: | ||||||
|
|
||||||
| - If you modify `package-lock.json`, `node_modules/` will be considered stale | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This point could be rephrased for better clarity. With content hashing, the staleness is determined by changes in source files, not by a comparison with outputs. Mentioning
Suggested change
|
||||||
| - If `node_modules/` doesn't exist, the provider is always stale | ||||||
| - If sources don't exist, the provider is considered fresh (nothing to do) | ||||||
|
|
||||||
| After a successful run, mise touches the mtime of each output to now (controlled by | ||||||
| `touch_outputs`, default `true`). This ensures that commands which are no-ops when | ||||||
| dependencies are already satisfied (e.g. `uv sync` when the venv is up to date) still | ||||||
| mark outputs as fresh, preventing repeated stale warnings on subsequent invocations. | ||||||
| - On first run (no stored state), the provider is always considered stale | ||||||
|
|
||||||
| ## Auto-Prepare | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,10 +42,6 @@ pub struct PrepareProviderConfig { | |
| pub dir: Option<String>, | ||
| /// Optional description | ||
| pub description: Option<String>, | ||
| /// Whether to update mtime of output files/dirs after a successful run (default: true) | ||
| /// This is useful when the prepare command is a no-op (e.g., `uv sync` when all is well) | ||
| /// so that the outputs appear fresh for subsequent freshness checks. | ||
| pub touch_outputs: Option<bool>, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing field with
|
||
| /// Other prepare providers that must complete before this one runs | ||
| #[serde(default)] | ||
| pub depends: Vec<String>, | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of freshness checking is a bit simplified as it omits the check for output existence, which is a key part of the logic. For better accuracy and to avoid user confusion, I suggest clarifying that both output existence and source content hashing are used.