Allow submission payloads to be provided by file or standard input - #160
Open
Alexandre Zollinger Chohfi (azchohfi) wants to merge 1 commit into
Open
Conversation
The submission JSON was only accepted as a positional command-line argument. Windows caps a command line at 32,767 characters, so any listing whose JSON exceeds that could not be updated through the CLI at all (a 7-language listing is easily 60 KB). Program.cs already slurped standard input and appended it as an extra argv entry, but that read was capped at 1 second to avoid blocking forever when standard input is redirected but never written to (CI agents, non-interactive shells, debuggers). The cap silently discarded the payload whenever the producer was slower than that, which the documented `submission get | submission update` round-trip always is. The payload of `submission update`, `submission updateMetadata` and `flights submission update` is now resolved in this order: 1. `--payload <file>` / `-p <file>` 2. `-` as the payload argument, to read all of standard input 3. inline JSON, exactly as before 4. a path to an existing file 5. no payload plus redirected standard input, to read all of it The global slurp is replaced by standard input reading inside the commands that want a payload. It waits for the first character only, then reads to the end of the stream with no deadline, so it neither hangs on an idle stream nor truncates a slow producer. Fixes #151 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 52ff9b04-3c41-4040-8db2-c312aaa0b255
Alexandre Zollinger Chohfi (azchohfi)
requested review from
isourabh
and
a balanced review from Copilot
August 24, 2026 20:15
Copilot started reviewing on behalf of
Alexandre Zollinger Chohfi (azchohfi)
August 24, 2026 20:17
View session
There was a problem hiding this comment.
Pull request overview
Adds file and standard-input payload support to submission updates, avoiding command-line length limits.
Changes:
- Adds centralized payload resolution for inline JSON, files, and stdin.
- Updates three submission commands with
--payload/-p. - Adds coverage for payload sources, errors, and large payloads.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
MSStore.CLI/Services/IConsoleReader.cs |
Extends the console input contract. |
MSStore.CLI/Services/ConsoleReader.cs |
Implements timeout-aware stdin reading. |
MSStore.CLI/Program.cs |
Removes global stdin argument injection. |
MSStore.CLI/Helpers/PayloadResolver.cs |
Resolves payloads from supported sources. |
MSStore.CLI/Commands/SubmissionCommand.cs |
Defines the shared payload option. |
MSStore.CLI/Commands/Submission/UpdateMetadataCommand.cs |
Supports alternate metadata payload sources. |
MSStore.CLI/Commands/Submission/UpdateCommand.cs |
Supports alternate product payload sources. |
MSStore.CLI/Commands/Flights/Submission/UpdateCommand.cs |
Supports alternate flight payload sources. |
MSStore.CLI.UnitTests/BaseCommandLineTest.cs |
Adds temporary payload-file support. |
MSStore.CLI.UnitTests/SubmissionCommandPackagedUnitTests.cs |
Tests packaged submission payload handling. |
MSStore.CLI.UnitTests/SubmissionCommandUnpackagedUnitTests.cs |
Tests unpackaged payload handling. |
MSStore.CLI.UnitTests/FlightsSubmissionCommandUnitTests.cs |
Tests flight payload handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
isourabh
approved these changes
Aug 26, 2026
| /// The value that, when used in place of the payload argument, means "read the payload from | ||
| /// the standard input stream". | ||
| /// </summary> | ||
| internal const string StandardInputToken = "-"; |
Collaborator
There was a problem hiding this comment.
should we give this feature? As uses can save the data from slow produced into a file before and pass that file
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.
Fixes #151.
Problem
The submission JSON was only accepted as a positional command-line argument. Windows caps a command line at 32,767 characters (
CreateProcesslpCommandLine), so any listing whose JSON exceeds that could not be updated through the CLI at all — the reporter's 7-language listing is 66,370 characters, roughly 2x the OS limit.Program.csalready slurped standard input and appended it as an extra argv entry (present since the initial commit — it was the original answer to "don't paste 60 KB on the command line").ff9c145capped that read at 1 second because standard input can be redirected but never closed (CI agents, non-interactive shells, and under a debugger — hence the pre-existing!Debugger.IsAttachedguard), which madeReadToEnd()block forever.That cap is what makes the documented round-trip fail today: the read is cancelled and the payload is silently discarded, so
msstore submission get … | msstore submission update …breaks whenever the producer takes longer than a second — which a network-backedsubmission getalways does.What changed
submission update,submission updateMetadataandflights submission updatenow resolve their payload in this order:--payload <file>/-p <file>AcceptExistingOnly()-as the payload argumentStandard input reading moved out of
Program.csand into the commands that actually want a payload, and is now robust: it waits for the first character only (5 s on the implicit path, indefinitely for the explicit-), then reads to EOF with no deadline. That fixes both failure modes at once — no hang when standard input is redirected-but-empty, and no truncation when the producer is slow. Supplying both an inline payload and--payloadis now an explicit error instead of one silently winning.Verification
Behaviour of the real
ConsoleReaderagainst actual pipes:-NUL(CI style)12 new unit tests cover
--payload, file-path arguments,-/standard input, implicit redirected input, both error paths, and a >32,767-character payload asserted end-to-end through the API mock. The existing inline-JSON tests are untouched and still pass, which is the backwards-compatibility guard.dotnet build MSStore.CLI.slnis clean (0 warnings) and the full suite passes on both target frameworks apart from failures that reproduce unchanged onmain(PublishCommandFor{WinUI,Maui}AppsShouldCallMSBuildIfWindowsonnet10.0, and the npm/yarnPackageCommandtests onnet10.0-windows).Follow-up
The published reference at
MicrosoftDocs/windows-dev-docs-pr→hub/apps/publish/msstore-dev-cli/commands.mdstill documents the positional-only syntax and needs a separate docs PR.--helpis already updated by this change.