Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@
## 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.

## 2024-08-09 - Improving exception handling coverage with unittest.mock

**Learning:** Exception handling paths in python files can be difficult to test since they require edge case states. We can use unittest.mock.patch and side_effect to mock internal functions and trigger exceptions manually for 100% branch test coverage.
**Action:** Use unittest.mock.patch with a generic side_effect exception when testing try/except safety fallbacks in public functions.
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^1.24.0",
"pdfjs-dist": "6.1.200",
"pdfjs-dist": "^6.2.108",
"react": "^19.2.4",
"react-dom": "^19.2.7",
"sonner": "^2.0.7",
Expand Down
46 changes: 10 additions & 36 deletions package-lock.json

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

20 changes: 20 additions & 0 deletions services/analysis-engine/tests/test_hits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

from unittest.mock import patch

import numpy as np
from numpy.typing import NDArray

Expand Down Expand Up @@ -138,3 +140,21 @@ def test_detect_shared_hits_safe_failure_inputs() -> None:
assert detect_shared_hits({"vocals": _tone(1.0)}, 0) == []
# Non-numeric array must not raise.
assert detect_shared_hits({"vocals": np.array(["boom"])}, SR) == [] # type: ignore[dict-item]


def test_detect_stop_time_handles_exceptions() -> None:
"""detect_stop_time returns [] when internal logic raises an exception."""
with patch(
"bandscope_analysis.temporal.hits._detect_stop_time",
side_effect=Exception("Test error"),
):
assert detect_stop_time({"vocals": np.zeros(SR, dtype=np.float64)}, SR) == []


def test_detect_shared_hits_handles_exceptions() -> None:
"""detect_shared_hits returns [] when internal logic raises an exception."""
with patch(
"bandscope_analysis.temporal.hits._detect_shared_hits",
side_effect=Exception("Test error"),
):
assert detect_shared_hits({"vocals": np.zeros(SR, dtype=np.float64)}, SR) == []
Loading