Skip to content

feat(metadata): add confidence score support to metadata read flow#4481

Merged
mergify[bot] merged 2 commits intobox:masterfrom
Lindar90:metadata-confidence-score-read-flow
Mar 26, 2026
Merged

feat(metadata): add confidence score support to metadata read flow#4481
mergify[bot] merged 2 commits intobox:masterfrom
Lindar90:metadata-confidence-score-read-flow

Conversation

@Lindar90
Copy link
Copy Markdown
Contributor

@Lindar90 Lindar90 commented Mar 23, 2026

When metadata.confidenceScore.enabled FF is enabled, the metadata sidebar now fetches instances using ?view=detailed, which returns per-field confidence score data including score value, confidence level, AI acceptance
status, and target location. Fields that were not AI-extracted gracefully return no confidence data.

hitl-buie-read-flow

Summary by CodeRabbit

  • New Features

    • Confidence scores and parsed target locations surfaced on metadata fields (feature-flagged) and a review-filter toggle to show only review fields.
  • Improvements

    • Metadata fetch flow forwards confidence-score flag; fetch error handling now clears instances to an empty list for consistency.
    • Template/custom field values are normalized from detailed field payloads.
  • Tests

    • Added coverage for confidence extraction, detailed-field parsing, target-location parsing, and fetch behavior.
  • Chores

    • Bumped metadata editor dependency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee11437a-43ff-4845-a535-4c99f141918f

📥 Commits

Reviewing files that changed from the base of the PR and between 7795e29 and 1799ccf.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (1)
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • package.json

Walkthrough

Threads a new isConfidenceScoreEnabled flag through metadata fetch and instance-creation flows, adds utilities to detect/unwrap "detailed" field values and extract confidence/target-location data, extends metadata Flow types, forwards a review-filter toggle through redesigned sidebar components, and updates tests and a package dependency.

Changes

