-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Looker Classifications handing #5322
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
app/packages/looker/src/lookers/abstract.ts (3)
27-29
: Add a short docstring for new overlay imports
While these imports look good, consider adding a short docstring or code comment clarifying the purpose of each overlay to improve clarity in the codebase.
556-557
: Leverage the existing buffer checks
There is a blank line before pushingbuffer
toarrayBuffers
. This is more of a style preference than a functional concern, but be mindful of extra lines that could reduce visual clarity.
752-752
: Ensure robust cleanup error handling
The optional chaining onoverlay.cleanup?.()
is a good safeguard. However, if a cleanup error arises, ensure it is handled or logged to prevent silent failures and aid debugging.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/packages/looker/src/lookers/abstract.ts
(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/looker/src/lookers/abstract.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (1)
app/packages/looker/src/lookers/abstract.ts (1)
534-540
: Check for missing or undefined overlay.label
Before accessing overlay.label.mask
or overlay.label.map
, ensure overlay.label
is defined. Otherwise, if overlay.label
is unexpectedly null, a runtime error may occur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/packages/state/src/utils.ts (1)
68-79
: Check behavior for string inputs inviewsAreEqual
.When
viewOne
andviewTwo
are both strings with identical content, the initial strict equality check (===
) correctly treats them as equal. However, other string nuances (e.g., leading/trailing spaces) might lead to unexpected comparisons. If partial matches or case-insensitive comparisons are desired, consider customizing the comparison logic.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
app/packages/looker/tsconfig.json
is excluded by!**/*.json
📒 Files selected for processing (1)
app/packages/state/src/utils.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/state/src/utils.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (1)
app/packages/state/src/utils.ts (1)
60-60
: Type annotation improvement is good to see.
By explicitly typing the parameter as State.Stage[]
, this prevents inadvertent misuse of the filterView
function. It also ensures better clarity for future readers and contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
app/packages/state/src/utils.test.ts (1)
12-20
: Expand test coverage for array-based viewsCurrently, there is only a test for empty arrays. Consider adding more scenarios, such as different array lengths, partially similar arrays, or objects within arrays, to ensure
viewsAreEqual
is thoroughly validated.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/packages/state/src/utils.test.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/state/src/utils.test.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (1)
app/packages/state/src/utils.test.ts (1)
2-2
: Ensure comprehensive testing of all newly imported functions
While adding viewsAreEqual
to the import statement is correct, confirm that all required functionality is covered by unit tests. This prevents future regressions if the function is referenced in other test suites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
app/packages/looker/src/lookers/utils.test.ts (1)
2-7
: Consider adding test coverage for list overlays with actual data.Currently, these imported overlay classes are tested only with empty or minimal data. It could be beneficial to introduce test scenarios in which overlays contain real data that produce non-empty array buffers, ensuring more comprehensive coverage of
retrieveArrayBuffers
under varying conditions.app/packages/looker/src/lookers/utils.ts (1)
13-57
: Solid approach for handling detached ArrayBuffers and fallback logic.The retrieval logic, along with the early return for detached buffers, is well structured. One minor improvement could be introducing optional chaining for accessing label data, e.g.
overlay.label?.mask
, as a defensive measure in case of overlays with unexpected label structures.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/packages/looker/src/lookers/abstract.ts
(4 hunks)app/packages/looker/src/lookers/utils.test.ts
(2 hunks)app/packages/looker/src/lookers/utils.ts
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
app/packages/looker/src/lookers/utils.test.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
app/packages/looker/src/lookers/abstract.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
app/packages/looker/src/lookers/utils.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (3)
app/packages/looker/src/lookers/utils.test.ts (1)
26-62
: All tests currently return an empty array.While these tests confirm the absence of buffers, it might be worth verifying at least one scenario where real buffers exist. This would ensure that
retrieveArrayBuffers
is fully validated for overlays that hold actual mask/map data.app/packages/looker/src/lookers/abstract.ts (2)
525-525
: Verify overlay availability before transferring.When calling
retrieveArrayBuffers(this.sampleOverlays)
, ensure your sample overlays are fully loaded to avoid passingundefined
or incomplete data toloadSample
. If there's any asynchronous loading involved, it would be prudent to make certain thatthis.sampleOverlays
is populated before transfer.
710-710
: Good approach for cleaning up overlays conditionally.Calling
overlay.cleanup?.()
accommodates overlays that lack acleanup
method. This helps prevent errors. No further issues found here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/packages/looker/src/lookers/utils.test.ts (1)
38-54
: Improve test data qualityConsider using more realistic test data instead of empty objects and arrays. This would help ensure the functionality works with actual use cases. For example:
- Add meaningful tags
- Include actual point coordinates for PolylineOverlay
- Use realistic IDs
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
app/packages/looker/src/lookers/utils.test.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
app/packages/looker/src/lookers/utils.test.ts (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (1)
app/packages/looker/src/lookers/utils.test.ts (1)
2-8
: Verify the import location of TemporalDetectionOverlayThe
TemporalDetectionOverlay
is imported from "../overlays/classifications", but its name suggests it should be in a detection-related file. Consider verifying if this is the intended location.✅ Verification successful
The import location of TemporalDetectionOverlay is correct
The
TemporalDetectionOverlay
is correctly imported from "../overlays/classifications" as it extendsClassificationsOverlay
and is specifically designed to handle temporal classification data with support intervals. The implementation shows it's a specialized version ofClassificationsOverlay
that filters labels based on temporal properties and frame numbers, which aligns with its placement in the classifications module.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check the actual implementation location and any other potential references rg --type ts "class TemporalDetectionOverlay" app/packages/looker/src/Length of output: 194
Script:
#!/bin/bash # Let's check the implementation details of TemporalDetectionOverlay to understand its relationship with ClassificationsOverlay ast-grep --pattern 'class TemporalDetectionOverlay extends ClassificationsOverlay<$$$>'Length of output: 89
Script:
#!/bin/bash # Let's examine the content of the classifications.ts file to understand the relationship cat app/packages/looker/src/overlays/classifications.tsLength of output: 9639
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! thanks for the new tests
What changes are proposed in this pull request?
The
ClassificationsOverlay
does not have alabel
attribute. Resolves #5317How is this patch tested? If it is not, please explain why.
Unit test for edge cases
Release Notes
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
New Features
Bug Fixes
Chores
viewsAreEqual
function to ensure correct behavior.