Phase 2.5: add state-aware SDK wire-type conformance#568
Open
MGudgin wants to merge 1 commit into
Open
Conversation
8d1384b to
8fab0c0
Compare
122aa69 to
c2fa61b
Compare
8fab0c0 to
1ecc244
Compare
c2fa61b to
ab4b36b
Compare
1ecc244 to
f7eca9b
Compare
ab4b36b to
b529476
Compare
dfee7f5 to
46a72d2
Compare
Base automatically changed from
user/gudge/versioning_phase2c_optC_rustemit
to
main
June 26, 2026 18:24
This PR adds a compile-time conformance oracle for the SDK's state-aware lifecycle types, extending the one-shot wire-conformance coverage to the lifecycle surface so a change to the state-aware wire model that the SDK forgets to mirror fails CI instead of drifting silently. Details: - Add sdk/tests/unit/wire-conformance-state-aware.test.ts: type-level assertions that the public state-aware types in sdk/src/state-aware-types.ts conform to the generated wire defs - the Phase and IsolationConfigurationId enums, the Entra user bundle (IsolationUser), and the per-phase IsolationSessionPhase field set - checked in both directions (public->wire and wire->public) so a new field on either side is caught. The per-phase wire surface is DERIVED from the real public phase configs (the union of their keys minus the lifted version/filesystem/process fields) rather than restated, so a newly exposed public phase field cannot bypass the oracle. The per-phase configs are asserted to reuse the one-shot public leaf types (ProcessConfig / FilesystemConfig). - Extract the shared assertion helpers into sdk/tests/unit/conformance-helpers.ts and reuse them from both the one-shot and state-aware tests. OnlyInPublic strips the wire-side index signature so public-only key checks are non-vacuous against open generated objects (which carry `[k: string]: unknown`); this also makes the one-shot oracle's open-object key checks meaningful. - Wire the new test into the SDK unit-test run list and document both conformance surfaces in docs/schema-codegen.md. Tests: - cd sdk && npm test -> 185 (incl. both conformance oracles). - Negative probes confirm teeth on every drift surface: a widened sizing enum, a Phase change, a new wire or public user-bundle field, and a new wire or public per-phase field each make the corresponding assertion fail to compile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Generated-with: claude-opus-4.8
46a72d2 to
b63a7a1
Compare
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.
Summary
This PR adds a compile-time conformance oracle for the state-aware SDK types, extending the one-shot wire-conformance coverage to the lifecycle surface so a change to the state-aware wire model that the SDK forgets to mirror fails CI instead of drifting silently.
What changed
sdk/tests/unit/wire-conformance-state-aware.test.ts: type-level assertions that the public state-aware types insdk/src/state-aware-types.tsconform to the generated wire defs — thePhaseandIsolationConfigurationIdenums, the Entra user bundle (IsolationUser), and the per-phaseIsolationSessionPhasefield set — with drift checked in both directions (public→wire and wire→public) so a new optional wire field the SDK omits is also caught. The per-phase configs are asserted to reuse the one-shot public leaf types (ProcessConfig/FilesystemConfig) rather than re-deriving them.sdk/tests/unit/conformance-helpers.tsand reuse them from both the one-shot and state-aware conformance tests.docs/schema-codegen.md.Verification
cd sdk && npm test→ 185 (incl. both conformance oracles)Phasechange, a newIsolationSessionPhasefield, and a new optional user-bundle field each make the corresponding assertion fail to compile (drift detected).Microsoft Reviewers: Open in CodeFlow