From 15f3d3c3bbb770743b6580b1ed85badb02b8ef5e Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 5 Dec 2026 08:57:06 +0000 Subject: [PATCH] Tests: a bundle with a duplicate entry duplicates the smaller file, so the declared-total cap can't trip first The bundle may unpack to no more than its declared total, checked before each entry. Duplicating files[0] tripped that cap ("unpacks to more than 399 bytes") whenever its PNG came out a byte larger than files[1]'s, before the duplicate check could say "twice" (CI on eda9f19). --- app/tests/bundle_uploads.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/tests/bundle_uploads.rs b/app/tests/bundle_uploads.rs index d2ac3f459..6e3be45aa 100644 --- a/app/tests/bundle_uploads.rs +++ b/app/tests/bundle_uploads.rs @@ -324,9 +324,11 @@ async fn more_entries_than_declared_fail_the_build(app: Application) -> laravel: let files = fresh_pngs(2); let id = create(&app, &token).await; register(&app, &token, &id, &files).await; - // The first file twice, then the second: three entries for two declared. + // The smaller file twice, then the other: three entries for two declared. The bundle may unpack to no more than + // the declared total, checked before each entry, so duplicating the larger file would trip that limit first. + let (small, large) = if files[0].len() <= files[1].len() { (&files[0], &files[1]) } else { (&files[1], &files[0]) }; let mut w = bundle::Writer::new(Vec::new()).unwrap(); - for f in [&files[0], &files[0], &files[1]] { + for f in [small, small, large] { w.add(&sha(f), f).unwrap(); } let bundle = send(&app, &token, &id, &declared(&files), w.finish().unwrap()).await;