Repository navigation
Write the Litestream config as JSON and drop serde_yaml - #1251
Merged
Merged
Conversation
Contributor
|
| Project | Bencher |
| Branch | u/ep/litestream-json |
| Testbed | intel-v1 |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| Adapter::Json | 📈 view plot 🚷 view threshold | 5.11 µs(-2.32%)Baseline: 5.23 µs | 5.46 µs (93.52%) |
| Adapter::Magic (JSON) | 📈 view plot 🚷 view threshold | 4.92 µs(-2.30%)Baseline: 5.04 µs | 5.23 µs (94.17%) |
| Adapter::Magic (Rust) | 📈 view plot 🚷 view threshold | 24.24 µs(-8.31%)Baseline: 26.44 µs | 32.37 µs (74.89%) |
| Adapter::Rust | 📈 view plot 🚷 view threshold | 4.46 µs(-3.99%)Baseline: 4.65 µs | 5.15 µs (86.62%) |
| Adapter::RustBench | 📈 view plot 🚷 view threshold | 4.46 µs(-3.97%)Baseline: 4.65 µs | 5.15 µs (86.67%) |
serde_yaml is deprecated and pulls in the unmaintained unsafe-libyaml (RUSTSEC-2024-0449). Its only use was serializing the generated Litestream config, and Litestream parses its config with go-yaml, which reads JSON documents, so the config is now written with serde_json to the same path. The one difference: serde_json writes U+007F to U+009F, U+FFFE, and U+FFFF unescaped, and go-yaml rejects them except U+0085, which it reads as a space. A config value containing one now fails at boot, or for U+0085 changes the parsed value.
epompeii
force-pushed
the
u/ep/litestream-json
branch
from
October 16, 2026 03:42
fe5086c to
23e8ef5
Compare
epompeii
marked this pull request as ready for review
October 16, 2026 03:43
epompeii
added a commit
that referenced
this pull request
Oct 16, 2026
## Problem `Lint / Zizmor Online` failed on #1251 (run https://github.com/bencherdev/bencher/actions/runs/38846843953, job https://github.com/bencherdev/bencher/actions/runs/38846843953/job/116799199507) with one medium finding, exit 13: ``` update_sandbox.yml:18: action's hash pin has mismatched or missing version comment: points to commit 683b588c487a ``` Line 18 is `dtolnay/rust-toolchain@e2a55d2ffb04f378e9626c28d38b36d230d1e12f # v1`, pinned by #1199. The upstream `v1` tag moved to `683b588c487a69d01f6c6ddf40f036ff682cc2c8` on 2026-10-16. `devel` carries the same pin, so the job is red on every run since. The job is `continue-on-error: true`, so it does not block a merge. ## Change Repin `update_sandbox.yml` to the commit `v1` points at today and keep the `# v1` comment, as #1199 did. The hash was resolved from the GitHub refs API (`v1` is a lightweight tag on that commit). No other workflow or composite action uses this action. ## Upstream range `e2a55d2f...683b588c` is one commit, "Add 1.99.1 patch release", which adds `1.99.1` to the patch release list in `scripts/update-revs.sh`. `action.yml` is unchanged, so this call site (`toolchain: stable`) runs exactly the same steps. ## Other moving refs Every other pin whose comment names a moving ref still matches it today: `rui314/setup-mold@339e96b4 # v1` (14 sites), `dawidd6/action-download-artifact@b6e2e706 # v21` (2 sites), and `superfly/flyctl-actions/setup-flyctl@ed8efb33 # master` (3 sites, the current `master` head). The online pass below proves it. ## Verification zizmor 1.25.2, the version CI pins, from the same digest-pinned image `zizmor-action` runs (`ghcr.io/zizmorcore/zizmor:1.25.2@sha256:14ea7f5c...`), with the action's arguments (`--persona=regular --format=github`, plus `--no-online-audits` for the offline job): | Tree | Offline | Online | | --- | --- | --- | | `devel` | exit 0 | exit 13, the one `ref-version-mismatch` finding above | | this branch | exit 0 | exit 0, no findings | CI on this pull request is the final check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Lint / Cargo Deny Advisoriesfails ondevel(run https://github.com/bencherdev/bencher/actions/runs/38831217036) with, among others, RUSTSEC-2024-0449:unsafe-libyamlis unmaintained. It reaches the tree only throughserde_yaml, which is itself deprecated (0.9.34+deprecated).The only use of
serde_yamlis oneserde_yaml::to_stringinJsonDisasterRecovery::into_yaml, which serializes the generated Litestream config. The API writes that string to/etc/litestream.yml(etc/litestream.ymlin debug builds) and passes it tolitestream restoreandlitestream replicatewith-config <path> -no-expand-env.Change
serde_json::to_string_prettyand written to the same path. Litestream reads its config withgopkg.in/yaml.v2(v2.4.0 ingo.modat bothv0.5.16andv0.5.17), which reads JSON documents, so the file name and both Litestream invocations stay as they are. The struct shapes,kebab-caserenames, andskip_serializing_ifattributes are unchanged, so the parsed config is identical with one exception.serde_jsonwrites U+007F to U+009F, U+FFFE, and U+FFFF unescaped whereserde_yamlescaped them, and yaml.v2, a YAML 1.1 parser, rejects all of them except U+0085, which it reads as a space. A config value containing one of those characters now makes Litestream refuse to start, or for U+0085 changes the parsed value. Paths, bucket names, endpoints, and S3 credentials are ASCII in practice.JsonDisasterRecovery::into_litestream_config,LitestreamError::Serialize(now carryingserde_json::Error),LitestreamError::WriteConfig, and the fourinto_litestream_config*tests, which now assert the emitted JSON.serde_yamlis removed from the workspace,bencher_json(including thedbfeature), andbencher_api, which takesserde_jsonin its place.Cargo.lockdropsserde_yamlandunsafe-libyaml.Verification
cargo clippy --locked -p bencher_json -p bencher_api --all-features --all-targets -- -D warnings: clean.cargo nextest run --locked -p bencher_json --all-features: 229 passed.cargo deny --locked check advisories: RUSTSEC-2024-0449 is gone. The four rustls advisories (RUSTSEC-2026-0346 to -0349) were fixed by Repin rui314/setup-mold to the current v1 and update rustls #1248, which this branch is rebased on.Parse equivalence: one fully populated config (S3 replica with
path,endpoint,region,sync_interval;snapshotwithintervalandretention;validation;checkpointwith all three fields) rendered bydevelas YAML and by this branch as JSON. Both load to the same document,litestream databases -config <file> -no-expand-envlists the same database and replica on 0.5.16 and 0.5.17, andlitestream replicatelogs the same parsed settings for both:Edge values: a secret and an S3 path made of a double quote, a backslash,
$HOME,:, leading and trailing spaces, andéparse identically from thedevelYAML and this branch's JSON on both Litestream versions, authenticate against MinIO, and round trip;$HOMEis not expanded. The exception above came from feeding U+007F, U+0080, U+0085, U+0090, U+009F, U+FFFE, and U+FFFF through Litestream's own config reader at both versions.Boot round trip: a debug
apibuild withplus, itsplus.disaster_recoveryreplicating to a local MinIO container with the fully populated S3 settings above. On first boot the API writes the JSON config,litestream restoreexits 0 (no matching backups found), andlitestream replicateuploads LTX files to the bucket. A signup throughPOST /v0/auth/signupthen replicates; after stopping the API and deleting the whole data directory, the next boot'slitestream restorerecreates the database from MinIO with the same user row (same UUID) and no migrations to run. The same round trip passes with thefilereplica scheme, and both pass on Litestream 0.5.16 (whatdevelships) and 0.5.17.CI on this pull request is the final check.