Skip to content

fix(platform): keep hidden picks when clearing the Microsoft header box - #5082

Closed
tale-code-bot wants to merge 2 commits into
mainfrom
fix/microsoft-picker-search-deselect
Closed

tale-code-bot wants to merge 2 commits into
mainfrom
fix/microsoft-picker-search-deselect

Conversation

@tale-code-bot

Copy link
Copy Markdown
Collaborator

Summary

On the Microsoft 365 import dialog (the OneDrive and SharePoint tabs), checking the file table's header box (Select all) added only the rows the search shows, but clearing it emptied the whole selection. A file selected before the search was dropped unseen, and Import (n) fell to 0.

The Google Drive picker already removed only the rows on screen. Its two header-box handlers now live in onedrive-import/visible-selection.ts, next to the table and types both pickers already share, and both dialogs use them. Clearing the box now removes only the rows on screen on every tab, the same as a row's own checkbox.

  • Root cause: onedrive-import-dialog.tsx's deselectAll() ran setSelectedItems(new Map()), while selectAllVisible() and the header state counted only filteredItems (the active tab's rows, narrowed by the search).
  • Unchanged on purpose: the full resets on a folder, breadcrumb, tab, site or library change, on disconnect and after an import, and the row handlers.
  • A click on a mixed header box: Radix (@radix-ui/react-checkbox 1.3.3) reports it as true, so it selects the rest of the rows on screen. That was already Google's rule.
  • Commits: refactor(platform): share the cloud pickers' header-box selection (no behaviour change; a Google component test now locks the behaviour), then fix(platform): keep hidden picks when clearing the Microsoft header box.
  • Task: TALE-42.

Closes #3921

Checklist

  • bun run check: not run in full locally. The sandbox host refused a heavy-phase lease for the whole-platform typecheck, type-aware lint and knip because it was under load (2026-10-29, around 12:00 and 17:00 UTC). CI's fast tier runs them. What ran locally at 77752709b3612ad396b127afab1b666d9773df03, on a clean tree:
    • the 8 cloud picker UI test files: 164 tests passed
    • oxfmt --check on the changed files
    • oxlint (not type-aware) on the 6 changed source and test files: 0 warnings, 0 errors
    • tsc --noEmit --strict on the new module and its unit test alone
    • bun run lint:manual, commitlint on both commits and on this title, and the conflict-marker check on the changed files
  • bun run lint:sast: not run locally. Opengrep is not cached on the worker, and the commit hook skipped it. CI's SAST job runs it.
  • Translations: N/A. No message key was added, renamed or removed.
  • Docs: N/A. docs/{en,de,fr}/platform/knowledge/documents.md ("Import from Microsoft 365 or Google Drive") says to select files or folders. It does not describe the header box or the search, and the fix makes the Microsoft box behave as the Google Drive box already did.
  • README.md / README.de.md / README.fr.md: N/A. No setup, environment variable or command changed.

Test plan

  • Regression, both Microsoft tabs: onedrive-import-dialog.test.tsx › keeps a {onedrive,sharepoint} file selected before a search when the header box is cleared.

    • Steps: check Alpha.txt, search "Bravo", check and then clear the header box, clear the search.
    • Expected: Alpha stays checked, Bravo is unchecked, Import stays enabled, and the import sends Alpha alone.
    • Both cases fail before the fix, at expect(fileBox('Alpha.txt')).toBeChecked().
  • Google Drive: the same flow in google-drive-import-dialog.test.tsx. The behaviour is unchanged and is now locked.

  • Unit: onedrive-import/visible-selection.test.ts, 7 cases:

    • header state (clear, checked, or mixed for the rows on screen)
    • checking adds the rows on screen and keeps a selection made off screen
    • clearing removes the rows on screen alone
    • the given selection is not mutated
  • Command: cd services/platform && bunx vitest --run --config vitest.ui.config.ts on these files: google-drive-import-dialog, onedrive-import-dialog, onedrive-import/visible-selection, onedrive-import/onedrive-file-table, cloud-import-dialogs.{import-outcome,lapsed-session,listing-failure} and cloud-import-connect-dialog.app-status. Result: 8 files, 164 tests passed.

  • Manual check:

    1. Open Documents → Upload documents → From Microsoft 365.
    2. Check a file.
    3. Search for another file, then check and clear the header box.
    4. Clear the search.

    The first file stays checked, and Import (1) stays enabled.

  • Not tested:

    • a real OneDrive or SharePoint tenant
    • the browser suite: cloud-picker-accent.browser.test.tsx covers the picker's accent colours, not selection, and no Chromium is cached on the worker
    • the full UI suite

    The merge queue runs UI and Browser.

Move the Google Drive picker's header-box handlers into
onedrive-import/visible-selection.ts, beside the table and types the
pickers already share, so the Microsoft 365 picker can follow the same
rule, under which the box speaks for the rows on screen alone.

Google's behaviour is unchanged; a component test now holds it (a file
selected before a search survives clearing the box and is imported).
On the OneDrive and SharePoint tabs, checking the file table's header
box added only the rows the search shows, but clearing it emptied the
whole selection. A file selected before the search was dropped unseen
and Import fell to 0.

Both tabs now use the pickers' shared rule, so clearing the box removes
the rows on screen alone, as a row's own box and the Google Drive
picker always did. A component test on each tab locks it.

@tale-review-bot tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approve at 77752709b3612ad396b127afab1b666d9773df03 (task TALE-42, Closes #3921).

  • Scope matches the triage's "done means" and the plan.
    • fb5ffbd6 (refactor(platform)) moves Google Drive's header-box rule into onedrive-import/visible-selection.ts, unchanged: visibleSelectionState and toggleVisibleSelection.
    • 77752709 (fix(platform)) makes both Microsoft tabs use that rule. The old deselectAll (setSelectedItems(new Map())) is gone, so clearing the header removes only the rows on screen.
    • The deliberate full resets and the row handlers are untouched.
  • Correctness.
    • The shared functions are line for line the Google logic they replace.
    • The one behavioural difference for Microsoft, a mixed ('indeterminate') value now clearing instead of selecting, is unreachable by a click. Radix's checkbox turns a click on a mixed box into true, as the plan checked in @radix-ui/react-checkbox 1.3.3.
    • OneDrivePickerStage and OneDriveFileTable only pass the two handlers through, with unchanged signatures.
  • Tests.
    • There is a regression test per tab (OneDrive and SharePoint): check Alpha, search Bravo, check then clear the header, clear the search. Alpha stays checked, and the import sends Alpha alone.
    • The SHA-anchored regression-proof.log shows both cases failing at :484 (Alpha.txt not checked) with the dialog from fb5ffbd6, and passing on the clean head.
    • A Google flow test holds the refactor, and the module has unit tests.
  • Contract.
    • Branch fix/microsoft-picker-search-deselect, off main 9be5cadac.
    • Commit headers are 71 and 65 characters, and the PR title is 71 (commitlint-shaped, squash).
    • One row is added to tests/manual/reference/automation.md.
    • No strings, locales, docs, API or backend change is owed.
  • Security: no secret, permission, dependency or workflow change.
  • Required checks at this head: all seven CI ready (...) contexts passed. The runs are Commitlint 40917635790, SAST 40917636046, Security 40917636023, CLI 40917636061, E2E 40917635988, Build 40917636171 and Checks 40917636173.
  • Not run by me: the UI test files. They are queue-only in CI; the Coder ran the 8 cloud-picker files locally (164 passed), and the merge queue's UI check runs them again.

@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 29, 2026
@yannickmonney yannickmonney reopened this Oct 29, 2026
@tale-review-bot
tale-review-bot enabled auto-merge (squash) October 29, 2026 20:19
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Reviewer: not landing yet. The approved head 77752709b3612ad396b127afab1b666d9773df03 has no CI round under the current workflows.

  • The newest Checks run on this head, 40947216350 (created 20:14 UTC), checked out Merge 77752709b3612ad396b127afab1b666d9773df03 into 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2 (merge commit 6ad67c6). That is main from before 0da08205 ("ci: land each pull request on its own, without the merge queue"), so the run uses the old workflows.
  • In that run, UI (both jobs), Browser, Performance and Backend integration were skipped. The current .github/CI.md has a pull request run every suite its paths owe. That run has since finished with CI ready (Checks) green, but without those suites, so it is no evidence for them.
  • What lands it: a fresh round on the same head under the current workflows. Closing and reopening the pull request rebuilds its test merge on the current main; draft→ready does not. My approval of 77752709b3612ad396b127afab1b666d9773df03 stands while the head is unchanged. Once every CI ready (...) of that round has finished green, it lands with gh pr merge --squash --auto --match-head-commit 77752709b3612ad396b127afab1b666d9773df03 after a hold read.

@yannickmonney

yannickmonney commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Reopened so the checks run again. The 20:13–20:15 UTC reopen started its runs from a test merge into 9be5cada (before 0da08205), because GitHub had not refreshed it yet. This reopen's runs start from the test merge ad58e01b5c, into 0da08205. The head is unchanged (no new commit).

@yannickmonney

Copy link
Copy Markdown
Contributor

Landed on train as f900b2d: squashed at the approved head after the fast gate (formatting, typecheck, build). It reaches main with the merge train's pull request, so this pull request closes without merging.

yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Reviewed and approved in pull request #5082 at 7775270.

Closes #3921
Task: TALE-42
@yannickmonney
yannickmonney deleted the fix/microsoft-picker-search-deselect branch October 30, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Microsoft file search deselection clears hidden selections

3 participants