Conversation
… versions
Surge `pack` builds the release delta against the immediately-previous version
overall, regardless of channel. When intermediate releases live only on `test`
between two `production` releases, the production-side delta basis no longer
matches what production nodes have on disk. The first per-file `PatchFile`
basis-hash check during apply throws
Sparse delta file hash mismatch for 'camera-tuner.deps.json':
expected <previous-test hash>, got <previous-production hash>
and the supervisor never activates the delta. The only operational workaround
has been `surge compact <prod>` after every promotion, which deletes the broken
delta and forces every fleet node into a full reinstall.
Make `surge promote` channel-aware. After ensuring the new release's full
artifact exists in storage:
* Look up the previous release on the target channel.
* If the new release does not already carry a delta with `from_version` matching
that predecessor, restore both full archives, build a sparse delta, upload it
as `<app>-<version>-<rid>-from-<prev>-delta.tar.zst`, and `upsert_delta` it
onto the release entry without removing the original test-channel delta.
The chain walker in `update::manager::release_index` now resolves each apply
step by `delta_from_source(prev_step.version)` so production and test nodes
each pick the delta whose basis matches their installed version. Releases
pushed before `from_version` was tracked carry one delta with an empty
`from_version`; the resolver still accepts those as a legacy fallback so
existing chains keep working.
The early no-op return only fires when the release is already on the channel
**and** the channel-specific delta is already present, so re-running
`surge promote` recovers releases that were promoted before this fix shipped
without a demote/repromote cycle.
`ReleaseEntry::delta_from_source` and `ReleaseEntry::upsert_delta` are the
small primitives the new logic builds on. The regression test for promote
constructs real archives via `ArchivePacker`, sets up the v1.0.0(prod) /
v1.1.0(test) / v1.2.0(test) layout from the field bug, promotes v1.2.0 to
production, and verifies the rebuilt delta correctly transforms a v1.0.0
archive into v1.2.0 with the new `camera-tuner.deps.json` content.
Validation:
- ./scripts/sync-surge-core-vendor.sh --check
- ./scripts/check-version-sync.sh
- cargo fmt --all -- --check
- RUSTFLAGS="-D warnings" cargo test --workspace
- cargo clippy --workspace --all-targets --all-features -- -D warnings
- cargo clippy --workspace --lib --bins --examples -- -D warnings -D clippy::unwrap_used -D clippy::expect_used
- cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::pedantic
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.
Summary
surge packalways builds the release delta against the immediately-previous version overall, regardless of channel. When intermediate releases live only ontestbetween twoproductionreleases, the production-side delta basis no longer matches what production nodes have on disk. The first per-filePatchFilebasis-hash check during apply fails:```
Sparse delta file hash mismatch for 'camera-tuner.deps.json':
expected , got
```
The supervisor then never activates the delta. The only operational workaround has been `surge compact ` after every promotion, which deletes the broken delta and forces every fleet node into a full reinstall. This pattern shows up in every production promotion log of the youpark fleet (Apr 10, Apr 11, Apr 12).
What changes
commands/promote.rs— after `ensure_release_full_artifact`:update/manager/release_index.rs— chain walker resolves each apply step by `delta_from_source(prev_step.version)`. Releases pushed before `from_version` was tracked carry one delta with an empty `from_version`; the resolver accepts those as a legacy fallback so existing chains keep working. Returns `None` (forcing full install) when no compatible delta exists, instead of letting the apply path crash with the basis-hash mismatch.releases/manifest.rs— adds `ReleaseEntry::delta_from_source` and `ReleaseEntry::upsert_delta` helpers.Test plan
New tests