Repository navigation
Await enclave attestation in asynchronous command execution - #4887
cheenamalhotra wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Describe processing introduces a connection-ownership gap and duplicate async-count cleanup after write failures.
2 open issues
What changed in this PR
Integrates asynchronous enclave attestation into command execution using the delegate APIs from #4886. Key-store and enclave-package work remains separate in #4585.
Changes:
- Awaits enclave operations and forwards caller cancellation across shared execution paths.
- Updates cleanup and shares describe-encryption parsing.
- Adds deterministic regression tests, SQL-backed coverage, and scope documentation.
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient/tests/UnitTests/SimulatedServerTests/SqlCommandEnclaveAsyncTests.cs |
Tests provider dispatch, cancellation, cleanup, and retries. |
src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/ApiShould.cs |
Adds cold/warm-session execution coverage. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.Xml.cs |
Threads cancellation through XML execution. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.Reader.cs |
Integrates asynchronous preparation and retries. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.NonQuery.cs |
Updates cancellation forwarding and setup cleanup. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.Encryption.cs |
Awaits enclave operations and shares metadata parsing. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlCommand.cs |
Guards pending preparation and awaits retry invalidation. |
doc/always-encrypted-async.md |
Documents supported asynchronous scope and exclusions. |
Review effort: Balanced
priyankatiwari08
left a comment
There was a problem hiding this comment.
One concern on the new async attestation window.
Integrate asynchronous enclave session preparation, creation, and invalidation with command cancellation and retry cleanup. Preserve synchronous behavior and shared metadata parsing; add deterministic and SQL-backed regression coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
Give asynchronous describe processing sole ownership of its captured connection reservation. Preserve original write faults and cancellation after connection closure, retain describe mode through reconnect, and test delayed reader registration and setup failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
Preserve null-task completion for parameterless Always Encrypted commands without an enclave workflow. Isolate simulated enclave fixtures by application name so cached attestation options cannot leak across reused server endpoints. Add deterministic regressions for both paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
paulmedynski
left a comment
There was a problem hiding this comment.
Needs compile errors fixed.
Fix Parser namespace imports after the stack rebase and cover provider faults and cancellation after successful session invalidation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
Fixed in 7567986 by adding the Parser namespace import for RunBehavior and _SqlRPC. The net462 UnitTests build and 148 focused net10.0 tests in both Debug and Release pass locally; current-head CI is queued/running. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4887 +/- ##
==========================================
+ Coverage 67.94% 68.07% +0.13%
==========================================
Files 311 307 -4
Lines 45399 69079 +23680
==========================================
+ Hits 30845 47024 +16179
- Misses 14554 22055 +7501
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
priyankatiwari08
left a comment
There was a problem hiding this comment.
Minor concerns:
- No test covers the new async retry path in
RunExecuteReader(inline).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
There was a problem hiding this comment.
🔵 Needs a closer look
Async attestation and retry changes alter connection ownership and cleanup, but enclave-enabled SQL Server tests for cold/warm sessions, cancellation, retry, and connection reuse remain unrun, with current-head build/test checks still pending.
No open issues 🎉
Review effort: Balanced
Gate the simulated response until overlap assertions finish and return metadata-free DONE for the fixture's negotiated encryption capabilities. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 47a925b3-e0e6-43ed-9fb7-519060a206c2
There was a problem hiding this comment.
🔵 Needs a closer look
Async enclave changes affect connection ownership and cleanup, but end-to-end validation of retries, cancellation, and connection reuse against an enclave-enabled SQL Server remains unrun.
No open issues 🎉
Review effort: Balanced
priyankatiwari08
left a comment
There was a problem hiding this comment.
Looks good - no concerns.

Description
Integrate the async enclave delegate APIs from stack parent #4886 into command execution.
Key-store operations and enclave-package generation remain synchronous here; their async implementation stays in #4585.
Issues
Part of #3672. Stacked on #4886; merge that PR first, then retarget this PR to
main.Testing
Passed 123 focused unit tests (45 new command cases, 58 inherited enclave cases, 20 existing binding/batch cases):
Passed 30 existing command functional tests:
Both builds passed with 0 warnings/errors:
git diff --checkpassed. Server-backed tests were not run: no reachable enclave-enabled SQL Server was available. Discovery listed the new test but emitted connection-refused errors from other server-dependent theories:Guidelines
Please review the contribution guidelines before submitting a pull request: