Skip to content

fix(commands): Skip warmup script on --dry-run#1523

Merged
aawsome merged 5 commits intorustic-rs:mainfrom
SomeThink1729:feature/no_warmup_on_dry_run
Dec 23, 2025
Merged

fix(commands): Skip warmup script on --dry-run#1523
aawsome merged 5 commits intorustic-rs:mainfrom
SomeThink1729:feature/no_warmup_on_dry_run

Conversation

@SomeThink1729
Copy link
Contributor

@SomeThink1729 SomeThink1729 commented Aug 8, 2025

Skip running the warmup script when using --dry-run for prune and restore.
The new option --dry-run-warmup has been added and can be used to get the prior behavior (i.e. warm-up for a dry-run).

closes #1428

@SomeThink1729 SomeThink1729 changed the title Skip warmup script on --dry-run fix(commands): Skip warmup script on --dry-run Aug 8, 2025
@aawsome
Copy link
Member

aawsome commented Aug 15, 2025

@SomeThink1729 Thanks a lot for opening this PR!

I think we should first talk a bit about the general direction. While I see that users may not want to warm-up during a --dry-run, there are also others which exactly do want to do this - run a dry-run to warm-up some data which can then be processed in future.

So, I suggest that we make warming up in dry run an option to choose, i.e. either add a --dry-run-warm-up option along with --dry-run or add a --dry-run-no-warm-up (names can be discussed) option to keep the current behavior but still allow users to choose.

@SomeThink1729 Which variant do you like more? Can you add this to this PR?

@SomeThink1729
Copy link
Contributor Author

SomeThink1729 commented Aug 17, 2025

@aawsome Thanks for the feedback.

Until now I didn't see the use case you're describing, but now it totally makes sense.
I only saw the warm-up script as something to establish a connection - login somewhere else etc. transform data, which you wan't to skip if you --dry-run.

For me personally I think this use case is more naturally and I'd put in under --dry-run and the one you're describing under --dry-run-warmup, but this would lead to a breaking change in --dry-run, which I don't really like.

So I'll implement it the other way round (--dry-run and --dry-run-no-warmup) and we can discuss things further, what you like more etc.
I think changing the names is not that much of an effort after adding the feature.

@aawsome
Copy link
Member

aawsome commented Aug 19, 2025

After thinking about it, I agree that it may make more sense to have dry run not warm up by default. The next release will anyway break smaller things, so I think we can also introduce a breaking change here...

@SomeThink1729
Copy link
Contributor Author

@aawsome I've now added the discussed behaviour.

--dry-run and --dry-run-warmup clash with each other, since one should issue the script and the other doesn't.
Right now it takes the stricter one of both, so it skips warmup, but I prefer to do nothing and return an error that this config is invalid. I thought about adding something like this:

pub fn validate(&self) -> Result<(), SomeKindOfError> {
// do some checks
}

to check if both arguments are supplied or if the config is valid and continue execution.
However I have no clue what kind of error type I would need or where to call this function.

Do you think it's necessary and would like to include such a check or do you think its unnecessary?
Tests are still missing, but I intend to write some before the merge

@aawsome
Copy link
Member

aawsome commented Aug 25, 2025

--dry-run and --dry-run-warmup clash with each other, since one should issue the script and the other doesn't. Right now it takes the stricter one of both, so it skips warmup, but I prefer to do nothing and return an error that this config is invalid.

We could let clap handle this. However, this is also present in the config file, so it won't work when given there...
As we use anyhow for the rustic CLI, that would mean to just return an anyhow! error in this case or just use bail. IIRC in the backup command there are some checks which are handled in this way.

An alternative would be to have a --dry-run option and the --dry-run-warmup be an option that only yields in combination with --dry-run. So, --dry-run would not warmup and --dry-run --dry-run-warmup would warmup. But using only --dry-run-warmup would do nothing or only give a warning that it is ignored as no dry-run is given... This however would mean to change the logic a bit...

Copy link
Member

@aawsome aawsome left a comment

Choose a reason for hiding this comment

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

Some minor findings.
I think the change should be also in the config example full.toml as well as in the README.md of the config. Besides this, seems to be ready to merge!

@aawsome
Copy link
Member

aawsome commented Oct 10, 2025

@SomeThink1729 would you like to continue working on this? If not, I can also finish this to merge it soon...

@aawsome aawsome force-pushed the feature/no_warmup_on_dry_run branch from f5fad84 to b3afb08 Compare December 23, 2025 14:15
Copy link
Member

@aawsome aawsome left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @SomeThink1729

@aawsome aawsome added this pull request to the merge queue Dec 23, 2025
Merged via the queue into rustic-rs:main with commit 7396b4f Dec 23, 2025
30 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Dec 28, 2025
## 🤖 New release

* `rustic-rs`: 0.10.2 -> 0.10.3 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.10.3](v0.10.2...v0.10.3)
- 2025-12-23

### Added

- *(interactive)* show summary in snapshots, ls and diff views
([#1615](#1615))
- Progress Update on non-interactive runs
([#1395](#1395))
([#1620](#1620))

### Fixed

- *(commands)* Skip warmup script on --dry-run
([#1523](#1523))
- fix clippy lints
([#1621](#1621))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: rustic-release-plz[bot] <182542030+rustic-release-plz[bot]@users.noreply.github.com>
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.

prune --dry-run issues warm-up command

2 participants