Skip to content

Commit bf40013

Browse files
committed
fix(perf): size local package fallbacks
Use remote tarball sizing only after the corresponding preview package was installed successfully. When either package URL times out, benchmark and size the available local checkout so fallback runs can still produce a complete report. Cover base and head source selection and verify both unavailable URLs through a committed-fixture smoke run.
1 parent b8dbb41 commit bf40013

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎apps/ccusage/scripts/compare-pr-performance_test.clj‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@
7979
(deftest fallback-decisions
8080
(is (= :installed (base-source-decision {:package-install {:bin-entry "bin"}})))
8181
(is (= :local (base-source-decision {:base-dir "/repo"})))
82-
(is (= :skip (base-source-decision {:base-package-url "https://example.test/pkg"}))))
82+
(is (= :skip (base-source-decision {:base-package-url "https://example.test/pkg"})))
83+
(is (= :remote (base-package-size-source {:base-package-install {:bin-entry "bin"}})))
84+
(is (= :local (base-package-size-source {:base-dir "/repo"
85+
:base-package-url "https://example.test/pkg"})))
86+
(is (= :remote (head-package-size-source {:head-package-install {:bin-entry "bin"}})))
87+
(is (= :local (head-package-size-source {:head-dir "/repo"
88+
:head-package-url "https://example.test/pkg"}))))
8389

8490
(deftest platform-normalization
8591
(is (= "darwin" (normalize-platform-name "Mac OS X")))

‎apps/ccusage/scripts/compare_pr_performance/main.clj‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,22 @@
4343
:title "Large real-world-shaped fixture performance" :runs (:large-runs context) :warmup (:large-warmup context)})))]
4444
(cond-> [committed] large (conj large))))
4545

46+
(defn base-package-size-source [context]
47+
(if (:base-package-install context) :remote :local))
48+
49+
(defn head-package-size-source [context]
50+
(if (:head-package-install context) :remote :local))
51+
4652
(defn sizes-for [context]
4753
{:base-native-package-binary (optional-file-size (:base-native-bin-entry context))
48-
:base-package (if (:base-package-url context) (remote-tarball-size (:base-package-url context)) (packed-tarball-size (:base-dir context)))
54+
:base-package (if (= :remote (base-package-size-source context))
55+
(remote-tarball-size (:base-package-url context))
56+
(packed-tarball-size (:base-dir context)))
4957
:base-rust-binary (when (:base-dir context) (optional-file-size (rust-binary-entry (:base-dir context))))
5058
:head-native-package-binary (optional-file-size (:head-native-bin-entry context))
51-
:head-package (if (:head-package-url context) (remote-tarball-size (:head-package-url context)) (packed-tarball-size (:head-dir context)))
59+
:head-package (if (= :remote (head-package-size-source context))
60+
(remote-tarball-size (:head-package-url context))
61+
(packed-tarball-size (:head-dir context)))
5262
:head-rust-binary (optional-file-size (rust-binary-entry (:head-dir context)))})
5363

5464
(defn -main [& argv]

0 commit comments

Comments
 (0)