feat(ai): add AIReconciliationPanel human-in-the-loop component#244
Merged
Conversation
A reusable panel + modal for letting users review, edit, and approve AI-proposed field changes (e.g. profile updates extracted by DocumentScanner). Includes confidence-based defaults, inline editors, bulk actions, keyboard shortcut, and full a11y. DocumentScanner now recommends pairing with it in its JSDoc.
Deploying ui with
|
| Latest commit: |
29a3d8f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://14eba0b0.ui-6d0.pages.dev |
| Branch Preview URL: | https://feat-ai-reconciliation-panel.ui-6d0.pages.dev |
There was a problem hiding this comment.
Pull request overview
Introduces a new AIReconciliationPanel component under src/components/AI/ to provide a reusable “human-in-the-loop” UI for reviewing, editing, and accepting/rejecting AI-proposed field changes, plus exports and supporting Storybook/tests. Also adds a DocumentScanner doc tip recommending the new panel for confirming extracted structured fields.
Changes:
- Added
AIReconciliationPanelimplementation with proposal diff filtering, confidence defaults, grouping, bulk select, inline editing, and modal/panel variants. - Added Storybook stories and Vitest tests for the new component.
- Re-exported the new component/types from
src/components/AI/index.tsand referenced it inDocumentScannerdocs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/DocumentScanner/index.ts | Adds docs guidance to pair DocumentScanner with AIReconciliationPanel for confirmation workflows. |
| src/components/AI/Reconciliation.tsx | Implements the new AI reconciliation panel (panel + modal variants). |
| src/components/AI/Reconciliation.test.tsx | Adds unit coverage for filtering/default selection/bulk actions/editing/modal behavior. |
| src/components/AI/Reconciliation.stories.tsx | Adds Storybook stories demonstrating key variants and behaviors. |
| src/components/AI/index.ts | Re-exports the new component utilities/types from the AI module barrel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use sorted-key stable stringify in defaultReconciliationIsEqual so JSON-equivalent objects with differing key order compare equal. - Reset internal row state on any meaningful proposal change (proposed value, defaultAccepted, required, confidence), not just on id-set changes. - Defensively default missing row state during render and in row mutators so the component does not crash when proposals add new ids before the reset effect runs. - Add Cmd/Ctrl+Enter keyboard shortcut to submit (Apply) so the keyboard story matches the docs. - Add Reconciliation-specific utility strings to miewebUISafelist so Tailwind 3 consumers using the preset get the right styles.
1786f27 to
b6eb51a
Compare
- Make stableStringify cycle-safe and wrap stateSignature in safeStableStringify so non-serializable proposal values cannot crash render. - Replace AIReconciliationPanelProps with a discriminated union: panel variant forbids open/onOpenChange, modal variant requires them at the type level. - Add role=status alongside aria-live=polite on the bulk-selection counter so the dynamic count is an actual live region (the container remains role=group). - Pass onNothingToReconcile to the NothingToReconcile story so docs and behavior match. - Add ring-1, last:border-b-0, border-dashed, text-[11px] to miewebUISafelist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
AIReconciliationPanelcomponent undersrc/components/AI/— a generic "human-in-the-loop" review surface for AI-proposed field changes (e.g. profile updates extracted byDocumentScanner).Features
current → proposeddiffs and lets the user accept / reject / edit each one individually.confidence(0–1) or explicitconfidenceLevel(high/medium/low) are both supported.renderEditorper proposal to allow the user to tweak the AI's value before applying.panel(inline card) andmodal(wraps in<Modal>from this lib).nullvs'', Date epoch, JSON-equivalent objects) so callers can pass every candidate field without pre-filtering.role="alert",aria-live, labeled checkboxes, keyboard shortcut to submit.onApplyreturns the accepted set with{ id, value }so callers persist exactly what the human approved.Use cases
Files
src/components/AI/Reconciliation.tsx— implementationsrc/components/AI/Reconciliation.stories.tsx— Storybook storiessrc/components/AI/Reconciliation.test.tsx— unit testssrc/components/AI/index.ts— re-exportConsumer
Wired up in
bluehive-dot/imports/ui/DocumentUploadScanner.tsxto review AI-extracted CDL / DOT-medical fields. The consumer relies on the panel allowing every row to be unchecked (human-in-the-loop override).