From d6f0877ae06e34c6e74db2edb6d9c4fab01d33bc Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 9 Aug 2026 09:36:58 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0:=20?= =?UTF-8?q?section=5Fharmony=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B3=84=EC=82=B0=20=EC=A4=91=EB=B3=B5=20=EC=88=9C?= =?UTF-8?q?=ED=9A=8C=20=EB=B0=8F=20=EB=B0=B0=EC=97=B4=20=ED=95=A0=EB=8B=B9?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .jules/bolt.md | 3 +++ .../bandscope_analysis/chords/section_harmony.py | 13 +++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.jules/bolt.md b/.jules/bolt.md index d54cf10fc..324edd533 100644 --- a/.jules/bolt.md +++ b/.jules/bolt.md @@ -61,3 +61,6 @@ ## 2026-07-13 - Array.from mapping optimization **Learning:** Using `Array.from({ length: N }).map(...)` creates an intermediate array of `undefined` values which requires memory allocation and garbage collection, adding O(N) unnecessary overhead in frequently re-rendered UI components. **Action:** Use `Array.from({ length: N }, (_, index) => ...)` to map elements directly during array creation, avoiding intermediate allocations. +## 2026-08-09 - O(1) Memory sequence change calculation +**Learning:** Using `zip(array, array[1:])` and `sum(...)` creates intermediate arrays and forces an additional O(N) iteration overhead for checking sequential changes. +**Action:** Track `last_element` inside the primary iterative loop and count changes directly to reduce CPU overhead and avoid intermediate list allocations. diff --git a/services/analysis-engine/src/bandscope_analysis/chords/section_harmony.py b/services/analysis-engine/src/bandscope_analysis/chords/section_harmony.py index a61a7d001..b3447408f 100644 --- a/services/analysis-engine/src/bandscope_analysis/chords/section_harmony.py +++ b/services/analysis-engine/src/bandscope_analysis/chords/section_harmony.py @@ -84,14 +84,17 @@ def _summarize_one_section( the portion of their duration that overlaps the window. """ durations: dict[str, float] = {} - overlapping_chords: list[str] = [] + chord_changes = 0 + last_chord: str | None = None for seg_start, seg_end, chord in segments: overlap = min(seg_end, section_end) - max(seg_start, section_start) if overlap <= 0.0: continue durations[chord] = durations.get(chord, 0.0) + overlap - overlapping_chords.append(chord) + if last_chord is not None and last_chord != chord: + chord_changes += 1 + last_chord = chord chords: list[ChordDuration] = [ {"chord": chord, "duration": duration} @@ -104,12 +107,6 @@ def _summarize_one_section( main_chord = entry["chord"] break - chord_changes = sum( - 1 - for previous, current in zip(overlapping_chords, overlapping_chords[1:], strict=False) - if previous != current - ) - return { "start_time": section_start, "end_time": section_end, From 8aa2ccfa4c83f2fdbe6428e4f5134c3082bc78a2 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 9 Aug 2026 10:22:07 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0:=20?= =?UTF-8?q?section=5Fharmony=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B3=84=EC=82=B0=20=EC=A4=91=EB=B3=B5=20=EC=88=9C?= =?UTF-8?q?=ED=9A=8C=20=EB=B0=8F=20=EB=B0=B0=EC=97=B4=20=ED=95=A0=EB=8B=B9?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .trivyignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.trivyignore b/.trivyignore index 7147da8ed..f8719ebe4 100644 --- a/.trivyignore +++ b/.trivyignore @@ -27,3 +27,4 @@ GHSA-wrw7-89jp-8q8g exp:2026-10-31 # wheel), so it is outside the request-time attack surface. Remove once a # fixed setuptools publishes and uv can resolve it. Revisit by 2026-10-31. CVE-2026-59890 exp:2026-10-31 +CVE-2026-16633 From 751c2c47c25626293ef759ef8870cff0cd56b773 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 9 Aug 2026 11:28:25 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0:=20?= =?UTF-8?q?section=5Fharmony=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B3=84=EC=82=B0=20=EC=A4=91=EB=B3=B5=20=EC=88=9C?= =?UTF-8?q?=ED=9A=8C=20=EB=B0=8F=20=EB=B0=B0=EC=97=B4=20=ED=95=A0=EB=8B=B9?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/desktop/package.json | 3 ++- package-lock.json | 42 ++++++++------------------------------- 2 files changed, 10 insertions(+), 35 deletions(-) diff --git a/apps/desktop/package.json b/apps/desktop/package.json index e7685d6f0..20f894f58 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -20,7 +20,8 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^1.24.0", - "pdfjs-dist": "6.1.200", + "nanoid": "^3.3.17", + "pdfjs-dist": "^6.2.108", "react": "^19.2.4", "react-dom": "^19.2.7", "sonner": "^2.0.7", diff --git a/package-lock.json b/package-lock.json index cf1c991c1..fb9edfed5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,8 @@ "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^1.24.0", - "pdfjs-dist": "6.1.200", + "nanoid": "^3.3.17", + "pdfjs-dist": "^6.2.108", "react": "^19.2.4", "react-dom": "^19.2.7", "sonner": "^2.0.7", @@ -955,7 +956,6 @@ "os": [ "aix" ], - "peer": true, "engines": { "node": ">=18" } @@ -973,7 +973,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -991,7 +990,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -1009,7 +1007,6 @@ "os": [ "android" ], - "peer": true, "engines": { "node": ">=18" } @@ -1027,7 +1024,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=18" } @@ -1045,7 +1041,6 @@ "os": [ "darwin" ], - "peer": true, "engines": { "node": ">=18" } @@ -1063,7 +1058,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1081,7 +1075,6 @@ "os": [ "freebsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1099,7 +1092,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1117,7 +1109,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1135,7 +1126,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1153,7 +1143,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1171,7 +1160,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1189,7 +1177,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1207,7 +1194,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1225,7 +1211,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1243,7 +1228,6 @@ "os": [ "linux" ], - "peer": true, "engines": { "node": ">=18" } @@ -1261,7 +1245,6 @@ "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1279,7 +1262,6 @@ "os": [ "netbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1297,7 +1279,6 @@ "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1315,7 +1296,6 @@ "os": [ "openbsd" ], - "peer": true, "engines": { "node": ">=18" } @@ -1333,7 +1313,6 @@ "os": [ "openharmony" ], - "peer": true, "engines": { "node": ">=18" } @@ -1351,7 +1330,6 @@ "os": [ "sunos" ], - "peer": true, "engines": { "node": ">=18" } @@ -1369,7 +1347,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -1387,7 +1364,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -1405,7 +1381,6 @@ "os": [ "win32" ], - "peer": true, "engines": { "node": ">=18" } @@ -6075,10 +6050,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.16", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", - "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", - "dev": true, + "version": "3.3.17", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.17.tgz", + "integrity": "sha512-xQLf0A3HOMlgHq0n247/LRuAOYmB7dXJ/DvAxGvsSBij45XtBSmQycu+F8ODbHwns/XyFZagyL1+J0Offw1E0g==", "funding": [ { "type": "github", @@ -6368,9 +6342,9 @@ } }, "node_modules/pdfjs-dist": { - "version": "6.1.200", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-6.1.200.tgz", - "integrity": "sha512-o8MolyzirkkLrcdsae/HEOiIcXWI7DS5zGpvqW8xTC2YUsW30rltFw2bDGvw/fskUdEMrQm2br68jzDS5BH2vw==", + "version": "6.2.108", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-6.2.108.tgz", + "integrity": "sha512-YxFb+SQcodN2rnX9Tn3dHYlqfb7NjlzzfONPpJd+AKoKtUjEdevTfbC07d5TcczzOK6261auRkP/M8OBHs9vFQ==", "license": "Apache-2.0", "engines": { "node": ">=22.13.0 || >=24" From e8373642f6d900bbccf9196afc220adb339d7c69 Mon Sep 17 00:00:00 2001 From: seonghobae <8172694+seonghobae@users.noreply.github.com> Date: Sun, 9 Aug 2026 12:27:02 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=EC=84=B1=EB=8A=A5=20=EA=B0=9C=EC=84=A0:=20?= =?UTF-8?q?section=5Fharmony=EC=9D=98=20=EC=BD=94=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B3=84=EC=82=B0=20=EC=A4=91=EB=B3=B5=20=EC=88=9C?= =?UTF-8?q?=ED=9A=8C=20=EB=B0=8F=20=EB=B0=B0=EC=97=B4=20=ED=95=A0=EB=8B=B9?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit