Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7efdf79
Report artifact GC in one JSON shape and count every rollback leg (#1…
mikolalysenko Oct 9, 2026
f7977fa
Print scan's GC dry-run preview in the shared gc shape
mikolalysenko Oct 9, 2026
a7d7c57
Lay the envelope foundation every --json command will share
mikolalysenko Oct 9, 2026
c6f8210
Print rollback --json as the unified envelope
mikolalysenko Oct 9, 2026
e28f4d7
Map manifest load failures to one error code on every envelope comman…
mikolalysenko Oct 9, 2026
68dd8cb
Assert the rollback envelope in the rollback test suites
mikolalysenko Oct 9, 2026
020c607
Move every rollback --json assertion onto the envelope
mikolalysenko Oct 9, 2026
3883c65
Document the unified manifest-load codes and remove/repair event shapes
mikolalysenko Oct 9, 2026
ecbdd1e
Expect rollback_failed when every Bun global-store package is refused
mikolalysenko Oct 9, 2026
9714d57
Merge branch 'main' into fix/gc-report-json-1257
mikolalysenko Oct 9, 2026
6e47dd6
Document rollback's unified envelope in CLI_CONTRACT.md
mikolalysenko Oct 9, 2026
56a14e9
Move scan and get --json onto the shared envelope
mikolalysenko Oct 9, 2026
41ec21e
Merge v5/envelope-rollback into the envelope integration branch
mikolalysenko Oct 9, 2026
958265b
Record the envelope rollback keys in the Python backtest harnesses
mikolalysenko Oct 9, 2026
53fb830
Document the scan/get envelope and add shape and parity tests
mikolalysenko Oct 9, 2026
b803c8d
Update scan and get tests for the envelope shape
mikolalysenko Oct 9, 2026
8b343ea
Merge v5/envelope-scanget into the envelope integration branch
mikolalysenko Oct 9, 2026
5792a86
Silence an unused binding in the yarn berry hosted test
mikolalysenko Oct 9, 2026
603b03b
Merge #1273's branch (with main) into the envelope integration branch
mikolalysenko Oct 9, 2026
48c63c6
Merge main into the envelope integration branch
mikolalysenko Oct 9, 2026
1e69b30
Merge branch 'main' into fix/gc-report-json-1257
claude Oct 9, 2026
bc9c9be
Restore per-caller bun.lockb rollback status
claude Oct 9, 2026
81dece4
Merge main into fix/gc-report-json-1257
mikolalysenko Oct 10, 2026
91bf3ea
Read scan's unified dry-run GC key in the #1062 prune preview test
mikolalysenko Oct 10, 2026
2f5a7ae
Merge fix/gc-report-json-1257 (with main) into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
5ba2c9a
Read the v5 envelope in e2e suites, compat harnesses and the scan bench
mikolalysenko Oct 10, 2026
572b4dc
Merge fix/gc-report-json-1257 into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
c049dfd
Normalize CRLF in the contract tests; count every rollback leg in bun…
mikolalysenko Oct 10, 2026
70f0902
Merge fix/gc-report-json-1257 into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
731b51b
Carry the vendor engine's error into the scan/get envelope
mikolalysenko Oct 10, 2026
d9ab173
Merge main into fix/gc-report-json-1257
mikolalysenko Oct 10, 2026
c08bae1
Merge fix/gc-report-json-1257 into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
6c2b2d3
Merge remote-tracking branch 'origin/main' into HEAD
mikolalysenko Oct 10, 2026
86d1ba2
Read the unified dry-run GC key in main's Cargo shared-cache prune test
mikolalysenko Oct 10, 2026
515c0bc
Merge fix/gc-report-json-1257 into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
8ab1478
Read the cargo-cache keep under the one GC shape's preview key
mikolalysenko Oct 10, 2026
ff9704a
Merge remote-tracking branch 'origin/fix/gc-report-json-1257' into HEAD
mikolalysenko Oct 10, 2026
d583874
Merge fix/gc-report-json-1257 (ff9704a21) into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
234a1ae
Merge main into v5/json-envelope-unify
mikolalysenko Oct 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/socket-patch-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ sample:
- exit code 0 and one JSON document on stdout, `status: success`;
- `scannedPackages`, `lockfileOnlyPackages`, `packagesWithPatches` and
`totalPatches` equal what the generated project contains;
- hosted runs: `redirect.redirected` is every patch, `rewrittenFiles` is
- hosted runs: every patch is pinned (`redirect.redirected` before v5, the
hosted `applied` events since), `rewrittenFiles` is
exactly the expected set, nothing is skipped, every warning code is one
the scenario expects, and each reported file really changed on disk;
- dry runs: nothing on disk changed;
Expand Down
81 changes: 73 additions & 8 deletions crates/socket-patch-bench/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,69 @@ fn warning_codes(v: &Value) -> Vec<String> {
.unwrap_or_default()
}

// The base and head binaries may straddle the v5 JSON envelope change
// (`scan --json`'s legacy counters became events), so every reading below
// accepts both shapes: the legacy key when present, else the envelope's.

/// How many discovered packages have patches: legacy `packagesWithPatches`,
/// else the length of the `packages` discovery array.
fn packages_with_patches(v: &Value) -> Value {
match &v["packagesWithPatches"] {
Value::Null => v["packages"]
.as_array()
.map_or(Value::Null, |a| a.len().into()),
n => n.clone(),
}
}

/// How many patches discovery found: legacy `totalPatches`, else the sum of
/// `packages[].patches[]`.
fn total_patches(v: &Value) -> Value {
match &v["totalPatches"] {
Value::Null => v["packages"].as_array().map_or(Value::Null, |a| {
a.iter()
.map(|p| p["patches"].as_array().map_or(0, Vec::len))
.sum::<usize>()
.into()
}),
n => n.clone(),
}
}

/// The hosted events (`details.mode: "hosted"`) of a v5 envelope.
fn hosted_events(v: &Value) -> impl Iterator<Item = &Value> {
v["events"]
.as_array()
.into_iter()
.flatten()
.filter(|e| e["details"]["mode"] == "hosted")
}

/// How many packages a hosted run pinned (or would pin, on a dry run):
/// legacy `redirect.redirected`, else the hosted `applied` / `verified`
/// events.
fn hosted_pins(v: &Value) -> Value {
match &v["redirect"]["redirected"] {
Value::Null if v["events"].is_array() => hosted_events(v)
.filter(|e| e["action"] == "applied" || e["action"] == "verified")
.count()
.into(),
n => n.clone(),
}
}

/// The packages a hosted run skipped: legacy `redirect.skipped[]`, else
/// the hosted `skipped` events.
fn hosted_skips(v: &Value) -> Vec<Value> {
match v["redirect"]["skipped"].as_array() {
Some(a) => a.clone(),
None => hosted_events(v)
.filter(|e| e["action"] == "skipped")
.cloned()
.collect(),
}
}

/// Check that a run did the work the fixture calls for. Any mismatch makes
/// the sample meaningless, so it is an error, not a footnote.
fn validate(
Expand Down Expand Up @@ -326,12 +389,12 @@ fn validate(
),
(
"packagesWithPatches",
v["packagesWithPatches"].clone(),
packages_with_patches(&v),
want_patched.len().into(),
),
(
"totalPatches",
v["totalPatches"].clone(),
total_patches(&v),
p.fixture.patches.len().into(),
),
];
Expand All @@ -342,6 +405,7 @@ fn validate(
}
let mut codes = warning_codes(&v["warnings"]);
let redirect = &v["redirect"];
// Pre-v5 binaries nest the hosted warnings under `redirect`.
codes.extend(warning_codes(&redirect["warnings"]));
let unexpected: Vec<&String> = codes
.iter()
Expand All @@ -354,11 +418,11 @@ fn validate(
+ &serde_json::to_string(&redirect["warnings"]).unwrap_or_default()
));
}
let skipped = redirect["skipped"].as_array().map(Vec::len).unwrap_or(0);
if skipped > 0 {
let skipped = hosted_skips(&v);
if !skipped.is_empty() {
return Err(format!(
"redirect skipped packages: {}",
redirect["skipped"]
Value::Array(skipped)
));
}
let rewritten: Vec<String> = {
Expand All @@ -377,10 +441,11 @@ fn validate(
want_rewritten.sort();
match kind {
Kind::Hosted | Kind::DryRun => {
if redirect["redirected"] != e.redirected {
let redirected = hosted_pins(&v);
if redirected != e.redirected {
return Err(format!(
"redirect.redirected: got {}, want {}",
redirect["redirected"], e.redirected
"redirect.redirected: got {redirected}, want {}",
e.redirected
));
}
if rewritten != want_rewritten {
Expand Down
514 changes: 262 additions & 252 deletions crates/socket-patch-cli/CLI_CONTRACT.md

Large diffs are not rendered by default.

Loading
Loading