feat(hitl): decouple bboxes from confidence scores#4639
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR introduces a combined ChangesBounding Box and AI Extracted Process Support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
feat(hitl): flow fix feat(hitl): flow fix feat(hitl): flow fix feat(hitl): flow fix feat(hitl): flow fix
a7749ac to
0fb8c69
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts (1)
74-74: ⚡ Quick winFix typoed flag names before they spread further.
isBoundindBoxEnabled/boundindBoxParamsare misspelled. Renaming now will make callsites and future refactors safer.Proposed rename
- isBoundindBoxEnabled: boolean = false, + isBoundingBoxEnabled: boolean = false, ... - const isBoundingBoxOrConfidenceScoreReviewEnabled = isBoundindBoxEnabled || isConfidenceScoreEnabled; + const isBoundingBoxOrConfidenceScoreReviewEnabled = isBoundingBoxEnabled || isConfidenceScoreEnabled; ... - const boundindBoxParams = isBoundindBoxEnabled ? { include_reference: true } : {}; + const boundingBoxParams = isBoundingBoxEnabled ? { include_reference: true } : {}; ... - ...boundindBoxParams, + ...boundingBoxParams,Also applies to: 244-244
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts` at line 74, The parameter and variable names contain misspelled words where "Bounding" is written as "Boundind". Rename the parameter `isBoundindBoxEnabled` to `isBoundingBoxEnabled` at the function signature level, and also rename `boundindBoxParams` to `boundingBoxParams` throughout the file (including at line 244 and any other occurrences). Update all references and usages of these renamed identifiers to maintain consistency across the codebase.src/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsx (1)
661-683: ⚡ Quick winAdd a confidence-only regression assertion for
include_reference.This suite now covers bbox-only mode well, but it should also assert that confidence-only mode does not send
include_reference, so decoupling stays enforced.Suggested test addition
+ test('should NOT include include_reference when only isConfidenceScoreEnabled is true', async () => { + mockAPI.extractStructured.mockResolvedValue({ + answer: { field1: 'value1' }, + created_at: '2026-03-27T08:10:14.106-07:00', + completion_reason: 'done', + }); + + const { result } = setupHook('123', true, false); + await result.current.extractSuggestions('templateKey', 'global'); + + expect(mockAPI.extractStructured).toHaveBeenCalledWith( + expect.not.objectContaining({ + include_reference: expect.anything(), + }), + ); + expect(mockAPI.extractStructured).toHaveBeenCalledWith( + expect.objectContaining({ + include_confidence_score: true, + }), + ); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsx` around lines 661 - 683, The current test only verifies that include_reference is sent when isBoundingBoxEnabled is true, but there is no regression test to ensure that include_reference is NOT sent when only isConfidenceScoreEnabled is true. Add a new test case following the same pattern as the existing test, but configure setupHook to enable confidence score while disabling bounding box, then assert that the extractStructured API call does not contain the include_reference parameter to ensure these feature flags remain decoupled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 141: The `@box/metadata-editor` package version has been updated to ^1.73.4
in devDependencies but the version in peerDependencies remains at the older
^1.69.6, creating a version mismatch. Update the `@box/metadata-editor` entry in
the peerDependencies section to match the devDependencies version of ^1.73.4 to
ensure consistency and prevent version conflicts for package consumers.
In `@src/api/Metadata.js`:
- Around line 467-471: The getInstances function parameter
isBoundingBoxOrConfidenceScoreReviewEnabled combines two independent feature
controls into a single boolean. Replace this merged parameter with two separate
boolean parameters: one for controlling bounding box serialization and one for
controlling confidence score review. Then update the serialization logic in the
lines around 1258-1287 (and the other referenced locations at lines 640-653) to
independently check these two separate flags instead of checking the single
merged flag, ensuring that confidence details and bounding box details can be
controlled and persisted independently.
In `@src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts`:
- Around line 240-252: The boundindBoxParams object is conditioned on
isBoundingBoxOrConfidenceScoreReviewEnabled, which keeps the bounding box
feature coupled to the confidence score feature. Replace the condition
isBoundingBoxOrConfidenceScoreReviewEnabled with isBoundingBoxEnabled so that
bounding box references are fetched based solely on the bounding box flag,
allowing the two features to be independently controlled.
---
Nitpick comments:
In `@src/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsx`:
- Around line 661-683: The current test only verifies that include_reference is
sent when isBoundingBoxEnabled is true, but there is no regression test to
ensure that include_reference is NOT sent when only isConfidenceScoreEnabled is
true. Add a new test case following the same pattern as the existing test, but
configure setupHook to enable confidence score while disabling bounding box,
then assert that the extractStructured API call does not contain the
include_reference parameter to ensure these feature flags remain decoupled.
In `@src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts`:
- Line 74: The parameter and variable names contain misspelled words where
"Bounding" is written as "Boundind". Rename the parameter `isBoundindBoxEnabled`
to `isBoundingBoxEnabled` at the function signature level, and also rename
`boundindBoxParams` to `boundingBoxParams` throughout the file (including at
line 244 and any other occurrences). Update all references and usages of these
renamed identifiers to maintain consistency across the codebase.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 61358c6a-98f4-43e4-a448-511e4cc3d091
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (17)
package.jsonscripts/i18n.config.jsscripts/jest/jest.config.jssrc/api/Metadata.jssrc/api/__tests__/Metadata.test.jssrc/api/__tests__/utils.test.jssrc/api/utils.jssrc/common/types/metadata.jssrc/constants.jssrc/elements/content-sidebar/MetadataInstanceEditor.tsxsrc/elements/content-sidebar/MetadataSidebarRedesign.tsxsrc/elements/content-sidebar/__tests__/MetadataInstanceEditor.test.tsxsrc/elements/content-sidebar/__tests__/MetadataSidebarRedesign.test.tsxsrc/elements/content-sidebar/__tests__/useMetadataSidebarUnsavedChangesGuard.test.tssrc/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsxsrc/elements/content-sidebar/hooks/useMetadataSidebarUnsavedChangesGuard.tssrc/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts
tjuanitas
left a comment
There was a problem hiding this comment.
approving for package.json and yarn.lock
Merge Queue Status
This pull request spent 12 minutes 31 seconds in the queue, including 12 minutes 13 seconds running CI. Required conditions to merge
|
This PR decouples Bounding Box support from Confidence Score review in the Human-in-the-loop Metadata Extraction flow.
Previously, the entire feature was controlled by a single flag: isConfidenceScoreReviewEnabled. Due to updated business requirements, the work is now split into two independently controlled milestones:
Rendering and saving bounding boxes for extracted metadata values
isBoundingBoxeEnabledReviewing extracted metadata fields with LOW confidence
isConfidenceScoreReviewEnabledSummary by CodeRabbit
$detailsenrichment.$detailspayload rules, and bounding-box-enabled fetch/create flows.