Skip to content

Add full-text policy input for data-plane container creation - #321

Open
Mike Krüger (mkrueger) wants to merge 1 commit into
mainfrom
dev/mkrueger/fix/309-full-text-policy
Open

Mike Krüger (mkrueger) wants to merge 1 commit into
mainfrom
dev/mkrueger/fix/309-full-text-policy

Conversation

@mkrueger

Copy link
Copy Markdown
Collaborator

Add --full-text-policy to mkcon and create container for data-plane connections. The CLI accepts quoted JSON, and MCP accepts a native JSON object. Both validate the input before calling Cosmos DB and pass the policy through the create-if-not-exists operation without updating existing containers. The full-text indexing policy remains a separate setting.

This PR covers part of #309. It supports the basic policy shape (defaultLanguage, fullTextPaths, and per-path path and language), not advanced analyzer settings. ARM connections reject the option explicitly because the ARM operation is an upsert and could overwrite an existing container. This PR does not close #309.

Validation: 285 targeted tests passed during implementation; all 18 full-text tests passed again during review. No live Azure or emulator validation was performed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the container-level full-text policy support.

No open issues 🎉

What changed in this PR

Adds container-level full-text policy input to the shell’s data-plane creation workflow, covering part of #309 without changing existing containers or enabling account features.

Changes:

  • Adds --full-text-policy to mkcon and create container, accepting quoted JSON in the CLI and native JSON objects in MCP.
  • Validates the basic policy shape, forwards it through create-if-not-exists, and explicitly rejects ARM usage.
  • Adds focused tests, localized help, and documentation distinguishing full-text policies from indexing policies.
File Description
l10n/​CosmosDBShell.json Updates the localization catalog with option help and errors.
docs/​mcp.md Documents native JSON policy input for MCP.
docs/​commands.md Documents CLI usage, prerequisites, and backend limitations.
CosmosDBShell/​lang/​en.ftl Adds localized policy descriptions and validation errors.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Mcp/​ToolOperations.cs Defines the policy schema and enforces object input.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​ICosmosResourceOperations.cs Extends container creation with an optional policy.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​DataPlaneCosmosResourceOperations.cs Applies the policy to container creation properties.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​CosmosResourceFacade.cs Forwards the policy to resource operations.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​ContainerFullTextPolicyInput.cs Parses and validates the supported policy shape.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Core/​ArmCosmosResourceOperations.cs Explicitly rejects full-text policy input.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Commands/​MakeContainerCommand.cs Adds the option and validates it before resource calls.
CosmosDBShell/​Azure.Data.Cosmos.Shell.Commands/​CreateCommand.cs Forwards the option for containers and rejects other targets.
CosmosDBShell.Tests/​ToolOperationsCallToolTests.cs Tests CLI/MCP forwarding and MCP input types.
CosmosDBShell.Tests/​CommandTests/​ResourceCreationResultTests.cs Tests ARM rejection, existing-container outcomes, and service errors.
CosmosDBShell.Tests/​CommandTests/​MakeContainerCommandTests.cs Tests rejection of malformed and unsupported policy shapes.

Review effort: Balanced

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage/dotnet

main 3628267 dev/mkrueger/fix/309... ead88a5 +/-
76% 76% 0%
View coverage of the 7 most impacted files.
File main 3628267 dev/mkrueger/fix/309... ead88a5 +/-
D:\a\CosmosDBSh...ainerCommand.cs 89% 88% -1%
D:\a\CosmosDBSh...reateCommand.cs 79% 79% 0%
D:\a\CosmosDBSh...mportCommand.cs 97% 97% 0%
D:\a\CosmosDBSh...olOperations.cs 95% 96% +1%
D:\a\CosmosDBSh...ceOperations.cs 51% 52% +1%
D:\a\CosmosDBSh...ceOperations.cs 5% 6% +1%
D:\a\CosmosDBSh...tPolicyInput.cs 0% 100% +100%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants