Skip to content

Phase 2.5: add state-aware SDK wire-type conformance#568

Open
MGudgin wants to merge 1 commit into
mainfrom
user/gudge/versioning_phase2_5_state_aware_conformance
Open

Phase 2.5: add state-aware SDK wire-type conformance#568
MGudgin wants to merge 1 commit into
mainfrom
user/gudge/versioning_phase2_5_state_aware_conformance

Conversation

@MGudgin

@MGudgin MGudgin commented Jun 25, 2026

Copy link
Copy Markdown
Member

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

  • 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 — 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.
  • Extract the shared assertion helpers into sdk/tests/unit/conformance-helpers.ts and reuse them from both the one-shot and state-aware conformance tests.
  • Wire the new test into the SDK unit-test run list and document both conformance surfaces in docs/schema-codegen.md.

Verification

  • cd sdk && npm test → 185 (incl. both conformance oracles)
  • Negative probes confirm teeth: a widened sizing enum, a Phase change, a new IsolationSessionPhase field, and a new optional user-bundle field each make the corresponding assertion fail to compile (drift detected).
Microsoft Reviewers: Open in CodeFlow

@MGudgin MGudgin requested a review from a team as a code owner June 25, 2026 04:40
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2_5_state_aware_conformance branch from 8d1384b to 8fab0c0 Compare June 25, 2026 14:18
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2c_optC_rustemit branch from 122aa69 to c2fa61b Compare June 25, 2026 14:19
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2_5_state_aware_conformance branch from 8fab0c0 to 1ecc244 Compare June 25, 2026 14:20
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2c_optC_rustemit branch from c2fa61b to ab4b36b Compare June 25, 2026 16:49
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2_5_state_aware_conformance branch from 1ecc244 to f7eca9b Compare June 25, 2026 16:50
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2c_optC_rustemit branch from ab4b36b to b529476 Compare June 26, 2026 15:24
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2_5_state_aware_conformance branch 2 times, most recently from dfee7f5 to 46a72d2 Compare June 26, 2026 15:44
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
@MGudgin MGudgin force-pushed the user/gudge/versioning_phase2_5_state_aware_conformance branch from 46a72d2 to b63a7a1 Compare June 26, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant