Repository navigation
Show periodic progress for import and bulk ingestion - #264
Mike Krüger (mkrueger) wants to merge 17 commits into
Conversation
Report counts, elapsed time, processing rate, and observed RU usage every two seconds in human-readable output, including while writes are waiting. Structured output, redirected stdout, quiet mode, and MCP results are unchanged. Add customer sizing guidance and an opt-in emulator benchmark covering 1K/10K/100K items at concurrency 1/16/32.
Code coverage overviewLanguages: C# C# / code-coverage/dotnet
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…ress in place Commands against a local emulator were canceled after 10 seconds even while making progress, so long imports, deletes, queries, exports, and piped scripts failed and disconnected. The limit now applies only when nothing makes progress: every emulator response, completed write, and validated operation restarts it, and it is paused during confirmation prompts and external editors. Pattern-based and piped rm now report scan and delete progress. In a terminal, progress for import, bulk, and rm is redrawn on a single line and erased when the command finishes; piped output keeps one line per update.
- Keep a progress formatting or output failure from changing the ingestion result. - Show progress only when stdout is a terminal, including OS-level redirection and pipes. - Settle import and bulk writes in completion order during the final drain so progress does not wait for the slowest write. - Isolate COSMOSDB_SHELL_FORMAT in progress policy tests and escape apostrophes in shell-quoted test paths. - Make the inactivity timeout tests deterministic with a manual clock.
|
Addressed all 6 findings from the Copilot review overview in dc523ea (no suppressed findings were listed). Each inline thread has a reply and is resolved. That commit also fixes the |
- Restart the emulator inactivity timeout only for real emulator responses and local work, not failed writes. - Pause the timeout of the interpreter executing the command during confirmations and editors. - Report a bulk timeout returned as a structured error as an emulator timeout and disconnect, keeping the partial result. - Report activity while loading and validating bulk journals and during the CSV export pass. - Start progress before synchronous work; ignore all non-fatal cleanup failures. - Fall back to a compact progress line on narrow consoles; hold the progress-line lock while rendering warnings. - Filter manual-clock timers with Where in tests.
|
Second Copilot review round addressed in 3e0daee: the 6 overview findings plus the code-quality suggestion. Each inline thread has a reply and is resolved. The 5 "previously missed" findings are also fixed:
|
…ions - Re-label emulator inactivity timeouts with a TimeoutException so the exit code reports a connection error, rebuilding script location frames outermost for structured bulk results. - Use a fixed wide console width in terminal-mode progress tests.
|
Third Copilot review round: all 3 overview findings (console-width-dependent tests, lost script location, and exit code for emulator timeouts) are addressed in b2f1799, and their threads are replied to and resolved. The overview listed no suppressed or previously missed findings this round. |
Earlier stages of an in-shell pipeline still show progress on the terminal; the line is erased before the next stage and never becomes part of the piped data. Only operating-system pipes and redirection suppress it.
|
Fourth Copilot review: no open issues, all 3 previous threads are resolved, and CI is green. On the overview note that progress stays visible for upstream stages of a pipeline: this is intentional, and the docs now say so (74f2a49). In-shell |
|
Resolved the two latest findings in 1d96c97, with individual explanations before resolution. A successfully stopped watch in stdin now prevents separately supplied startup commands from running. Timed-out import JSON now matches the connection-error exit code and message while retaining settled counts/RUs; direct and block regressions also validate redirected JSON and MCP responses. Both builds pass with zero warnings/errors; focused tests pass (120), and offline tests pass (4,978 passed, 6 expected skips). |
Drain settled writes during asynchronous source reads without disposing an enumerator whose read is still active, and cover progress snapshots plus fault/cancellation cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed the latest review overview even though it reported no open threads: completed import writes could remain unrecorded during slow asynchronous input reads. Commit 6d92a29 drains completions during those reads and safely settles the active read before source disposal on failure/cancellation. Added live-count/RU and cleanup regressions; both builds pass without warnings/errors, and offline tests pass (4,981 passed, 6 expected skips). Added a substantive follow-up on the original resolved progress thread for the suppressed duplicate. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Synchronized the branch with the newly updated main branch (#263) without including unrelated local benchmark/documentation edits. The merged app and tests build without warnings/errors; offline suite: 5,009 passed, 6 expected skips. This also refreshes GitHub mergeability after it reported a conflicting base. |
Pace real emulator requests so duration assertions exceed the timeout regardless of machine speed, and let shared error assertions accept structured partial failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Fixed the newly enabled emulator CI failures in 3d438a3. Real requests are paced in the timing fixture so a fast emulator cannot invalidate the >timeout assertions; the shared error helper now accepts structured partial failures. Focused validation against the running emulator passed (49 tests), and the offline suite passed (5,009 tests, 6 expected skips). The preceding merged-head build/package/localization/CodeQL checks passed. The latest Copilot review reports no open issues; its generic human-assessment note identifies no additional concrete defect. Startup/cancellation safety paths have explicit regressions, and the overview-only slow-input progress concern was implemented rather than dismissed. Also added substantive confirmations to the pre-existing resolved threads whose previous replies were placeholders. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved cancellation and timeout gaps can let interrupted commands continue or disconnect active sessions, while progress reporting and machine-readable output can also be incorrect.
10 open issues
Honor cancellation while loading journal records · New Refresh activity for successfully settled writes · New Settle completed writes while awaiting spool reads · New Report activity for locally rejected import records · New Publish scan progress and refresh activity during pattern scans · New Propagate handled cancellation through expression evaluation · New Cancel startup operations on Ctrl+C during prompts · New Pause external commands executed in expressions · New Keep interrupt markers out of machine-readable output · New Create startup cancellation before reading stdin · New
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved issues can leave progress stale, trigger false emulator timeouts, and prevent cancellation from promptly stopping startup or enclosing command work.
10 open issues
Create startup cancellation before reading stdin Keep interrupt markers out of machine-readable output Pause external commands executed in expressions Cancel startup operations on Ctrl+C during prompts Propagate handled cancellation through expression evaluation Publish scan progress and refresh activity during pattern scans Report activity for locally rejected import records Settle completed writes while awaiting spool reads Refresh activity for successfully settled writes Honor cancellation while loading journal records
Review effort: Balanced
) Honor interrupts during journal and stdin reads or confirmations, preserve handled watch cancellation through expressions, keep redirected output clean, and refresh progress during local validation, scans, and settled-write recording. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Resolved all ten newly published findings in 1cd1568, each with a substantive reply before resolution. Covered bulk journal cancellation/settlement, bulk slow-source progress, local import validation, per-row removal scans, handled watch expressions, confirmation interrupts, external expressions, clean machine stdout, and cancellable stdin reads. Both builds pass cleanly. The configured offline suite passes (5,042 passed, 6 expected skips), and the four real-emulator inactivity regressions pass separately. Startup/prompt/output focused coverage passed 106 tests; focused bulk regressions passed 11 tests. Unrelated benchmark and ingestion-documentation changes remain uncommitted and untouched. |
There was a problem hiding this comment.
🟡 Changes recommended
Interrupting a command with an explicit structured format can corrupt stdout with ^C because the check considers only the session default.
1 open issue
10 resolved since last review
Create startup cancellation before reading stdin Keep interrupt markers out of machine-readable output Pause external commands executed in expressions Cancel startup operations on Ctrl+C during prompts Propagate handled cancellation through expression evaluation Publish scan progress and refresh activity during pattern scans Report activity for locally rejected import records Settle completed writes while awaiting spool reads Refresh activity for successfully settled writes Honor cancellation while loading journal records
Review effort: Balanced
Scope interrupt-output policy to effective command formats, preserve it across nested dispatch and cancellation unwind, and give mock responses explicit lifetimes outside inactivity measurements. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Completed the final format-specific interrupt finding and response-lifetime follow-ups in 5740191. Explicit command JSON/CSV formats now suppress interrupt markers even with a human-readable session default; nested structured contexts remain protected. Mock setup no longer consumes the local-validation timing budget. Dismissed the proposed SystemException-only catch with a technical explanation and non-SystemException regressions preserving first-failure semantics. Both builds pass cleanly; full offline suite: 5,058 passed, 6 expected skips. All published review threads currently have substantive dispositions and are resolved. |
|
Final verification at 5740191: all 47 review threads are resolved, including overview/suppressed findings and explained inapplicable suggestions. Latest Copilot review reports no open issues; its remaining overview is a general combined-behavior review caution, with no additional concrete defect. All applicable checks are green: build/test/package, fuzzer, localization, CodeQL, offline integration, Linux emulator, Windows partition-key integration, and CLA. Local offline validation passed 5,058 tests with 6 expected skips; four real-emulator inactivity regressions also passed. Branch is mergeable and synchronized with main. Unrelated local benchmark and ingestion-documentation edits were preserved; temporary isolated build outputs were removed. |


Improves what users see during long-running ingestion and documents expectations and limitations for customers.
Progress reporting
importpreviously only printed a final summary, andbulkprinted progress only when an operation completed, so it went silent during slow writes or SDK retry waits. Both now share anIngestionProgressheartbeat that reports about every two seconds:Progress is human-readable output only. Quiet mode, structured output (
json/csv), redirected stdout, and MCP calls emit nothing extra, and final result shapes are unchanged. Reporting failures never abandon in-flight writes.Sizing guidance and measurements
New docs/ingestion.md covers pilot sizing, how to read progress, limits (2 MB per item, stateful bulk caps, temporary spool disk, no rollback, retry safety), and local emulator measurements.
The opt-in
IngestionBenchmarkTests(skipped unlessCOSMOSDB_SHELL_INGESTION_BENCHMARK_CSVis set) ran the full matrix of import and bulk create with 1K/10K/100K 1 KiB items at concurrency 1/16/32. All 18 cases verified their final container counts (666,000 writes). Concurrency 16 was about 3x faster than 1; 32 showed no consistent gain:These are local emulator command-path numbers, not Azure throughput promises. Representative Azure measurements are still needed before publishing customer completion-time estimates.
Local emulator timeout
Commands connected to a localhost emulator were canceled after 10 seconds in total, even while making progress. That broke long imports,
rm *, exports, queries, and piped scripts, and disconnected the shell. The limit is now an inactivity timeout:RequestHandler). Completed import/bulk writes and locally validated bulk operations also restart it. Request timeouts and 503s do not count, because the SDK synthesizes them when the emulator doesn't answer.rmprogress and in-place progress linePattern-based and piped
rmnow report items scanned and deleted. In a terminal, progress forimport,bulk, andrmis redrawn on a single line (truncated to the console width), cleared before mid-run warnings, and erased when the command finishes. Progress appears only when stdout is a terminal; pipes and OS or shell redirection suppress it.Validation
dotnet buildfor the shell and test projects: 0 warnings, 0 errorsCategory!=Emulator): 4,927 passedInfo_Container_FormatTable_RedirectsGrid,Sproc_Exec_WithoutResponseBody_ReturnsNull) also fail on unmodifiedmainrm *on 3,000 items (48.5 s) all complete; previously each stopped at about 10 sl10n/CosmosDBShell.jsonregenerated with the new and changed stringsExample:
