Skip to content

test(sdk): enforce SDK/TUI high-level parity (#1471) - #1917

Merged
samuv merged 7 commits into
plan/sdk-high-level-parity-coveragefrom
impl/sdk-high-level-parity-coverage
Sep 25, 2026
Merged

samuv merged 7 commits into
plan/sdk-high-level-parity-coveragefrom
impl/sdk-high-level-parity-coverage

Conversation

@samuv

@samuv samuv commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Complete #1471 against proposed Plan / Interface PR #1916.

  • Classify all 86 public RPC descriptors in a test-only SDK inventory. The 84 covered rows name a public operation that invokes the exact descriptor. StreamSessionEvents and StreamSessionLive have separate raw-only rationales. The gate detects new descriptors and missing invocation witnesses.
  • Classify all 31 TUI builtins in a separate Go test: 24 SDK-backed, three application/presentation-only, three operator/configuration-only, and one debug-only. Eight declarations absent from the separate known-name registry remain unchanged.
  • Add Session.guardrailCoverage() and Session.guardrailReviewDetail() over the new gRPC-only guardrail RPCs, with session affinity and existing HTTP unsupported-feature behavior.
  • Add runnable public-export examples for session lifecycle, capability discovery, and MCP workspace enrollment. Offline end-to-end tests also execute the existing MCP authorization example.
  • Update SDK guidance, examples inventory, generated API reference, and living architecture.

Development stage

  • Implementation — Stacked on a proposed Plan / Interface PR for joint review under the directing user's explicit review-sequence waiver. Plan approval and merge precede this PR's merge.

Contract linkage

Interface conformance

Two additive public TypeScript Session methods invoke existing gRPC descriptors. There is no protobuf, exported Go, CLI, configuration, event, persistence, or TUI dispatch change. API Extractor reports and generated public reference are updated. The SDK release workflow generates the changelog entry.

Issue relationship

Closes #1471.

Type of change

  • Documentation/process
  • Other: SDK API methods, high-level coverage gates, and runnable examples

Test plan

  • task sdk:lint sdk:typecheck sdk:test sdk:examples:typecheck: 347 SDK unit tests passed.
  • task sdk:e2e: 35 offline tests passed, including all four example entry points.
  • task sdk:api:check sdk:docs:check: passed.
  • task docs and task site:build: passed.
  • task lint: passed across repository modules.
  • Focused Scenario 8 race tests: 20 local repetitions passed. The PR's Linux CI jobs are the full race-suite gate for this head.
  • Plan-specific ac-trace: 11 acceptance criteria, zero missing proofs. Strict landed-plan gating awaits plan merge.

Changes

File Change
sdk/typescript/test/high-level-surface.test.ts Exact descriptor classification and public-invocation witness gate.
cmd/mecatui/ui/sdk_high_level_parity_test.go TUI builtin inventory and declaration-drift gate.
sdk/typescript/src/client.ts, sdk/typescript/test/guardrails.test.ts Guardrail methods and gRPC/HTTP proofs.
sdk/typescript/examples/, sdk/typescript/e2e/ Public-export workflow examples and offline execution proofs.
cmd/mecated/rawpipe_unix_test.go Make the existing lifetime-pipe test fixture pollable so its watcher reliably exits after Close on Linux.
.github/workflows/ci.yml Allow the macOS storage job to finish after a slow Go cache restore.
user-docs/building/typescript-sdk/index.md, docs/architecture.md Guidance and independent-client boundary.

User-facing change

SDK developers gain two session guardrail diagnostic methods and four documented runnable workflows. The two low-level event streams remain raw-only. The SDK does not import TUI internals.

Special notes for reviewers

Plan PR #1916 is unmerged; this implementation must wait for its approval and merge.

The 84-row invocation gate inspects direct SDK source calls; it does not execute every public method and branch. Recording-transport tests exercise the two indirect paths and both new guardrail methods. AC2.2 asks reviewers to inspect the TUI-to-SDK operation mapping; the Go gate enforces the builtin key set and category shape.

CI's existing lifetime-pipe test timed out once in the Linux race shard and passed on retry. The fixture now makes its read descriptor pollable before adoption, so Close can wake the blocked watcher. Its Scenario 8 race tests passed locally across 20 repetitions; the new CI run verifies the Linux result.

The macOS storage job then hit its 15-minute limit after a 10-minute Go cache restore. The job timeout is now 30 minutes; its tests and FreeBSD cross-build are unchanged.

@samuv
samuv added this pull request to stack #1918 September 25, 2026 08:46
@samuv samuv changed the title impl/sdk high level parity coverage [Implementation] SDK/TUI high-level parity coverage (#1471) Sep 25, 2026
@samuv
samuv marked this pull request as ready for review September 25, 2026 08:48
@samuv samuv changed the title [Implementation] SDK/TUI high-level parity coverage (#1471) test(sdk): enforce SDK/TUI high-level parity (#1471) Sep 25, 2026
@samuv
samuv force-pushed the impl/sdk-high-level-parity-coverage branch from 844ad94 to 5583070 Compare September 25, 2026 08:56
@samuv samuv self-assigned this Sep 25, 2026
@samuv
samuv force-pushed the impl/sdk-high-level-parity-coverage branch 2 times, most recently from 79e74a5 to e6b77bb Compare September 25, 2026 11:24
@samuv
samuv force-pushed the impl/sdk-high-level-parity-coverage branch from e6b77bb to b0f2870 Compare September 25, 2026 12:24
Add runnable workflow examples and document the server, SDK, and application boundary for #1471.

Signed-off-by: Samuele Verzi <[email protected]>
Fail closed on unknown TUI builtin names, cover indirect public SDK paths, and clarify mixed TUI workflows for #1471.

Signed-off-by: Samuele Verzi <[email protected]>
Keep the descriptor and TUI builtin inventories aligned with the direct and broker MCP refresh paths after rebasing onto main.

Co-Authored-By: Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Cover the two upstream guardrail RPCs with public session methods, classify the new TUI builtin, and refresh SDK reference output.

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the impl/sdk-high-level-parity-coverage branch from d40dc3c to 86073aa Compare September 25, 2026 12:47

@peppescg peppescg 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.

Approving: none of the points below are blocking. As the PR itself says, it must still wait for Plan/Interface PR #1916 to be approved and merged.

What I checked

  • RPC gate: the classification set must exactly equal the HarnessService and ScheduleService descriptors. The AST witness counts only unary/stream calls inside the declared public member, and a dedicated test proves that a bare descriptor reference does not count. The two indirect paths are proven against a recording transport. The gate fails closed rather than passing vacuously.
  • Guardrail methods: both carry session affinity and caller headers. On HTTP they raise UnsupportedFeatureError without sending a request. Returning the generated response types matches the existing agents.list, learnedSkills.* and dreamPlans.* precedent.
  • TUI table: all 25 SDK operation names in it exist in the API report. effort → Client.sessions.fork is correct, since /effort applies the change through a fork-resume (ADR 0068).
  • Boundaries: the SDK has no TUI imports, and builtin dispatch is unchanged.

Optional follow-ups

  1. The lifetime-pipe fixture now differs from production. rawPipe makes the read end nonblocking so Close wakes the watcher on Linux. Production adoptLifetimePipe (cmd/mecated/daemonhosting.go) adopts the inherited descriptor as-is. A pipe from Node spawn is normally blocking, so there the watcher goroutine lingers until EOF or process exit. Shutdown does not hang, because Close still returns. The test therefore now asserts a property that production doesn't have for that descriptor kind. Please either document that the test covers only pollable descriptors, or move SetNonblock into adoptLifetimePipe (but not the stdin mode, since stdin is shared). This change also looks out of scope for an SDK-parity PR.
  2. SDK names in the TUI table aren't checked mechanically. AC2.2 is inspection-only, so a renamed SDK method would leave a stale row without failing CI. A cheap guard would assert that each sdkOperation appears in sdk/typescript/etc/mecatl-sdk.api.md.

Nits

  • TestSDKHighLevelParity_Scenario2_BuiltinDispatchUnchanged pins 8 user-facing builtins as absent from the known-name registry. Those include dream, reflect and guardrails. The test freezes an existing inconsistency rather than surfacing it; this may deserve its own issue.
  • invocationPath maps any SessionImpl method to Session.<name>, including private ones. It's harmless in practice, because the row's operation is type-checked against the public Session interface.

@samuv
samuv merged commit e5039f8 into main Sep 25, 2026
37 checks passed
@samuv
samuv deleted the impl/sdk-high-level-parity-coverage branch September 25, 2026 13:19
This was referenced Sep 25, 2026
jbeda added a commit that referenced this pull request Sep 25, 2026
…mit-coauthor-guidance

* origin/main: (32 commits)
  docs: plan optional native Kubernetes execution provider (#1579)
  feat(mecatui): restore session status metrics (#1891)
  docs(plan): bound agent inventory viewport (#1946)
  docs: include user-docs in matlatl and use local documentation links (#1934)
  feat(mecatui): bound sessions inventory (#1944)
  feat(studio): show session delegation activity (#1907)
  docs(plan): define Studio session activity (#1885)
  Release TypeScript SDK v0.4.0 (#1940)
  Release v0.0.41 (#1941)
  docs(mecatui): plan bounded sessions inventory (#1906)
  feat(studio): add exact plan control and authorization review prerequisite (#1909)
  test(app): eliminate real ToolHive probe deadline wait (#1937)
  docs(plan): define Studio chat approvals and exact plan control (#1888)
  test(sdk): enforce SDK/TUI high-level parity (#1471) (#1917)
  docs(plan): propose SDK high-level parity coverage (#1471) (#1916)
  docs: improve gRPC schema table readability (#1842)
  test(app): eliminate real waits in durable learning tests (#1933)
  feat(studio): align chat transcript and composer (#1886)
  docs(plan): define Studio chat transcript and composer (#1880)
  feat: correlate provider requests with the root session (#1883)
  ...
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.

SDK/TUI: add high-level parity coverage, documentation, and examples

2 participants