fix no did logs#1383
Conversation
|
/run-security-scan |
alexcos20
left a comment
There was a problem hiding this comment.
AI automated code review (Gemini 3).
Overall risk: low
Summary:
The PR implements a clean and effective fix to allow raw-code algorithms to execute without attempting unnecessary DDO lookups. The architecture is maintained, performance is improved by bypassing unnecessary DB/network overhead, and test coverage correctly verifies both the returned state and the absence of side-effects.
Comments:
• [INFO][style] Good improvement using the falsy check (!elem.documentId) to catch empty strings, null, or undefined values that might bypass the in operator check and trigger failing lookups downstream.
• [INFO][performance] Excellent early return. Short-circuiting here when algoDID is falsy successfully avoids an unnecessary database/network hit via findAndFormatDdo and prevents logging noisy error messages. Good implementation.
• [INFO][other] Great unit test addition. Utilizing sinon to stub the DDO handler and spy on the logger accurately verifies that no unnecessary work or logging is occurring for raw-code algorithms. LGTM!
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
| Filename | Overview |
|---|---|
| src/components/core/compute/utils.ts | Adds early-return guard for undefined algoDID; widens function signature to string |
| src/components/core/compute/startCompute.ts | Adds falsy-documentId guard to the DDO-resolution loop, preventing lookups for elements where documentId exists as a key but is empty/undefined. |
| src/test/unit/compute.test.ts | New unit test suite for getAlgoChecksums; correctly stubs FindDdoHandler and spies on CORE_LOGGER to assert no DDO lookup or error log occurs for undefined DID. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[startCompute: iterate algorithm + datasets] --> B{"'documentId' in elem\nAND elem.documentId?"}
B -- No --> C[skip / continue]
B -- Yes --> D[FindDdoHandler.findAndFormatDdo]
D --> E{DDO found?}
E -- No --> F[return 500 error]
E -- Yes --> G[proceed with DDO validation]
H[getAlgoChecksums called] --> I{algoDID defined?}
I -- No --> J[return empty checksums\nno DDO lookup, no error log]
I -- Yes --> K[FindDdoHandler.findAndFormatDdo]
K --> L{DDO found?}
L -- No --> M[log error, return empty checksums]
L -- Yes --> N[compute file + container checksums]
Reviews (1): Last reviewed commit: "fix no did logs" | Re-trigger Greptile
Fixes #1245
Changes proposed in this PR: