Skip to content

feat: stdio protocol between warmup program and rustic (#1782) - #524

Merged
aawsome merged 3 commits into
rustic-rs:mainfrom
philipmw:warmup-protocol
Aug 8, 2026
Merged

feat: stdio protocol between warmup program and rustic (#1782)#524
aawsome merged 3 commits into
rustic-rs:mainfrom
philipmw:warmup-protocol

Conversation

@philipmw

Copy link
Copy Markdown
Contributor

JSON Lines. Each line must be a single JSON object. The object must contain at least a type field that identifies the message.

{"type":"pack-progress","warm":42}

A pack-progress message tells rustic how many of the packs in the current command invocation are expected to be warm now.

Field Type Meaning
type string Must be exactly "pack-progress".
warm integer Number of packs from this invocation expected to be warm.

rustic advances its shared progress bar using these updates.

warm is monotonically non-decreasing within a single invocation. If your program reports a lower value than a previous report, the lower value is ignored.

If your command exits successfully but never emits a pack-progress message, rustic still counts the whole invocation as complete. If it reports some progress but the final warm is less than the number of packs in the invocation, rustic counts the remaining packs as done when the command exits.

So the protocol is strictly an enhancement: emitting it gives users accurate progress; omitting it preserves the pre-protocol behavior of jumping from 0% to 100%.

rustic now captures and parses warmup program's stdout. This is a change from older versions, where the warm-up command's stdout was inherited and printed directly to the terminal.

Any stdout line that is not valid JSON is logged by rustic at info level, prefixed with [warmup], so that it is still available for debugging. Empty lines are ignored.

I plan to update rustic's documentation with this, once this change is accepted.

@philipmw

Copy link
Copy Markdown
Contributor Author

@aawsome plz

@aawsome aawsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @philipmw!

Sorry for the long delay! I had too much family issues in the past months, so I am a bit struggling to catch up..

The PR is mostly fine from my side, just a few things I think can be improved..
Please tell me if you want me to change these!

Comment thread crates/core/src/repository/warm_up.rs Outdated
Comment thread crates/core/src/repository/warm_up.rs Outdated
Comment thread crates/core/src/repository/warm_up.rs Outdated
[JSON Lines](https://jsonlines.org). Each line must be a single JSON object.
The object must contain at least a `type` field that identifies the message.

```json
{"type":"pack-progress","warm":42}
```

A `pack-progress` message tells *rustic* how many of the packs in the current
command invocation are expected to be warm now.

| Field | Type    | Meaning |
|-------|---------|---------|
| `type` | string | Must be exactly `"pack-progress"`. |
| `warm` | integer | Number of packs from this invocation expected to be warm. |

*rustic* advances its shared progress bar using these updates.

`warm` is **monotonically non-decreasing** within a single invocation. If your
program reports a lower value than a previous report, the lower value is ignored.

If your command exits successfully but never emits a `pack-progress` message,
*rustic* still counts the whole invocation as complete. If it reports some
progress but the final `warm` is less than the number of packs in the invocation,
*rustic* counts the remaining packs as done when the command exits.

So the protocol is strictly an enhancement: emitting it gives users accurate
progress; omitting it preserves the pre-protocol behavior of jumping from 0% to
100%.

*rustic* now captures and parses warmup program's stdout. This is a change from
older versions, where the warm-up command's stdout was inherited and printed
directly to the terminal.

Any stdout line that is not valid JSON is logged by *rustic* at info level,
prefixed with `[warmup]`, so that it is still available for debugging. Empty
lines are ignored.

I plan to update rustic's documentation with this, once this change is accepted.
@philipmw

philipmw commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Hi @philipmw!

Sorry for the long delay! I had too much family issues in the past months, so I am a bit struggling to catch up..

The PR is mostly fine from my side, just a few things I think can be improved.. Please tell me if you want me to change these!

Welcome back! Thanks for the comments. I revised the PR.

@aawsome aawsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did some small code cleaning. LGTM now! Thanks a lot @philipmw

@aawsome
aawsome added this pull request to the merge queue Aug 8, 2026
Merged via the queue into rustic-rs:main with commit 1b2271e Aug 8, 2026
22 checks passed
@rustic-release-plz rustic-release-plz Bot mentioned this pull request Aug 8, 2026
@philipmw

philipmw commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @aawsome ! Regarding clippy - I know it's not the first time you had to point out lint problems; sorry about that. Can you change the settings to run CI automatically for pull requests? Right now it never runs for me, saying it needs you to start it manually.

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.

2 participants