Skip to content

feat(fabric): add core_delete-item with explicit hard-delete opt-in - #3848

Closed
Amos Hersch (AmosHersch) wants to merge 1 commit into
amoshersch-fabric-update-itemfrom
amoshersch-fabric-delete-item
Closed

Amos Hersch (AmosHersch) wants to merge 1 commit into
amoshersch-fabric-update-itemfrom
amoshersch-fabric-delete-item

Conversation

@AmosHersch

@AmosHersch Amos Hersch (AmosHersch) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds exactly one Fabric Core tool, core_delete-item, using the Fabric Delete Item API.

Depends directly on #3849, Update Item; the ultimate target remains main. This existing PR and branch were rebased in place for the user-authorized conflict-prevention chain. Its immediate base is amoshersch-fabric-update-item at a92fad0120739d227ab2aa867ec4c6d5fb4a9390. This layer is one commit, b1aa5b024f228be6a38eebf8eec8824298d2f62f, changing 22 files relative to that parent. No replacement PR, other branch mutation, main import, merge, closure, or native-stack metadata change was made.

  • Requires nonempty workspace/item UUIDs and validates them before authentication. Sends one application-level DELETE, accepts the documented empty HTTP 200 response, and returns only workspaceId, itemId, and hardDeleteRequested.
  • Keeps hard-delete optional. Omission/null leaves the API query parameter unspecified, false sends hardDelete=false, and explicit true sends hardDelete=true. The reviewed registration-time System.CommandLine guard rejects bare, empty/invalid, and repeated/ambiguous CLI occurrences before service/authentication. It remains configured before discovery/execution, with command-local validators and no shared binder changes.
  • Preserves the Boolean MCP schema and existing argument coercion: explicitly supplied "true" or ["true"] can bind as one explicit true token. This does not claim original JSON-type enforcement. Missing/null/empty/false never enables hard deletion, and aliases that repeat the option are rejected.
  • Preserves the existing host credential bridge through IAzureTokenCredentialProvider and DataFactory's per-request ProviderDelegatingCredential as TokenCredential, existing destructive-operation consent, and read-only exclusion.
  • Retains sanitized, status-preserving failures, validated Retry-After guidance, cancellation/disposal, source-generated output/schema, and Fabric documentation/prompts/changelog. No prefetch, name resolution, application retries, polling, bulk deletion, or fallback to permanent deletion. Existing HTTP-client redirects are unchanged; one application-level DELETE is not a one-wire-hop guarantee.

Default/false soft-deletes only supported item types and does not promise recovery. Soft deletion requires item write permission; hard/permanent deletion requires workspace Admin. Delegated callers need Item.ReadWrite.All or the item-specific write scope; service principal/managed identity support depends on item type. The tool is destructive and not read-only. Idempotent=true follows Fabric OneLake deletion-effect conventions; a subsequent 404 remains an error, not success or permission to retry. Cancellation/timeouts retain the original truthful warning that deletion state was not confirmed.

Adaptation to the common foundation

Reuses #3855's single private FabricCoreService.SendFabricHttpRequestAsync, preserving the original buffered ResponseContentRead default and named cancellationToken:. The legacy create/search wrapper and every other operation's completion setting are unchanged. FabricCoreHttpHelpers.GetRetryAfter replaces only the duplicate parser; FabricItemDeleteThrottledException, nullable-header fallback, status/error wording, and unknown-outcome behavior remain unchanged.

Tests reuse thread-safe FabricCoreHttpMessageHandler.CallCount, capturing requests in callbacks for the original disposal assertions rather than adding properties to the shared handler. ItemDeleteTrackingContent remains intact. The original command/options/result/exception, registration guard, command tests, specialized content, and test-data helper are unchanged; every original Delete Item test method and InlineData case was retained.

All lower tools, helpers, models, tests, docs, prompts, and changelog entries are retained. The named Get Workspace and List Items service/MCP suites are unchanged. Cumulative discovery assertions now include Delete Item, and read-only discovery excludes it and all earlier mutations. All five inherited default/all host cases remain. This layer introduces no engineering, shared framework, production host/proxy, auth, project, or dependency changes; only host discovery-test assertions are extended.

GitHub issue number?

