Repository navigation
Preserve '?' in unquoted command arguments - #262
Merged
Mike Krüger (mkrueger) merged 1 commit intoOct 28, 2026
Merged
Conversation
Unquoted shell words stopped at '?', so 'index add /city/?' sent '/city/' to Cosmos DB and the service rejected the indexing policy with HTTP 400. Treat '?' as part of a shell word so scalar indexing paths and wildcard patterns reach commands unchanged. Fixes #260
Mike Krüger (mkrueger)
requested review from
a team
and
a balanced review from Copilot
October 28, 2026 09:11
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the change preserving ? in unquoted shell arguments.
No open issues 🎉
What changed in this PR
Fixes #260 by preserving ? within unquoted shell arguments, allowing scalar indexing paths such as /city/? to reach Cosmos DB unchanged.
Changes:
- Updates shared argument parsing for direct commands,
exec, command expressions, and inline option values. - Adds parser, execution, policy-preservation, and emulator readback regression coverage.
- Documents unquoted indexing paths and distinguishes accepted policy metadata from emulator indexing-performance support.
| File | Description |
|---|---|
docs/commands.md |
Clarifies unquoted path support and readback limitations. |
CosmosDBShell/Azure.Data.Cosmos.Shell.Parser/CommandShellWordParser.cs |
Allows ? to continue an unquoted shell word. |
CosmosDBShell.Tests/Parser/StatementParserStructureTests.cs |
Covers command forms, source ranges, and statement boundaries. |
CosmosDBShell.Tests/Parser/CommandExecutionTests.cs |
Adds execution cases for paths and URLs containing ?. |
CosmosDBShell.Tests/Integration/IndexPolicyTests.cs |
Adds SDK control and readback checks for add, repeated add, and remove. |
CosmosDBShell.Tests/CommandTests/DataPlaneCosmosResourceOperationsTests.cs |
Checks policy metadata preservation through an incremental add. |
CHANGELOG.md |
Records the unquoted-argument parsing fix. |
Review effort: Balanced
Vsevolod Kukol (sevoku)
approved these changes
Oct 28, 2026
Mike Krüger (mkrueger)
deleted the
dev/mkrueger/fix/260-index-path-question-mark
branch
October 28, 2026 09:35
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 #260.
Problem
index add /city/?failed with HTTP 400 ("The indexing path '/city/' could not be accepted"), although the same policy succeeded throughindex setand a direct SDK read-modify-write.The root cause is in command-argument parsing, not the policy round trip: unquoted shell words stopped at the
?token, so/city/?was split into the arguments/city/and?. The incremental add therefore sent an invalid/city/path to Cosmos DB. The full-policyindex setworked because its paths are inside a quoted JSON string.Fix
Treat
?as a shell-word continuation character inCommandShellWordParser, alongside/,*,:, etc. This applies to direct commands,exec, command expressions, and inline option values.User-visible effects beyond indexing paths: unquoted words such as
a?b, wildcard patterns likefile?.csh, and URLs with query strings now stay single arguments instead of being split. A standalone?, quoted strings, and statement separators are unchanged.Tests
/city/?is preserved across direct commands,exec, command expressions, inline option values, and;statement boundaries, with correct source ranges.exec "echo"arguments match direct arguments for?-containing paths and URLs.indexes,isFullIndex, composite/spatial/vector/full-text indexes) is preserved exactly when adding a path.IndexPolicyTests), using the selective policy from the issue with independent SDK readback:index add /city/?succeeds, and a repeated add is idempotent;index remove /city/?restores the original policy.Validation: both projects build; offline suite (
Category!=Emulator) 4,894 passed / 5 skipped; emulator indexing tests pass. Verified against the local Windows emulator — not yet against the Linux vNext image from the issue. Readback confirms accepted configuration only, not emulator index-performance behavior.