Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@
## 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-10-24 - O(N) callback overhead in byte array validation
**Learning:** Using `.every()` to validate large arrays (like byte arrays from IPC) causes O(N) callback invocation overhead, which slows down execution significantly compared to a plain loop.
**Action:** Use a standard `for` loop with an early return for validating large arrays to achieve significantly faster execution.
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions apps/desktop/src/features/score/scoreStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,17 @@ export async function readScorePdf(projectId: string, scoreId: string): Promise<
if (response instanceof ArrayBuffer) {
return new Uint8Array(response);
}
if (Array.isArray(response) && response.every((byte) => typeof byte === "number")) {
return Uint8Array.from(response as number[]);
if (Array.isArray(response)) {
let allNumbers = true;
for (let i = 0; i < response.length; i++) {
if (typeof response[i] !== "number") {
allNumbers = false;
break;
}
}
if (allNumbers) {
return Uint8Array.from(response as number[]);
}
}

throw new Error(INVALID_RESPONSE_MESSAGE);
Expand Down
Loading