Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
93c2b36
build: 7-day supply-chain soak + pinned security tooling
jdalton Jul 28, 2026
8efeaff
docs: changelog fragment for #6912
jdalton Jul 28, 2026
3b73baf
ci(zizmor): run the SRI-pinned binary instead of the marketplace action
jdalton Jul 28, 2026
239e573
deps(sfw): bump firewall pins to 1.14.0 via dated soakBypass
jdalton Jul 28, 2026
c9dc5f5
deps(tools): bump zizmor 1.28.0, pnpm 11.15.1, npm 12.0.1 — newest so…
jdalton Jul 28, 2026
71b13f6
docs: fragment says rack-pinned zizmor, not marketplace action
jdalton Jul 28, 2026
fc7e3f1
feat(soak): auto-prune expired bypass annotations — fixer + scheduled…
jdalton Jul 28, 2026
6cc276e
ci(soak-autofix): bind the artipacked ignore to the checkout line
jdalton Jul 28, 2026
4fe87ad
ci: pin actions/* to latest release-tag SHAs in the new security work…
jdalton Jul 28, 2026
07ca0a9
fix(soak): expired annotations warn instead of failing — stale is not…
jdalton Jul 28, 2026
e3dda61
fix(soak): address review-bot findings across the port
jdalton Jul 28, 2026
d882d5a
fix(sfw): export SFW_UNKNOWN_HOST_ACTION=ignore in the shims
jdalton Jul 28, 2026
aa3e2f2
fix(soak): take review fixes surfaced on the aube twin
jdalton Jul 28, 2026
3255e41
docs(soak): align prose with warn-not-fail; source-cite the unknown-h…
jdalton Jul 28, 2026
3a8f00b
fix(soak): never prune a wrong-arithmetic annotation as "cleared"
jdalton Jul 28, 2026
20a26b0
fix(soak): downloads fall back to unauthenticated and retry once on 5xx
jdalton Jul 28, 2026
c1eed51
fix(soak): stop the fixers reformatting files they do not own
jdalton Jul 28, 2026
88169c6
fix(soak): stop the fixers reformatting files they do not own
jdalton Jul 28, 2026
ce95e57
feat(soak): gate npm's min-release-age-exclude entries too
jdalton Jul 28, 2026
b67907d
fix(soak): fail loudly when cargo silently ignores min-publish-age
jdalton Jul 28, 2026
c3d27e0
feat(soak): explain a window-blocked cargo re-resolution, refuse the …
jdalton Jul 28, 2026
369dadf
fix(soak): take the adversarial-review findings
jdalton Jul 28, 2026
c1ff686
fix(soak): take the review findings — one is a regression I introduced
jdalton Jul 28, 2026
f8c6baf
fix(compile): survive binary/workspace skew and complete the surfaces…
jdalton Jul 29, 2026
e8e529d
docs: changelog fragment for #7021
jdalton Jul 29, 2026
24fd015
fix(runtime): make the rebound RegExp global constructible via its ca…
jdalton Jul 29, 2026
8417353
docs: extend #7021 changelog fragment with the RegExp call-form fix
jdalton Jul 29, 2026
781282f
fix: address stacked stdlib review
Jul 29, 2026
d1fa9fa
fix: address compile stack review
Jul 29, 2026
c611737
Merge main into fix/auto-optimize-feature-skew
Jul 29, 2026
79fa0b7
Merge remote-tracking branch 'origin/main' into maint/pr-7021
Jul 30, 2026
e6892fc
Merge remote-tracking branch 'origin/main' into maint/pr-7021
Jul 30, 2026
a5b6261
Merge remote-tracking branch 'origin/main' into maint/pr-7021
Jul 30, 2026
0cc026e
docs: correct compile-gap blocker count
Jul 30, 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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions changelog.d/7021-real-npm-cli-compile-gaps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**Compile fixes from taking a real npm CLI (Socket Firewall) to a native binary** — five independent blockers, each fixed at its own layer:

- **Auto-optimize feature skew**: cross-features the on-disk checkout's `perry-runtime`/`perry-stdlib` don't declare are now dropped (with a warning) instead of failing the whole cargo resolve and silently falling back to a link that's missing the routed ext entrypoints. The cargo-failure fallback message now explains the consequence and remedy.
- **`perry-ext-zlib` zstd surface**: `zlib.createZstdCompress`/`createZstdDecompress`, the zstd one-shots, and the streaming write-codec are now implemented in the ext wrapper, so routing `node:zlib` no longer strips the only zstd implementation out of the link (undici's web-fetch content decoding references it unconditionally).
- **`class X extends DOMException`**: new `js_dom_exception_subclass_init` wired through both the explicit `super()` lowering and the implicit-ctor chain walk — undici's module-init inheritability probe no longer aborts startup with `DOMException is not a function`.
- **panic-runtime dedup**: prebuilt (panic=unwind) wrapper staticlibs co-linked with a panic=abort auto-optimized stdlib no longer die on `__rust_drop_panic` — the `panic_unwind` member is nominated for the nosharedeps fixed-point (kept only when the stdlib can't cover it), and panic symbols referenced by a sibling member are no longer localized. Allocator shims remain always-localized (a global wrapper malloc shim would break runtime pointer classification).
- **`RegExp` call form via a rebound global**: `var R = globalThis.RegExp; R(src)` now constructs (with the spec's `RegExp(re)` identity shortcut) instead of returning `undefined` from the noop thunk — lodash's `runInContext` module init relied on exactly this.
64 changes: 64 additions & 0 deletions crates/perry-codegen/src/expr/this_super_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,38 @@ pub(crate) fn lower(ctx: &mut FnCtx<'_>, expr: &Expr) -> Result<String> {
)?;
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
// `class X extends DOMException` with a synthesized/pass-through
// constructor (`super(...args)`) must initialize the same surface
// as the fixed-arity super-call path above. Array reads past the
// spread argument count produce `undefined`, matching the optional
// message/name parameters.
let is_dom_exception = ctx
.classes
.get(&current_class_name)
.and_then(|c| c.extends_name.as_deref())
.map(|p| p == "DOMException")
.unwrap_or(false);
if is_dom_exception {
let zero_idx = "0".to_string();
let one_idx = "1".to_string();
let message =
ctx.block()
.call(DOUBLE, "js_array_get_f64", &[(I64, &arr), (I32, &zero_idx)]);
let name =
ctx.block()
.call(DOUBLE, "js_array_get_f64", &[(I64, &arr), (I32, &one_idx)]);
ctx.block().call(
DOUBLE,
"js_dom_exception_subclass_init",
&[(DOUBLE, &this_box), (DOUBLE, &message), (DOUBLE, &name)],
);
crate::lower_call::apply_field_initializers_recursive(
ctx,
&current_class_name,
crate::lower_call::FieldInitMode::SelfOnly,
)?;
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
if let Some(&child_cid) = ctx.class_ids.get(&current_class_name) {
let cid_str = child_cid.to_string();
let blk = ctx.block();
Expand Down Expand Up @@ -384,6 +416,7 @@ pub(crate) fn lower(ctx: &mut FnCtx<'_>, expr: &Expr) -> Result<String> {
| "Response"
| "Event"
| "CustomEvent"
| "DOMException"
) || (is_stream_family_name
&& !has_extends_expr)
|| is_other_builtin_constructor_name(parent_name.as_str()))
Expand Down Expand Up @@ -709,6 +742,37 @@ pub(crate) fn lower(ctx: &mut FnCtx<'_>, expr: &Expr) -> Result<String> {
)?;
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
// `class X extends DOMException` (undici's WebSocketError
// and its module-init inheritability probe): `super(message,
// name)` stamps the DOMException surface (`message`/`name`/
// `code`) onto `this`. The X → DOMException registry edge
// (registered at class-definition time) keeps `instanceof`.
if parent_name.as_str() == "DOMException" {
let undef = double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED));
let mut lowered: Vec<String> = Vec::with_capacity(super_args.len());
for a in super_args {
lowered.push(lower_expr(ctx, a)?);
}
let arg0 = lowered.first().cloned().unwrap_or_else(|| undef.clone());
let arg1 = lowered.get(1).cloned().unwrap_or_else(|| undef.clone());
let this_box = match ctx.this_stack.last().cloned() {
Some(slot) => ctx.block().load(DOUBLE, &slot),
None => undef.clone(),
};
ctx.block().call(
DOUBLE,
"js_dom_exception_subclass_init",
&[(DOUBLE, &this_box), (DOUBLE, &arg0), (DOUBLE, &arg1)],
);
let current_class_name =
ctx.class_stack.last().cloned().unwrap_or_default();
crate::lower_call::apply_field_initializers_recursive(
ctx,
&current_class_name,
crate::lower_call::FieldInitMode::SelfOnly,
)?;
return Ok(double_literal(f64::from_bits(crate::nanbox::TAG_UNDEFINED)));
}
Comment thread
proggeramlug marked this conversation as resolved.
// `class X extends Promise` — `super(executor)` runs the
// ECMA-262 27.2.3.1 Promise constructor against a hidden
// backing `Promise` cell stashed on `this`. Inherited
Expand Down
19 changes: 19 additions & 0 deletions crates/perry-codegen/src/lower_call/new_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub(crate) enum NativeInstanceBase {
Set,
Event,
CustomEvent,
DomException,
}

/// The native base a parent NAME denotes, if any.
Expand All @@ -56,6 +57,7 @@ pub(crate) fn native_instance_base(name: &str) -> Option<NativeInstanceBase> {
"Set" => Some(NativeInstanceBase::Set),
"Event" => Some(NativeInstanceBase::Event),
"CustomEvent" => Some(NativeInstanceBase::CustomEvent),
"DOMException" => Some(NativeInstanceBase::DomException),
_ => None,
}
}
Expand Down Expand Up @@ -170,6 +172,23 @@ pub(crate) fn emit_native_instance_base_init(
],
);
}
NativeInstanceBase::DomException => {
// `super(message, name)` — both optional (`new DOMException()` is
// legal; the runtime defaults name to "Error").
let arg0 = lowered_args
.first()
.cloned()
.unwrap_or_else(|| undef.clone());
let arg1 = lowered_args
.get(1)
.cloned()
.unwrap_or_else(|| undef.clone());
ctx.block().call(
DOUBLE,
"js_dom_exception_subclass_init",
&[(DOUBLE, this_box), (DOUBLE, &arg0), (DOUBLE, &arg1)],
);
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions crates/perry-codegen/src/runtime_decls/strings_part2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,13 @@ pub(crate) fn declare_phase_b_strings_part2(module: &mut LlModule) {
);
module.declare_function("js_custom_event_new", I64, &[DOUBLE, DOUBLE, I32]);
module.declare_function("js_dom_exception_new", I64, &[DOUBLE, DOUBLE]);
// `super(message, name)` from `class X extends DOMException` — stamps the
// DOMException surface (`message`/`name`/`code`) onto the subclass `this`.
module.declare_function(
"js_dom_exception_subclass_init",
DOUBLE,
&[DOUBLE, DOUBLE, DOUBLE],
);
module.declare_function("js_event_target_add_event_listener", VOID, &[I64, I64, I64]);
module.declare_function(
"js_event_target_add_event_listener_with_options",
Expand Down
6 changes: 6 additions & 0 deletions crates/perry-ext-zlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ crate-type = ["staticlib", "rlib"]
[dependencies]
perry-ffi.workspace = true
flate2 = "1"
# zstd codecs: `zlib.zstdCompressSync` / `createZstdDecompress`. When `zlib`
# routes here, perry-stdlib's `compression` module is compiled out — this
# archive must carry the full zstd surface too, or programs whose compiled JS
# references it (undici's web-fetch content decoding does, unconditionally)
# die at link with undefined `js_zlib_*zstd*` symbols.
zstd.workspace = true
# Brotli stream + one-shot support (#1843). Matches the version the
# `compression` feature pulls into perry-stdlib.
brotli = "8.0.2"
Expand Down
111 changes: 111 additions & 0 deletions crates/perry-ext-zlib/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,72 @@ pub unsafe extern "C" fn js_zlib_brotli_decompress(data_value: f64, callback_val
});
}

fn throw_zstd_error(err: &std::io::Error) -> ! {
perry_ffi::throw_with_code(&format!("zstd: {}", err), "Z_DATA_ERROR", ErrorKind::Error)
}

/// `zlib.zstdCompressSync(data)` -> Buffer. `_opts` is accepted (codegen
/// passes the options slot through) but zstd params are not wired up —
/// matches perry-stdlib's copy.
///
/// # Safety
/// `data_value` is the raw NaN-boxed data argument (string or Buffer).
#[no_mangle]
pub unsafe extern "C" fn js_zlib_zstd_compress_sync(
data_value: f64,
_opts: f64,
) -> *mut BufferHeader {
let data_bits = data_value.to_bits() as i64;
js_zlib_validate_buffer_arg(data_bits);
match read_input_from_bits(data_bits)
.map(|d| zstd::stream::encode_all(d.as_slice(), ZSTD_DEFAULT_LEVEL))
{
Some(Ok(out)) => alloc_buffer(&out),
Some(Err(e)) => throw_zstd_error(&e),
None => std::ptr::null_mut(),
}
}

/// `zlib.zstdDecompressSync(data)` -> Buffer.
///
/// # Safety
/// `data_value` is the raw NaN-boxed data argument (string or Buffer).
#[no_mangle]
pub unsafe extern "C" fn js_zlib_zstd_decompress_sync(
data_value: f64,
_opts: f64,
) -> *mut BufferHeader {
let data_bits = data_value.to_bits() as i64;
js_zlib_validate_buffer_arg(data_bits);
match read_input_from_bits(data_bits).map(|d| zstd::stream::decode_all(d.as_slice())) {
Some(Ok(out)) => alloc_buffer(&out),
Some(Err(e)) => throw_zstd_error(&e),
None => std::ptr::null_mut(),
}
}

/// `zlib.zstdCompress(data, callback)` -> undefined.
///
/// # Safety
/// `data_value` and `callback_value` are raw NaN-boxed JS values.
#[no_mangle]
pub unsafe extern "C" fn js_zlib_zstd_compress(data_value: f64, callback_value: f64) {
queue_one_shot_callback(data_value, callback_value, "ZstdCompress", |b| {
zstd::stream::encode_all(b, ZSTD_DEFAULT_LEVEL)
});
}

/// `zlib.zstdDecompress(data, callback)` -> undefined.
///
/// # Safety
/// `data_value` and `callback_value` are raw NaN-boxed JS values.
#[no_mangle]
pub unsafe extern "C" fn js_zlib_zstd_decompress(data_value: f64, callback_value: f64) {
queue_one_shot_callback(data_value, callback_value, "ZstdDecompress", |b| {
zstd::stream::decode_all(b)
});
}

// ── stream codec ─────────────────────────────────────────────────────────────

#[derive(Clone, Copy)]
Expand All @@ -220,8 +286,15 @@ enum Codec {
Unzip,
BrotliCompress,
BrotliDecompress,
ZstdCompress,
ZstdDecompress,
}

/// Node's `zlib` zstd default (matches perry-stdlib's copy). zstd levels run
/// 1..=22 and don't share the deflate 0..=9 scale, so the `{ level }` option
/// resolved by `js_zlib_resolve_level` is not applied to zstd codecs.
const ZSTD_DEFAULT_LEVEL: i32 = 3;

fn run_codec(codec: Codec, input: &[u8]) -> std::io::Result<Vec<u8>> {
let mut out = Vec::new();
match codec {
Expand Down Expand Up @@ -253,6 +326,8 @@ fn run_codec(codec: Codec, input: &[u8]) -> std::io::Result<Vec<u8>> {
}
Codec::BrotliCompress => out = brotli_compress_bytes(input),
Codec::BrotliDecompress => out = brotli_decompress_bytes(input)?,
Codec::ZstdCompress => out = zstd::stream::encode_all(input, ZSTD_DEFAULT_LEVEL)?,
Codec::ZstdDecompress => out = zstd::stream::decode_all(input)?,
}
Ok(out)
}
Expand All @@ -275,6 +350,8 @@ enum CodecState {
DeflateDec(flate2::write::DeflateDecoder<Vec<u8>>),
BrotliEnc(brotli::CompressorWriter<Vec<u8>>),
BrotliDec(brotli::DecompressorWriter<Vec<u8>>),
ZstdEnc(zstd::stream::write::Encoder<'static, Vec<u8>>),
ZstdDec(zstd::stream::write::Decoder<'static, Vec<u8>>),
}

impl CodecState {
Expand All @@ -288,6 +365,8 @@ impl CodecState {
CodecState::DeflateDec(w) => w.write_all(data),
CodecState::BrotliEnc(w) => w.write_all(data),
CodecState::BrotliDec(w) => w.write_all(data),
CodecState::ZstdEnc(w) => w.write_all(data),
CodecState::ZstdDec(w) => w.write_all(data),
}
}

Expand All @@ -301,6 +380,8 @@ impl CodecState {
CodecState::DeflateDec(w) => w.flush(),
CodecState::BrotliEnc(w) => w.flush(),
CodecState::BrotliDec(w) => w.flush(),
CodecState::ZstdEnc(w) => w.flush(),
CodecState::ZstdDec(w) => w.flush(),
}
}

Expand All @@ -315,6 +396,8 @@ impl CodecState {
CodecState::DeflateDec(w) => std::mem::take(w.get_mut()),
CodecState::BrotliEnc(w) => std::mem::take(w.get_mut()),
CodecState::BrotliDec(w) => std::mem::take(w.get_mut()),
CodecState::ZstdEnc(w) => std::mem::take(w.get_mut()),
CodecState::ZstdDec(w) => std::mem::take(w.get_mut()),
}
}

Expand All @@ -331,6 +414,14 @@ impl CodecState {
// DecompressorWriter::into_inner returns Result<W, W> (Err on an
// unterminated stream); take the decoded bytes either way.
CodecState::BrotliDec(w) => Ok(w.into_inner().unwrap_or_else(|v| v)),
// Encoder::finish writes the zstd frame epilogue then hands back
// the inner Vec; Decoder::into_inner is tolerant of an
// unterminated frame (same stance as BrotliDec above).
CodecState::ZstdEnc(w) => w.finish(),
CodecState::ZstdDec(mut w) => {
w.flush()?;
Ok(w.into_inner())
}
}
}
}
Expand Down Expand Up @@ -358,6 +449,15 @@ fn make_codec_state_with_level(codec: Codec, level: Compression) -> Option<Codec
Codec::BrotliDecompress => {
CodecState::BrotliDec(brotli::DecompressorWriter::new(Vec::new(), 4096))
}
// zstd context allocation is fallible; `None` falls back to the same
// buffer-until-end `run_codec` path `createUnzip` uses, so a failed
// allocation degrades to one-shot semantics instead of erroring.
Codec::ZstdCompress => CodecState::ZstdEnc(
zstd::stream::write::Encoder::new(Vec::new(), ZSTD_DEFAULT_LEVEL).ok()?,
),
Codec::ZstdDecompress => {
CodecState::ZstdDec(zstd::stream::write::Decoder::new(Vec::new()).ok()?)
}
// Unzip auto-detects the header — kept buffer-until-end (run_codec).
Codec::Unzip => return None,
})
Expand Down Expand Up @@ -523,6 +623,8 @@ factory!(js_zlib_create_inflate_raw, Codec::InflateRaw, 8);
factory!(js_zlib_create_unzip, Codec::Unzip, 8);
factory!(js_zlib_create_brotli_compress, Codec::BrotliCompress, 0);
factory!(js_zlib_create_brotli_decompress, Codec::BrotliDecompress, 0);
factory!(js_zlib_create_zstd_compress, Codec::ZstdCompress, 0);
factory!(js_zlib_create_zstd_decompress, Codec::ZstdDecompress, 0);

// ── chunk / buffer helpers ─────────────────────────────────────────────────────

Expand Down Expand Up @@ -1346,6 +1448,15 @@ mod stream_tests {
);
}

#[test]
fn zstd_decoder_finish_flushes_pending_output() {
let expected = b"zstd decoder output buffered until the stream finishes";
let compressed = zstd::stream::encode_all(expected.as_slice(), ZSTD_DEFAULT_LEVEL).unwrap();
let mut decoder = make_codec_state(Codec::ZstdDecompress).expect("zstd decoder");
decoder.write_chunk(&compressed).unwrap();
assert_eq!(decoder.finish().unwrap(), expected);
}

#[test]
fn gunzip_run_codec_reads_all_members() {
let a = stream_compress(Codec::Gzip, &[b"first "]);
Expand Down
Loading
Loading