Cohort / File(s) Summary
Dependency
package.json
Bumped @box/metadata-editor range in devDependencies and peerDependencies.
Core Metadata API
src/api/Metadata.js
Added isConfidenceScoreEnabled param to getMetadata, getInstances, getTemplateInstances, and createTemplateInstance; choose view=detailed when redesign+confidence enabled; extract detailed values and attach confidenceScore and targetLocation to template fields via utils.
API Utilities
src/api/utils.js
Added and exported isDetailedFieldValue, extractDetailedFieldValue, mapDetailedFieldToConfidenceScore, and parseTargetLocation; updated exports accordingly.
Types
src/common/types/metadata.js
Added Flow types: MetadataConfidenceScoreData, MetadataBoundingBox, MetadataTargetLocationEntry, MetadataDetailedFieldDetails, MetadataDetailedFieldValue; extended MetadataTemplateInstanceField with optional confidenceScore and targetLocation.
Sidebar & Editor Components
src/elements/content-sidebar/MetadataSidebarRedesign.tsx, src/elements/content-sidebar/MetadataInstanceEditor.tsx
Pass isConfidenceScoreReviewEnabled into useSidebarMetadataFetcher; add shouldShowOnlyReviewFields state and onToggleReviewFilter prop wiring; onEdit can enable review-filter when opening editor.
Sidebar Hook
src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts
Hook signature accepts new isConfidenceScoreEnabled arg (default false) and forwards it into api.getMetadata(..., isConfidenceScoreEnabled); on fetch error set templateInstances to [].
Tests — Core & Utils
src/api/__tests__/Metadata.test.js, src/api/__tests__/utils.test.js
Added tests for detailed-value detection, extraction, confidence mapping (including isAccepted logic), target-location parsing, and for correct flag/query propagation to API (view=detailed when appropriate).
Tests — Sidebar Components & Hook
src/elements/content-sidebar/__tests__/*
Added tests asserting useSidebarMetadataFetcher receives confidence flag, getMetadata call shape includes the flag, editor renders with optional props, and edit flow toggles review filter state.

Sequence Diagram

sequenceDiagram
    participant UI as UI Component
    participant SidebarHook as useSidebarMetadataFetcher
    participant API as Metadata API
    participant Utils as Field Utilities
    participant Instance as Template Instance Builder

    UI->>SidebarHook: request metadata (fileId, isMetadataRedesign, isConfidenceScoreEnabled=true)
    SidebarHook->>API: getMetadata(fileId, isMetadataRedesign, isConfidenceScoreEnabled)
    API->>API: choose view param ("detailed" when redesign + enabled)
    API->>Instance: createTemplateInstance(rawInstance, template, canEdit, isConfidenceScoreEnabled)
    Instance->>Utils: isDetailedFieldValue(rawField)
    Utils-->>Instance: boolean
    alt detailed field
        Instance->>Utils: extractDetailedFieldValue(rawField)
        Utils-->>Instance: unwrappedValue
        Instance->>Utils: mapDetailedFieldToConfidenceScore(rawField)
        Utils-->>Instance: confidenceScore or undefined
        Instance->>Utils: parseTargetLocation(rawField)
        Utils-->>Instance: targetLocation or undefined
    end
    Instance-->>API: enriched template instance
    API-->>SidebarHook: template instances (with optional confidence/locations)
    SidebarHook-->>UI: render instances (UI may toggle review filter)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • tjuanitas
  • jpan-box
  • dealwith

Poem

🐰 I hop through detailed fields with care,
I pluck out scores and map each target there,
A toggle flips to show the review-only view,
Confidence tucked in fields, parsed fresh and true,
Little rabbit cheers — metadata spring anew!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature addition: adding confidence score support to the metadata read flow, which aligns with all file changes throughout the PR.
Description check ✅ Passed The PR description provides context about the confidence score feature and includes a visual example, but lacks technical details about implementation, testing, or breaking changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 23, 2026

CLA assistant check
All committers have signed the CLA.

@Lindar90 Lindar90 requested a review from dlasecki-box March 23, 2026 17:03
@Lindar90 Lindar90 marked this pull request as ready for review March 23, 2026 17:09
@Lindar90 Lindar90 requested review from a team as code owners March 23, 2026 17:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/api/Metadata.js (1)

669-730: ⚠️ Potential issue | 🟠 Major

Key the metadata cache by the requested view.

The new flag changes the payload shape, but getMetadata() still reuses the same metadata_${id} entry. On the same Metadata instance, a first call with isConfidenceScoreEnabled=false will cache hydrated data; a later call with it enabled returns that stale entry and never reaches view=detailed, so the confidence metadata never shows up until callers force-refresh.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/Metadata.js` around lines 669 - 730, getMetadata is caching results
under a single key from getMetadataCacheKey(id) but the payload shape varies
with the requested view flags (isConfidenceScoreEnabled and/or
isMetadataRedesign), causing stale responses; fix by making the cache key
incorporate the requested view flags (e.g., extend getMetadataCacheKey to accept
isConfidenceScoreEnabled and isMetadataRedesign or build a composite key in
getMetadata like `metadata_${id}_detailed_${isConfidenceScoreEnabled}`) and use
that key for cache.has/get/unset/successHandler so calls with different views
store and retrieve separate entries (update all references in getMetadata to use
the new key API).
🧹 Nitpick comments (3)
src/elements/content-sidebar/MetadataSidebarRedesign.tsx (1)

328-330: Consider memoizing the toggle callback.

The inline arrow function () => setShouldShowOnlyReviewFields(!shouldShowOnlyReviewFields) creates a new function reference on each render. While the impact is limited since MetadataInstanceEditor only renders when editingTemplate is truthy, consider using useCallback for consistency with other handlers in this component.

♻️ Optional: Memoize the toggle callback
+    const handleToggleReviewFilter = useCallback(() => {
+        setShouldShowOnlyReviewFields(prev => !prev);
+    }, []);
+
     // ... in the JSX:
-    onToggleReviewFilter={() => setShouldShowOnlyReviewFields(!shouldShowOnlyReviewFields)}
+    onToggleReviewFilter={handleToggleReviewFilter}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/elements/content-sidebar/MetadataSidebarRedesign.tsx` around lines 328 -
330, The inline toggle passed to MetadataInstanceEditor creates a new function
each render; replace it with a memoized callback using React.useCallback that
captures setShouldShowOnlyReviewFields and shouldShowOnlyReviewFields (or use
functional update to avoid reading stale state). Specifically, define a const
onToggleReviewFilter = useCallback(() => setShouldShowOnlyReviewFields(v => !v),
[setShouldShowOnlyReviewFields]) and pass that to the onToggleReviewFilter prop
where MetadataInstanceEditor is rendered to match the style of other handlers in
this component.
src/common/types/metadata.js (1)

166-179: Make the new details shape sparse as well.

src/api/utils.js already handles partial details, and the new metadata tests exercise payloads that only carry confidence / location data. Keeping updatedAt, updatedBy, and updatedAppId required makes this type stricter than the runtime contract and will push future consumers toward unsafe casts.

♻️ Suggested tweak
 type MetadataDetailedFieldDetails = {
-    updatedAt: number,
-    updatedBy: string,
-    updatedAppId: string,
+    updatedAt?: number,
+    updatedBy?: string,
+    updatedAppId?: string,
     confidenceScore?: number,
     confidenceLevel?: string,
     process?: string,
     targetLocation?: string,
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/common/types/metadata.js` around lines 166 - 179, The type
MetadataDetailedFieldDetails is too strict—make its core fields optional so the
shape is sparse like runtime usage; change updatedAt, updatedBy, and
updatedAppId to optional properties on MetadataDetailedFieldDetails so partial
detail objects (e.g., only confidenceScore or targetLocation) are valid; keep
MetadataDetailedFieldValue.details as the optional container it already is and
update the type definition for MetadataDetailedFieldDetails accordingly.
src/api/Metadata.js (1)

545-550: The new flag pushes these APIs past the “too many booleans” point.

createTemplateInstance(), getTemplateInstances(), and getMetadata() now all rely on multiple positional booleans. The tests already have to assert raw argument indexes, which is a good sign these should move to an options bag before another flag lands.

Also applies to: 620-627, 669-680

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/Metadata.js` around lines 545 - 550, The APIs createTemplateInstance,
getTemplateInstances, and getMetadata use multiple positional boolean
flags—replace those boolean parameters with a single options object (options
bag) to improve readability and future extensibility: update the signatures
(e.g., createTemplateInstance(instance, template, options = {})) to accept named
properties like { canEdit, isExternallyOwned, isConfidenceScoreEnabled } (and
analogous properties for getTemplateInstances and getMetadata), update all
callsites/tests to pass an object instead of positional booleans, and adjust any
internal usage to read from options.<END_OF_INSTRUCTION>
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/api/Metadata.js`:
- Around line 669-730: getMetadata is caching results under a single key from
getMetadataCacheKey(id) but the payload shape varies with the requested view
flags (isConfidenceScoreEnabled and/or isMetadataRedesign), causing stale
responses; fix by making the cache key incorporate the requested view flags
(e.g., extend getMetadataCacheKey to accept isConfidenceScoreEnabled and
isMetadataRedesign or build a composite key in getMetadata like
`metadata_${id}_detailed_${isConfidenceScoreEnabled}`) and use that key for
cache.has/get/unset/successHandler so calls with different views store and
retrieve separate entries (update all references in getMetadata to use the new
key API).

---

Nitpick comments:
In `@src/api/Metadata.js`:
- Around line 545-550: The APIs createTemplateInstance, getTemplateInstances,
and getMetadata use multiple positional boolean flags—replace those boolean
parameters with a single options object (options bag) to improve readability and
future extensibility: update the signatures (e.g.,
createTemplateInstance(instance, template, options = {})) to accept named
properties like { canEdit, isExternallyOwned, isConfidenceScoreEnabled } (and
analogous properties for getTemplateInstances and getMetadata), update all
callsites/tests to pass an object instead of positional booleans, and adjust any
internal usage to read from options.<END_OF_INSTRUCTION>

In `@src/common/types/metadata.js`:
- Around line 166-179: The type MetadataDetailedFieldDetails is too strict—make
its core fields optional so the shape is sparse like runtime usage; change
updatedAt, updatedBy, and updatedAppId to optional properties on
MetadataDetailedFieldDetails so partial detail objects (e.g., only
confidenceScore or targetLocation) are valid; keep
MetadataDetailedFieldValue.details as the optional container it already is and
update the type definition for MetadataDetailedFieldDetails accordingly.

In `@src/elements/content-sidebar/MetadataSidebarRedesign.tsx`:
- Around line 328-330: The inline toggle passed to MetadataInstanceEditor
creates a new function each render; replace it with a memoized callback using
React.useCallback that captures setShouldShowOnlyReviewFields and
shouldShowOnlyReviewFields (or use functional update to avoid reading stale
state). Specifically, define a const onToggleReviewFilter = useCallback(() =>
setShouldShowOnlyReviewFields(v => !v), [setShouldShowOnlyReviewFields]) and
pass that to the onToggleReviewFilter prop where MetadataInstanceEditor is
rendered to match the style of other handlers in this component.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c355dc3-ddc6-4abe-b5ac-0741b73a0345

📥 Commits

Reviewing files that changed from the base of the PR and between b31b020 and 1fac134.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • package.json
  • src/api/Metadata.js
  • src/api/__tests__/Metadata.test.js
  • src/api/__tests__/utils.test.js
  • src/api/utils.js
  • src/common/types/metadata.js
  • src/elements/content-sidebar/MetadataInstanceEditor.tsx
  • src/elements/content-sidebar/MetadataSidebarRedesign.tsx
  • src/elements/content-sidebar/__tests__/MetadataInstanceEditor.test.tsx
  • src/elements/content-sidebar/__tests__/MetadataSidebarRedesign.test.tsx
  • src/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsx
  • src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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)
src/api/__tests__/utils.test.js (1)

176-219: Add a non-array JSON test for parseTargetLocation.

To lock in parser contract safety, add a case where targetLocation is valid JSON but not an array (expect undefined).

✅ Test addition
     test('should return undefined when targetLocation is invalid JSON', () => {
         const fieldValue = {
             values: 'California',
             details: { targetLocation: 'not valid json {{{' },
         };
         expect(parseTargetLocation(fieldValue)).toBeUndefined();
     });

+    test('should return undefined when targetLocation is valid JSON but not an array', () => {
+        const fieldValue = {
+            values: 'California',
+            details: { targetLocation: '{"itemId":"123"}' },
+        };
+        expect(parseTargetLocation(fieldValue)).toBeUndefined();
+    });
+
     test('should return undefined for null fieldValue', () => {
         expect(parseTargetLocation(null)).toBeUndefined();
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/__tests__/utils.test.js` around lines 176 - 219, Add a new unit test
in the parseTargetLocation() describe block that passes a detailed fieldValue
whose details.targetLocation is valid JSON but not an array (e.g. a JSON object
string like '{"itemId":"123"}') and assert parseTargetLocation(fieldValue)
returns undefined; update the test suite in the same file near the other
parseTargetLocation tests and name it something like "should return undefined
when targetLocation JSON is not an array" so it clearly covers the non-array
JSON case for the parseTargetLocation function.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/api/utils.js`:
- Around line 76-88: The parseTargetLocation function currently returns whatever
JSON.parse(details.targetLocation) yields, which may be a non-array and violate
the declared return type; update parseTargetLocation to validate the parsed
value: after JSON.parse(details.targetLocation) ensure the result is an array
and (optionally) each entry matches the MetadataTargetLocationEntry shape (e.g.,
check required fields or types), and if validation fails return undefined; keep
the existing try/catch but add the array/shape guard before returning the parsed
value so callers only receive a proper Array<MetadataTargetLocationEntry> or
undefined.

---

Nitpick comments:
In `@src/api/__tests__/utils.test.js`:
- Around line 176-219: Add a new unit test in the parseTargetLocation() describe
block that passes a detailed fieldValue whose details.targetLocation is valid
JSON but not an array (e.g. a JSON object string like '{"itemId":"123"}') and
assert parseTargetLocation(fieldValue) returns undefined; update the test suite
in the same file near the other parseTargetLocation tests and name it something
like "should return undefined when targetLocation JSON is not an array" so it
clearly covers the non-array JSON case for the parseTargetLocation function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 24c398a4-4551-4998-b48e-888b631f822d

📥 Commits

Reviewing files that changed from the base of the PR and between 1fac134 and 82957ab.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • src/api/__tests__/Metadata.test.js
  • src/api/__tests__/utils.test.js
  • src/api/utils.js
  • src/common/types/metadata.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/api/tests/Metadata.test.js

dlasecki-box
dlasecki-box previously approved these changes Mar 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/api/utils.js (1)

76-95: Consider validating array entry shapes for defensive parsing.

The Array.isArray guard is good (addressing the previous review). However, individual entries are not validated against MetadataTargetLocationEntry (required fields: itemId, page, text). Malformed API responses could cause runtime errors downstream.

This is a minor concern since the API is presumably trusted, but for robustness you could add a shape check:

🛡️ Optional: Add entry shape validation
 try {
     const parsed = JSON.parse(details.targetLocation);
     if (!Array.isArray(parsed)) {
         return undefined;
     }
-    return parsed;
+    // Validate each entry has required fields
+    const isValidEntry = (entry: any): boolean =>
+        entry != null &&
+        typeof entry === 'object' &&
+        typeof entry.itemId === 'string' &&
+        typeof entry.page === 'number' &&
+        typeof entry.text === 'string';
+    return parsed.every(isValidEntry) ? parsed : undefined;
 } catch {
     return undefined;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/utils.js` around lines 76 - 95, The parseTargetLocation function
currently parses details.targetLocation into an array but doesn't validate each
entry shape; update parseTargetLocation to iterate the parsed array and verify
each element is an object containing the required MetadataTargetLocationEntry
fields (itemId, page, text) with appropriate types (e.g., string/number as
expected), and return undefined if any entry fails validation before returning
the array; reference parseTargetLocation and the parsed variable to add this
defensive shape check so downstream code cannot assume well-formed entries.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/api/utils.js`:
- Around line 76-95: The parseTargetLocation function currently parses
details.targetLocation into an array but doesn't validate each entry shape;
update parseTargetLocation to iterate the parsed array and verify each element
is an object containing the required MetadataTargetLocationEntry fields (itemId,
page, text) with appropriate types (e.g., string/number as expected), and return
undefined if any entry fails validation before returning the array; reference
parseTargetLocation and the parsed variable to add this defensive shape check so
downstream code cannot assume well-formed entries.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe61c523-1d03-4641-9bd3-7e59d58dd1ea

📥 Commits

Reviewing files that changed from the base of the PR and between 82957ab and adda336.

📒 Files selected for processing (3)
  • src/api/__tests__/utils.test.js
  • src/api/utils.js
  • src/common/types/metadata.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/api/tests/utils.test.js

tjuanitas
tjuanitas previously approved these changes Mar 24, 2026
Copy link
Copy Markdown
Contributor

@reneshen0328 reneshen0328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I have a few observations for future consideration (not blocking for this PR). Feel free to comment in the thread if my understanding is incorrect:

Observations on Architecture

  • Feature flag proliferation: MetadataSidebarRedesign now has 7 feature flags, and Metadata.js is accumulating UI-specific parameters (isMetadataRedesign, isConfidenceScoreEnabled). The separation between "what the API layer does" vs "what the UI layer decides" is becoming blurred.
  • Conditional coupling: isConfidenceScoreEnabled only has an effect when isMetadataRedesign is true (line 410 in Metadata.js), but it's passed through all code paths regardless. This creates implicit dependencies that aren't obvious from the function signatures.
  • Prop drilling: The flag travels through 5 layers to reach where it's used. If more conditions are added, this pattern will compound.

Future Suggestion
Consider separating concerns more clearly:

// API layer: just fetch the right view (no UI flags)
getInstances(id, viewType: 'basic' | 'hydrated' | 'detailed')
// Transform layer: always extract all available data
// (extractDetailedFieldValue, mapDetailedFieldToConfidenceScore, parseTargetLocation 
// are already safe for non-detailed data)
createTemplateInstance(instance, template, canEdit, isExternallyOwned)
// UI layer: decides what to display based on feature flags
<MetadataInstanceForm 
    showConfidenceScore={isConfidenceScoreEnabled} 
/>

This would:

  • Keep the API layer generic (view types, not feature flags)
  • Always enrich data when available (safe operations)
  • Let the UI layer control visibility

This is out of scope for this PR, but worth considering as the metadata feature set grows IMO.

dlasecki-box
dlasecki-box previously approved these changes Mar 25, 2026
- handle non array edge case in parseTargetLocation
- make "boundingBox?: MetadataBoundingBox" optional
@Lindar90 Lindar90 dismissed stale reviews from dlasecki-box and tjuanitas via 7795e29 March 26, 2026 14:14
@Lindar90 Lindar90 force-pushed the metadata-confidence-score-read-flow branch from adda336 to 7795e29 Compare March 26, 2026 14:14
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a 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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/elements/content-sidebar/MetadataSidebarRedesign.tsx`:
- Line 190: The boolean state shouldShowOnlyReviewFields is only reset in
handleCancel, causing it to persist into subsequent edit sessions; add
setShouldShowOnlyReviewFields(false) to every edit-exit and edit-entry path so
it never carries over. Specifically, add the reset call inside the save/submit
success and failure handlers (e.g., the functions around the diff at lines
328-330 and 343-347), and also reset it when entering edit mode (where the
editor is opened/toggled) so handleCancel, the save/submit handlers, and the
edit-entry handler all call setShouldShowOnlyReviewFields(false).
🪄 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: fbbe3c58-ed47-465f-b5ff-fd8d90169c87

📥 Commits

Reviewing files that changed from the base of the PR and between adda336 and 7795e29.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • package.json
  • src/api/Metadata.js
  • src/api/__tests__/Metadata.test.js
  • src/api/__tests__/utils.test.js
  • src/api/utils.js
  • src/common/types/metadata.js
  • src/elements/content-sidebar/MetadataInstanceEditor.tsx
  • src/elements/content-sidebar/MetadataSidebarRedesign.tsx
  • src/elements/content-sidebar/__tests__/MetadataInstanceEditor.test.tsx
  • src/elements/content-sidebar/__tests__/MetadataSidebarRedesign.test.tsx
  • src/elements/content-sidebar/__tests__/useSidebarMetadataFetcher.test.tsx
  • src/elements/content-sidebar/hooks/useSidebarMetadataFetcher.ts
✅ Files skipped from review due to trivial changes (3)
  • package.json
  • src/api/tests/utils.test.js
  • src/elements/content-sidebar/tests/MetadataSidebarRedesign.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/elements/content-sidebar/tests/useSidebarMetadataFetcher.test.tsx
  • src/elements/content-sidebar/MetadataInstanceEditor.tsx

@mergify mergify bot added the queued label Mar 26, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 26, 2026

Merge Queue Status

  • Entered queue2026-03-26 15:01 UTC · Rule: Automatic strict merge
  • Checks passed · in-place
  • Merged2026-03-26 15:13 UTC · at 1799ccfd788aa894a956674ac71d48730542d358

This pull request spent 11 minutes 33 seconds in the queue, including 11 minutes 16 seconds running CI.

Required conditions to merge

@mergify mergify bot merged commit 27bf05f into box:master Mar 26, 2026
8 of 9 checks passed
@mergify mergify bot removed the queued label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants