Repository navigation
Fix implicit pipeline input between script commands - #292
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Non-piped function and script calls can still read and forward stale results from preceding statements because the reset only covers registered commands; entry-point clearing and regressions for empty and return-only bodies are needed.
1 open issue
What changed in this PR
This PR addresses #281 by distinguishing explicit pipeline input from earlier statement results, preventing independent commands such as rm --dry-run from using stale input.
Changes:
- Track and consume pipeline provenance across commands, functions, and scripts.
- Isolate command-expression execution while preserving caller context for argument evaluation.
- Add 39 regression cases and document independent-statement behavior.
| File | Description |
|---|---|
| docs/programming.md | Clarifies pipeline behavior between separate statements. |
| docs/navigation.md | Documents independent commands with an exact-ID preview example. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Statement/PipeStatement.cs | Marks explicit pipeline stages and clears provenance afterward. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Statement/DefStatement.cs | Clears pipeline provenance when function execution finishes. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Statement/CommandStatement.cs | Clears non-piped command results and separates script execution state. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/Expression/CommandExpression.cs | Isolates expression execution from caller pipeline input. |
| CosmosDBShell/Azure.Data.Cosmos.Shell.Core/CommandState.cs | Adds pipeline-input tracking. |
| CosmosDBShell.Tests/CommandTests/PipelineInputTests.cs | Covers sequential commands, explicit pipelines, nested invocations, and exact-ID previews. |
Review effort: Balanced
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 |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sults in #292 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The isolated execution state discards input from explicit expression-level pipes, causing previously valid nested filters to throw “requires piped JSON input” instead of returning results.
1 open issue
2 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>


Summary
Fixes #281.
|stages as pipeline input, so independent statements no longer feed earlier results intormor other input-consuming commands.exec; consume pipeline provenance when function/script invocations finish, including empty and return-only bodies.rm --dry-runpreviews aftercdandprint, redirected script output, nested invocations, and explicit-pipeline controls.Validation
git diff --check: passed.The combined offline run encountered an existing parallel temporary-file race: the
dirJSON contract test enumerated a script file whileCommandStatementTests.ScriptExpression_PreservesEnclosingOutputRedirectiondeleted it. Running the JSON contract class separately passed all 21 cases; the remaining batch passed 5,087 tests with 6 skipped. No unrelated code was changed to suppress the race.Cosmos DB behavior is verified with mocks; no live data was modified.