N/A — no issue was supplied or created. This is the existing single-tool PR, now dependent on Update Item as described above.

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Created a changelog entry if the change falls among the following: new feature, bug fix, UI/UX update, breaking change, or updated dependencies. Follow the changelog entry guide
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes running the script ./eng/scripts/Process-PackageReadMe.ps1. See Package README
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts - Not run; score/ranking requirement waived for this PR by the Fabric MCP maintainer.
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated command list in servers/Azure.Mcp.Server/docs/azmcp-commands.md
    • Ran ./eng/scripts/Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • Updated test prompts in servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Applicability: this is Fabric-only and renames no tools. Fabric uses NullConsolidatedToolDefinitionProvider, so Azure-only consolidation/command-metadata items do not apply. No live-pipeline comment was posted. The ToolDescriptionEvaluator score/ranking requirement is waived for this PR by the Fabric MCP maintainer; the evaluator was not run.

Cumulative validation

SDK 10.0.401. 1,344 focused offline tests passed, zero failed/skipped: 1,337 Core, five host, and two credential-bridge cases. All 1,199 parent Core cases remain, plus all 138 original Delete Item cases. Discovery contains 57 Fabric tools / 11 Core names. All 31 prompt rows match; the 28 inherited rows are retained exactly.

All deletion HTTP/credential interactions are mocked. Host tests perform local discovery only; no real Fabric call or deletion was made.

Exact command Result
dotnet build 'tools\Fabric.Mcp.Tools.Core\src\Fabric.Mcp.Tools.Core.csproj' --no-restore --nologo --verbosity quiet Passed; 0 warnings/errors.
dotnet build 'tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests\Fabric.Mcp.Tools.Core.Tests.csproj' --no-restore --nologo --verbosity quiet Passed; 0 warnings/errors.
dotnet test --project 'tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests\Fabric.Mcp.Tools.Core.Tests.csproj' --no-build --no-restore --no-progress Passed: 1,337 tests; none skipped.
dotnet build 'servers\Fabric.Mcp.Server\tests\Fabric.Mcp.Server.Tests\Fabric.Mcp.Server.Tests.csproj' --nologo --verbosity quiet Passed; 0 warnings/errors. Restored existing dependencies after the initial host no-restore build reported missing assets.
dotnet build 'servers\Fabric.Mcp.Server\src\Fabric.Mcp.Server.csproj' --no-restore --nologo --verbosity quiet Passed; 0 warnings/errors.
dotnet test --project 'servers\Fabric.Mcp.Server\tests\Fabric.Mcp.Server.Tests\Fabric.Mcp.Server.Tests.csproj' --no-build --no-restore --no-progress Passed: all five inherited local stdio/HTTP startup/discovery cases, including new Delete Item schema assertions.
dotnet build 'tools\Fabric.Mcp.Tools.DataFactory\tests\Fabric.Mcp.Tools.DataFactory.Tests\Fabric.Mcp.Tools.DataFactory.Tests.csproj' --nologo --verbosity quiet Passed; 0 warnings/errors. Restored existing test assets after the initial no-restore build reported them missing.
dotnet test --project 'tools\Fabric.Mcp.Tools.DataFactory\tests\Fabric.Mcp.Tools.DataFactory.Tests\Fabric.Mcp.Tools.DataFactory.Tests.csproj' --no-build --no-restore --filter-class '*ProviderDelegatingCredentialTests' --no-progress Passed: both existing credential-bridge tests.
dotnet format 'tools\Fabric.Mcp.Tools.Core\src\Fabric.Mcp.Tools.Core.csproj' --no-restore --verify-no-changes --include $source --verbosity quiet Passed; all eight layer source C# files.
dotnet format 'tools\Fabric.Mcp.Tools.Core\tests\Fabric.Mcp.Tools.Core.Tests\Fabric.Mcp.Tools.Core.Tests.csproj' --no-restore --verify-no-changes --include $tests --verbosity quiet Passed; all nine layer Core test C# files.
dotnet format 'servers\Fabric.Mcp.Server\tests\Fabric.Mcp.Server.Tests\Fabric.Mcp.Server.Tests.csproj' --no-restore --verify-no-changes --include 'servers\Fabric.Mcp.Server\tests\Fabric.Mcp.Server.Tests\Infrastructure\ServerStartupTests.cs' --verbosity quiet Passed.
.\eng\common\spelling\Invoke-Cspell.ps1 -FileList $paths -PackageInstallCache $cache Passed: all 22 layer files, zero spelling issues. Isolated cache removed.
.\eng\scripts\Process-PackageReadMe.ps1 -Command 'validate' -InputReadMePath 'servers\Fabric.Mcp.Server\README.md' Exited 0 with the same 14 pre-existing TOC heading-level messages; no unrelated cleanup.
.\eng\scripts\Compile-Changelog.ps1 -ChangelogPath 'servers\Fabric.Mcp.Server\CHANGELOG.md' -DryRun Passed: all 20 cumulative entries validated, no compiled changelog rewritten.
& '.\servers\Fabric.Mcp.Server\src\bin\Debug\fabmcp.exe' 'tools' 'list' '--name-only' Passed with stdout/stderr separated: 57 tools, exactly 11 Core names, all 31 prompt rows matched.
pwsh -NoProfile -File '.\eng\scripts\Test-ToolSelectionPrompts.ps1' -ServerName 'Fabric.Mcp.Server' -OutputPath $output Passed with fresh current-commit trimmed/self-contained Debug win-x64 artifacts: 57 tools loaded, one server tested, none skipped, zero violations.
git --no-pager diff --check 'a92fad0120739d227ab2aa867ec4c6d5fb4a9390..HEAD' -- Passed.

$source, $tests, and $paths are layer-relative file arrays. $cache was the session-local files\delete-item-stack-cspell-cache, cleaned by the spelling script. $output was Join-Path $PWD '.work\stack-3848-prompt-build', verified absent before the fresh build. Git long-path support was process-local, not a repository/global configuration change.

Coverage includes actual guarded registered CLI/MCP paths, omission/false/explicit true, bare/empty/invalid/repeated/alias inputs, existing coercions, pre-authentication UUID validation, exact request/query/body shape and counts, empty 200, 403/404 and other failures, validated throttling guidance, cancellation/disposal, output/schema/annotations, read-only exclusion, destructive consent, and all lower-layer regressions.

The former stderr/JSON prompt-validator failure is resolved by inherited #3854; the actual script passes on this layer. This is catalog-name validation, not a ToolDescriptionEvaluator score. No new engineering workaround is included.

Recovery and publication

The create-only local recovery ref refs/backup/fabric-stack-3848-20261005 retains original head e345110ab2c92bec39b282c9ea82cce1b0a8e0ac. Only the verified original one-tool commit after historical fork d4df988aae3ba1de008efe10f664f12817bdcc24 was rebased onto the exact frozen parent. Publication used only the owning branch refspec with --force-with-lease=refs/heads/amoshersch-fabric-delete-item:e345110ab2c92bec39b282c9ea82cce1b0a8e0ac.

Own/lower PR states, refs, locks, auto-merge/queue absence, and empty filtered native-stack membership were revalidated before publication and retargeting, then verified afterward. The same draft PR and branch remain. GitHub refreshed the old main-based metadata to 0fa879ecf7c51946fa17e73304e468558c351b6c; this was observation only and was not imported.

Limitations and current CI

  • ToolDescriptionEvaluator: not run; maintainer exemption. The Fabric MCP maintainer has waived the score/ranking requirement for this PR. Configuration is unavailable; no score or top-three ranking is claimed. The checkbox remains unchecked because the evaluator was not run. Normal code review and required CI still apply.
  • Live Fabric, real deletions, real OBO/RBAC/service-principal/managed-identity authorization, and recorded/playback: not exercised. Local discovery and mocked tests do not establish real-service permissions. No live/recorded infrastructure was added or awaited.
  • Full-repository suites, native AOT publishing, and NPX/package verification were not run. The fresh prompt-validator publication was trimmed/self-contained, not native AOT. No engineering/project/dependency files change relative to the immediate parent.
  • Hosted CI is not all green. At the new-head snapshot, policy automation, SpellCheck, Verify Links, CLA, and SDL agentless tagging succeeded. Azure build 6920355 shows cancelled Initialize and SDL Sources Analysis stages, while the aggregate mcp - pullrequest check remains queued. No retries or live pipelines were requested. Required CI and human review still apply.
  • This remains a draft with no auto-merge, merge queue, closure, replacement PR, or native-stack registration.

Invoking Livetests

Copilot submitted PRs are not trustworthy by default. Users with write access to the repo need to validate the contents of this PR before leaving a comment with the text /azp run mcp - pullrequest - live. This will trigger the necessary livetest workflows to complete required validation.

@azure-pipelines

azure-pipelines Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the server-Fabric.Mcp Microsoft Fabric MCP Server label Oct 5, 2026
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-delete-item branch from e345110 to b1aa5b0 Compare October 6, 2026 00:06
@AmosHersch
Amos Hersch (AmosHersch) changed the base branch from main to amoshersch-fabric-update-item October 6, 2026 00:06
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-delete-item branch 2 times, most recently from 061aed3 to ea7c453 Compare October 6, 2026 12:28
@AmosHersch
Amos Hersch (AmosHersch) force-pushed the amoshersch-fabric-delete-item branch 2 times, most recently from 9d41820 to e91f09a Compare October 7, 2026 11:49
@AmosHersch
Amos Hersch (AmosHersch) marked this pull request as ready for review October 7, 2026 12:53
@AmosHersch
Amos Hersch (AmosHersch) requested a review from a team as a code owner October 7, 2026 12:53
Copilot AI balanced review requested due to automatic review settings October 7, 2026 12:53

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.

Copilot review overview

🟡 Changes recommended

A cancellation race can misreport a confirmed deletion, and HTTP 400 guidance is misleading.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds Fabric Core’s core_delete-item tool with explicit permanent-deletion opt-in and safe deletion confirmation.

Changes:

  • Implements validated soft/hard item deletion.
  • Registers and documents the destructive tool.
  • Adds comprehensive mocked, command, schema, and discovery tests.
File Description
tools/​Fabric.Mcp.Tools.Core/​src/​Commands/​ItemDeleteCommand.cs Adds command behavior and errors.
tools/​Fabric.Mcp.Tools.Core/​src/​FabricCoreSetup.cs Registers and guards the command.
tools/​Fabric.Mcp.Tools.Core/​src/​Models/​CoreJsonContext.cs Registers result serialization.
tools/​Fabric.Mcp.Tools.Core/​src/​Models/​ItemDeleteCommandResult.cs Defines deletion confirmation.
tools/​Fabric.Mcp.Tools.Core/​src/​Options/​ItemDeleteOptions.cs Defines deletion inputs.
tools/​Fabric.Mcp.Tools.Core/​src/​Services/​FabricCoreService.cs Implements DELETE request handling.
tools/​Fabric.Mcp.Tools.Core/​src/​Services/​FabricItemDeleteThrottledException.cs Adds throttling guidance.
tools/​Fabric.Mcp.Tools.Core/​src/​Services/​IFabricCoreService.cs Exposes deletion service API.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​Commands/​ItemDeleteCommandTests.cs Tests command behavior.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​FabricCoreSetupTests.cs Tests registration.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​ItemDeleteToolRegistrationTests.cs Tests MCP and CLI integration.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​ItemUpdateToolRegistrationTests.cs Extends read-only assertions.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​README.md Documents test coverage.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​Services/​FabricCoreServiceItemDeleteTests.cs Tests HTTP deletion behavior.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​TestSupport/​ItemDeleteTestData.cs Adds deletion fixtures.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​TestSupport/​ItemDeleteTrackingContent.cs Tracks response disposal.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​WorkspaceCreateToolRegistrationTests.cs Updates discovery expectations.
tools/​Fabric.Mcp.Tools.Core/​tests/​Fabric.Mcp.Tools.Core.Tests/​WorkspaceUpdateToolRegistrationTests.cs Extends read-only assertions.
servers/​Fabric.Mcp.Server/​tests/​Fabric.Mcp.Server.Tests/​Infrastructure/​ServerStartupTests.cs Verifies host discovery and schema.
servers/​Fabric.Mcp.Server/​README.md Documents deletion usage and safety.
servers/​Fabric.Mcp.Server/​docs/​e2eTestPrompts.md Adds tool-selection prompts.
servers/​Fabric.Mcp.Server/​changelog-entries/​amoshersch-fabric-delete-item.yaml Records the feature.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@AmosHersch

Copy link
Copy Markdown
Contributor Author

Superseded by #3887, which has merged into main with this layer's changes and the associated fixes. Closing this PR to avoid merging the same work again; its original review history is preserved.

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

Labels

server-Fabric.Mcp Microsoft Fabric MCP Server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants