Repository navigation
Exchange litigation hold - #230
Open
NityamPareek wants to merge 31 commits into
Open
NityamPareek wants to merge 31 commits into
NityamPareek wants to merge 31 commits into
Conversation
The "Parallel Batches" slider is meant to control migration plan lanes only, but its value was also passed as ScanConfig.parallel_batches, which the EO estimators use as the Graph $batch sub-request count. Use a dedicated GRAPH_BATCH_REQUEST_SIZE constant (10, the previous default) for scanning; lanes still read the slider directly.
ScanConfig.parallel_batches now only denotes the number of parallel migration plan lanes (the UI slider). The number of sub-requests per Graph $batch call moves to a new ScanConfig.graph_batch_size field (default DEFAULT_GRAPH_BATCH_SIZE = 10). - EO and Files estimators read config.graph_batch_size for create_batches. - Exchange UI passes the slider value as parallel_batches again. - Files UI drops its parallel_batches = 10 override, which only existed to keep the slider out of the $batch size. - Tests that set the $batch size use graph_batch_size.
refactor: separate graph_batch_size from parallel_batches (lanes)
Add EORecoverableItemsEstimator, which counts IPM.Note emails in the Deletions, Purges, DiscoveryHolds and Versions Recoverable Items folders of primary mailboxes via the v1.0 admin mailbox API ($count per folder, mailbox addressed by UPN). Backend only; not wired to the UI yet. - Per-mailbox concurrency: mailboxes are de-duplicated, processed 10 at a time in sequential rounds of one $batch, with at most 2 requests per mailbox per $batch, so Exchange's limit of 4 concurrent requests per mailbox is never exceeded. - Every folder error counts 0 and is reported as a partial failure; a mailbox whose four folders all fail is reported as a full failure. - Folder hierarchy mode (Recursive setting) raises NotImplementedError until it is added in a follow-up PR. - New constants, ScanConfig.scan_recoverable_items, factory accessor and unit tests.
…ther mailbox scans Drop RECOVERABLE_ITEMS_MAILBOXES_PER_TASK. The caller decides how many mailboxes a call handles (the scan pipeline will use min(concurrency // 10, 20), as for primary and shared mailboxes). Within a call, each round of two folders is sent as sequential $batch calls of at most graph_batch_size requests, keeping each mailbox's requests for the round in the same $batch.
feat(exchange): Recoverable Items estimator — $count mode
When the Recursive setting is on, count each Recoverable Items folder by
traversing its folder hierarchy and summing totalItemCount, like the
primary mailbox recursive scan (all item types).
- Root: admin/exchange/mailboxes/{upn}/folders/{wellKnownName}
- Children: .../folders/{id}/childFolders (following @odata.nextLink)
Both modes now share one scheduler: every request is a work item in its
mailbox's queue, each round takes at most 2 items per mailbox, and rounds
are sent as sequential $batch calls of at most graph_batch_size requests.
The per-mailbox limit (2 normally, 4 worst case) therefore holds while
traversing too.
- Failed subfolder: its subtree is skipped and reported as a partial
failure ("Label (folderId)"); counts gathered so far are kept.
- Failed root: folder counts 0 (partial); all 4 roots failed is a full
failure. No fallbacks.
- Depth capped by max_allowed_depth (logged and reported), visited folder
ids are not counted twice, folder ids are URL-encoded, and only
nextLinks on the Graph host are followed.
… Items
Recoverable Items folders never contain subfolders, so each folder needs
a single request and no traversal:
- Recursive setting off: IPM.Note $count of the folder's items.
- Recursive setting on: the folder's totalItemCount
(admin/exchange/mailboxes/{upn}/folders/{wellKnownName}?$select=id,totalItemCount).
The estimator now follows the email / shared mailbox estimators:
create_batches with identification headers and graph_batch_size,
UrlInvoker.invoke submitted to an archive_executor (config.concurrency
workers), and get_batch_responses_map for parsing. Folders are still
requested in two sequential rounds of two, keeping at most 2 requests per
mailbox in flight. Removes the work queue, depth guard and nextLink
handling added for subfolder traversal.
Primary and shared mailbox scans never page through emails; they read
server-side counts ($count, or folder totalItemCount in recursive mode).
Recoverable Items folders have no hierarchy and must be filtered to
IPM.Note, which totalItemCount can't do, so both modes now use the same
request per folder:
admin/exchange/mailboxes/{upn}/folders/{wellKnownName}/items
?$filter=type eq 'IPM.Note'&$count=true&$top=1&$select=id
The Recursive setting no longer changes Recoverable Items requests, and
only MailboxItem.Read.All is needed.
refactor(exchange): align Recoverable Items estimator with primary mailbox estimators
Wire EORecoverableItemsEstimator into the Exchange planner. - "Recoverable Items" checkbox in the Sources row (off by default) with a footnote; requests MailboxItem.Read.All only when selected. - New phase after Encrypted Emails for user and shared mailbox rows (never group mailboxes or in-place archives). Mailboxes are de-duplicated by UPN, chunked by min(concurrency // 10, 20) and run through run_batch_scan like the other mailbox phases; counts are copied back to duplicate rows. - Rows carry the four per-folder counts in memory; stats track the total. - "Scanning Recoverable Items" progress row (Mailboxes / Recoverable Emails, with partial failures). - Logging: phase start line, run_batch_scan progress lines, stop line, per-folder summary block, failure and partial failure sections, and a per-folder line after the final totals. - README: permission and Sources description. Counts are not yet exported to the CSV report or used for ETAs.
…can, trim logs - Checkbox, progress row, footnote, README and log titles now say "Recoverable Emails". - The phase (and its progress row) runs right after the primary mailbox email scan, before Encrypted Emails. - Logging now matches the primary mailbox scan's events: the phase header, periodic progress lines, a skip line, end-of-run failure and partial failure sections, and the total after the final stats. Removed the phase start detail line, the summary block and the stop line.
feat(exchange): Recoverable Emails scan phase, progress and logging
… input - user_report CSV: when Recoverable Emails is selected, four columns follow Email Count: Recoverable Deletions / Purges / DiscoveryHolds / Versions Count. Folders that failed to scan are exported as 0. - CSV input: if all four columns are present, their values are loaded for user and shared rows and the phase is skipped, using the same rules as the other count columns (MailboxItem.Read.All is then not requested). Otherwise a delta scan runs for Recoverable Emails. - README: report columns and CSV reuse.
… like other counts - Replace the four per-folder report columns with one "Recoverable Email Count" (sum of Deletions, Purges, DiscoveryHolds and Versions), placed with the other email columns. - Integrate it exactly like the existing count columns (e.g. In Place Archive Count): plain column name, detected with a single "in columns" check, loaded with safe_int, initialised to 0 on every row, summed into stats. Older reports without the column load normally and trigger a delta scan only when Recoverable Emails is selected. - run_batch_scan uses the estimator's calculate_resource_count like the other phases (keyed by UPN). - The per-folder breakdown stays in the final totals log line, taken from the estimator's folder totals when the phase scanned. - Remove the RECOVERABLE_ITEMS_COLUMNS constant.
feat(exchange): Recoverable Email Count in the user report and CSV input
- calculate_migration_batches: Recoverable Email Count is treated like the other numeric count columns (missing in older data -> 0). Recoverable emails share the primary mailbox's quota, so they are added to the email stream for user mailboxes and to the shared mailbox stream for shared mailboxes (EffectiveEmailCount / EffectiveSharedMailCount), for both sorting and ETAs. They count as unencrypted. - Batches carry total_recoverable_emails; batch bars show a ♻️ segment when the source was selected. - Dashboard: one "Recoverable Emails" tile when the source was selected; Total Items includes recoverable emails. - README: dashboard tile and ETA rule. With the source unselected (or older data without the column) plans and ETAs are unchanged.
The recycle icon could be mistaken for a recycle bin; the scales of justice better represent legal hold. Applies to the dashboard tile and the batch bar segment.
feat(exchange): Recoverable Emails in ETAs, batches and the dashboard
…lure
Bug: execute_batch_request keyed pending requests by their original ids,
but create_batches uses int ids while Graph returns string ids. Retryable
sub-responses (429, 401, 5xx) were therefore never matched, never retried
and never returned, so they vanished silently and callers recorded
"No response" / 0. This affected every estimator built on create_batches
(recursive email, in-place archives, shared and group mailboxes,
Recoverable Emails, Files deep scan). A recent run lost ~2.76M
Recoverable Emails this way: 59 large DiscoveryHolds folders failed
while other folders of the same mailboxes succeeded, and all of them
returned 200 when re-queried.
Fix: match requests and responses on the string form of the id.
Logging (all include the request URL):
- non-2xx sub-responses, with or without the standard {"error": ...} body
- retryable responses that can't be matched to a request
- requests that got no response item
- requests dropped after max retries
- the existing missing/empty body warning
Also fixes "Consistent failures observed" crashing on dict bodies.
… lines - The periodic/final summary line now always includes "Partially failed: p/N", including 0: Processed x/N | Failed: f/N | Partially failed: p/N | <resource>: total - When the scan is stopped midway, the same summary line is logged with the counts reached so far. - The stop-path progress update now passes partially_failed, so the progress bar keeps showing partial failures (still hidden when 0). Applies to every phase using run_batch_scan (recursive email, in-place archives, shared mailboxes, Recoverable Emails).
…ines Partial failures are per folder (e.g. up to 4 per mailbox for Recoverable Emails), so a per-mailbox denominator was misleading. The summary line now reads: Processed x/N | Failed: f/N | Folders failed: k | <resource>: total where k is the number of failed folders (always shown, including 0). The progress bar still shows partially failed mailboxes only when >0. Drops the unit tests for the summary wording.
fix: retry 429/5xx $batch sub-responses, log every failure and failed folders
_resolve_target_users detected the column, so it skipped auth and the encrypted scan, but _prepare_batch_list never copied the values, so every row kept 0. Load it like the other count columns.
fix(exchange): load Encrypted Email Count from the input CSV
…e Items The Recoverable Items count now covers IPM.Note, IPM.Note.Secure, IPM.Note.Secure.Sign, IPM.Resend and the IPM.Schedule.Meeting.* request, cancellation and response types (RECOVERABLE_ITEMS_ITEM_TYPES). The admin API rejects 'type in (...)', so the types are or-ed together in the same single $count request per folder.
feat(exchange): count meeting, secure and resent emails in Recoverable Items
Renames the source label, log lines and dashboard card from "Recoverable Emails" to "Recoverable Items", and the report column from "Recoverable Email Count" to "Recoverable Items Count". No backward compatibility for the old column since it was never released.
refactor(exchange): rename Recoverable Emails to Recoverable Items
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.
No description provided.