From b5f372374d10ba42f5e8ec79c59a003715fa9b8a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2026 18:00:10 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20timestamp=20?= =?UTF-8?q?finding=20in=20workflow=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-checks.yml | 11 +++++------ .jules/bolt.md | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 4131c473b..404c190f2 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -354,12 +354,11 @@ jobs: return 'skip'; } function latestIso(values) { - const times = values - .map(value => Date.parse(value)) - .filter(Number.isFinite); - return times.length > 0 - ? new Date(Math.max(...times)).toISOString() - : null; + const maxTime = values.reduce((max, val) => { + const time = Date.parse(val); + return Number.isFinite(time) && time > max ? time : max; + }, -Infinity); + return maxTime > -Infinity ? new Date(maxTime).toISOString() : null; } function workflowRunId(targetUrl) { const target = String(targetUrl || ''); diff --git a/.jules/bolt.md b/.jules/bolt.md index fa5a3cfc9..d458b9bdc 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -16,4 +16,4 @@ **Action:** Extract pure transformation logic on static/infrequent data into `useMemo` hooks (e.g., memoizing the paragraph split on `transcript` and precomputing search `RegExp` based on `searchQuery`). ## 2026-07-24 - Avoiding spread operator for large arrays in calculations **Learning:** Using `Math.max(...array.map())` on potentially large data structures runs the risk of hitting the "Maximum call stack size exceeded" error, and creates unnecessary intermediate array allocations, reducing performance. -**Action:** Replace multiple O(N) array mapping and spread operations with a single O(N) `for` loop to compute bounds simultaneously with zero intermediate allocations. +**Action:** Replace multiple O(N) array mapping and spread operations with a single O(N) `for` loop to compute bounds simultaneously with zero intermediate allocations. Or in cases finding the max of parsed strings, use a `.reduce()` loop for a safe single pass without generating intermediate array structures. From 6c6ad106684be2ce41fe2cecaeda39b71a55e2f0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2026 18:03:41 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20timestamp=20?= =?UTF-8?q?finding=20in=20workflow=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commit_message.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 commit_message.txt diff --git a/commit_message.txt b/commit_message.txt new file mode 100644 index 000000000..951fad473 --- /dev/null +++ b/commit_message.txt @@ -0,0 +1,8 @@ +⚡ Bolt: Optimize timestamp finding in workflow checks + +💡 What: Optimize timestamp finding in `latestIso` function by replacing `.map` and `Math.max(...times)` with a single `.reduce()` operation. +🎯 Why: `.map` followed by `Math.max(...times)` allocates unnecessary intermediate arrays and can throw "Maximum call stack size exceeded" on large data sets. +📊 Impact: Avoids stack overflow for large arrays and speeds up execution by iterating through the array once instead of multiple times without intermediate array creation. +🔬 Measurement: Validated via pytest tests for workflow governance. + + From fcc621ada760da122b8cdad4261fd42963314a5a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2026 18:12:35 +0000 Subject: [PATCH 3/3] Fix: Remove stray commit_message.txt artifact --- commit_message.txt | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 commit_message.txt diff --git a/commit_message.txt b/commit_message.txt deleted file mode 100644 index 951fad473..000000000 --- a/commit_message.txt +++ /dev/null @@ -1,8 +0,0 @@ -⚡ Bolt: Optimize timestamp finding in workflow checks - -💡 What: Optimize timestamp finding in `latestIso` function by replacing `.map` and `Math.max(...times)` with a single `.reduce()` operation. -🎯 Why: `.map` followed by `Math.max(...times)` allocates unnecessary intermediate arrays and can throw "Maximum call stack size exceeded" on large data sets. -📊 Impact: Avoids stack overflow for large arrays and speeds up execution by iterating through the array once instead of multiple times without intermediate array creation. -🔬 Measurement: Validated via pytest tests for workflow governance. - -