Skip to content

feat(sdk): add native Deno integration with shared gRPC (post-v0.1.0) - #1423

Merged
samuv merged 12 commits into
mainfrom
t3code/assess-deno-typescript-sdk
Sep 14, 2026
Merged

samuv merged 12 commits into
mainfrom
t3code/assess-deno-typescript-sdk

Conversation

@samuv

@samuv samuv commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add native Deno integration using the same ConnectRPC gRPC transport as Node and Bun.

Deno is excluded from v0.1.0. No later release version is assigned. Do not merge or
publish this integration as part of v0.1.0.

  • @stacklok-oss/mecatl-sdk/deno provides gRPC connect(), native Deno.Command-backed
    spawn(), and query(). The root import retains HTTP/SSE.
  • Share gRPC connection construction, credentials, diagnostics, and transport disposal with
    Node/Bun. Deno returns ordinary Client; callback tools and path media remain Node/Bun-only.
  • Spawn one ephemeral loopback TCP gRPC listener with HTTP disabled. Validate the ready
    document's transport, address, and captured PID before dialing.
  • Preserve native stdin-EOF parent liveness, bounded signal fallbacks, stderr redaction,
    and private runtime-directory cleanup. Deno does not use the Node process launcher.
  • Qualify the packed package over TCP, TLS, and Unix sockets at Deno 2.9.3 and current 2.x,
    including cancellation, transport disposal, and parent-exit cleanup.

Development stage and contract

Implementation, with the directing user's delivery exception. On 2026-09-14, the user
approved shared ConnectRPC transport and waived a separate Plan / Interface PR for this
amendment. No separately merged plan PR or approved commit baseline is claimed.

  • Acceptance contract
  • ADR 0341
    supersedes ADRs 0339 and 0340 only for their HTTP-only / Node-compatibility exclusions.
    Their accepted decision text is preserved. Deno's numbers now avoid main's 0337 and 0338.
  • Interfaces match approved contract: Yes. No protobuf, exported Go API, or persistence
    change. Existing root HTTP/SSE and Node/Bun imports require no migration.
  • Non-material corrections: shared HTTP/2 options use SecureClientSessionOptions, allowing
    typed TLS nodeOptions: { ca }; the existing pinned @types/node dependency is published,
    and its declaration reference is preserved for native production-only Deno consumers.
  • The acceptance plan stays in-progress while the unrelated aggregate gates below fail.
    Public transport type names are unchanged; no neutral aliases were added.

Review fixes

Addressed the review
in three commits after reviewed head 3c89ed5d7:

  • Correct the owning local-daemon guide's stale HTTP/SSE troubleshooting wording to gRPC,
    and include deno.md in generated-reference authoring guidance.
  • Add actual Deno launch-argument checks and inspect the spawned daemon's ready.json
    for HTTP-listener absence. An HTTP-enabled packed-artifact mutation fails that native assertion.
  • Test EOF at 0 ms, SIGTERM at 3000 ms, SIGKILL at 6000 ms, and the final status-wait bound
    at 7000 ms, including startup-failure cleanup, diagnostics, stream locks, and timer release.
  • Test exact 64 KiB capture, 4 KiB report selection, partial-line removal, whole-line credential
    redaction in errors/diagnostics, and each runtime's BOM/malformed-UTF8 decoding behavior.
  • Extract Node-free internal spawn helpers while keeping runtime process ownership and timers
    separate. Replace API-doc entrypoint duplication with a metadata table and loops.
    Generated API pages remain byte-identical; public API reports are unchanged.

The requested landed transition is intentionally not applied: the process requires every
gate to pass first. Optional neutral transport aliases were declined by the directing user.

Rebase and CI repair

Rebased onto origin/main at 384ee336a76a356a6ca6a79e8f805134675e91d9.
The later main commit d10e84589 changes only Redis tests and does not affect these fixes.

The failed Node 22/24 and docs-site jobs were API-report drift: main added watch_capacity
to the shared error-code tuple, but this branch's Deno API report lacked it. Regenerating the
report fixes the mismatch without a runtime change. The docs job failed because main claimed
ADR 0337, then 0338 while verification was running. Deno's ADRs are now 0339-0341; their
accepted Decision sections remain byte-identical. Main's rewritten daemon guide is preserved,
including this branch's Deno stdin-lifetime instructions.

Post-rebase checks passed: 247 SDK tests, SDK lint/type checking/API reports/pack,
task docs (401 documents, 3687 references, no errors), site build, and daemon tests.
Native Deno qualification passed at 2.9.3 and 2.9.6 against the current same-checkout binary.
All four previously failing hosted jobs now pass: Node 22 SDK, Node 24 SDK, Docs (matlatl),
and User docs (Docusaurus build). Other hosted CI is still running.
The earlier full Go/lint reruns were stopped when main moved;
their partial output is not claimed as a pass on this final base.

Verification at the prior review checkpoint

Passed locally on the review repair:

  • SDK lint, type checking, and 245/245 unit tests.
  • API compatibility reports, build/pack, and 5/5 checks of the exact selected tarball,
    including TypeScript 5.7 and 6 declaration consumers.
  • 30/30 Node/Bun offline wire tests.
  • Full Go suite, including engine/provider standalone proofs; Taskfile build and offline demo.
  • task docs (398 documents, 3659 references, no link/anchor/ambiguity/orphan/reachability
    failures), documentation site build, and all four Deno acceptance proof references.
  • Full packed-artifact qualification at Deno 2.9.3 and 2.9.6: stable type checking,
    native spawn, stream/attach, query, TCP, trusted/untrusted TLS, Unix sockets, active cancellation,
    stream/watch termination, real HTTP/2 session disposal, and parent-exit stdin-EOF cleanup.

Mutation checks failed at the intended assertions for enlarged capture/report bounds, retained
partial lines, removed redaction, changed signal order, extended/unbounded final SIGKILL wait,
enabled HTTP listener, and changed runtime decoders. All production mutations are restored;
the native listener mutation used a separate scratch artifact.

Independent Spec, Standards, Test adequacy, Security, Architecture, Library reuse, and Duplication
reviews have no remaining findings. One test-adequacy finding about the final SIGKILL wait was
fixed in a fresh test-only repair and independently rechecked.

PANEL: ship_blockers=0 important=0 advisory=0 reviewer_failures=0

Known aggregate failures, reproduced in unchanged code outside this repair:

  • task lint on macOS: internal/adapter/privatefile/update_unix.go:224, gosec G115 for
    converting stat.Dev from int32 to uint64 (main feat: unify provider configuration and Mecatui commands #1448).
  • task ac-trace-strict: docs/acceptance/callmcpwithquery-broker-support.md has status
    proposed, unsupported by actrace v0.0.3. The Deno plan's four references resolve.

Documentation and release scope

The canonical SDK guides, examples, generated references, architecture, resource inventory,
and production-readiness tracker describe the same runtime boundary. The post-v0.1.0 deferral
is unchanged. Deno Deploy, Deno 3, callback tools, and filesystem media helpers remain out of scope.

Directing-user request; no issue assigned. Only a human may merge. This PR does not publish,
tag, or assign a release.

@samuv samuv self-assigned this Sep 11, 2026
@samuv
samuv marked this pull request as draft September 11, 2026 16:46
@samuv
samuv force-pushed the t3code/assess-deno-typescript-sdk branch from 1c7b305 to 2dffba3 Compare September 11, 2026 16:51
@samuv samuv changed the title feat(sdk): add native Deno process integration feat(sdk): add native Deno process integration (post-v0.1.0) Sep 11, 2026
@samuv
samuv force-pushed the t3code/assess-deno-typescript-sdk branch from 2dffba3 to 09e0a95 Compare September 14, 2026 08:26
samuv added a commit that referenced this pull request Sep 14, 2026
Record the directing user's explicit separate-plan waiver for draft PR #1423. Keep Deno excluded from v0.1.0 with no later version assigned.

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

Signed-off-by: Samuele Verzi <[email protected]>
@samuv samuv changed the title feat(sdk): add native Deno process integration (post-v0.1.0) feat(sdk): add native Deno integration with shared gRPC (post-v0.1.0) Sep 14, 2026
@samuv
samuv marked this pull request as ready for review September 14, 2026 10:24
samuv added a commit that referenced this pull request Sep 14, 2026
Record the directing user's explicit separate-plan waiver for draft PR #1423. Keep Deno excluded from v0.1.0 with no later version assigned.

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

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the t3code/assess-deno-typescript-sdk branch from 06d52e4 to 4b4bb42 Compare September 14, 2026 11:54
samuv added a commit that referenced this pull request Sep 14, 2026
Record the directing user's explicit separate-plan waiver for draft PR #1423. Keep Deno excluded from v0.1.0 with no later version assigned.

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

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the t3code/assess-deno-typescript-sdk branch from 4b4bb42 to 3c89ed5 Compare September 14, 2026 14:38
@kantord

kantord commented Sep 14, 2026

Copy link
Copy Markdown
Member

Panel review — PR #1423

Fixed point: PR #1423 against main
Diff: 131 files, 9,587 insertions, 1,377 deletions


Spec — does this implement what was asked?

Source: PR body, docs/acceptance/sdk-typescript-deno.md, ADRs 0337–0339

  • [advisory · Wrong] user-docs/building/typescript-sdk/local-daemon.md:178-180 still says Deno users grant --allow-net=127.0.0.1 “for the local HTTP and SSE connection.” The spec requires shared ConnectRPC gRPC docs (docs/acceptance/sdk-typescript-deno.md:85-86) and local spawn over loopback TCP gRPC with HTTP disabled (docs/adr/0339-typescript-sdk-deno-grpc.md). This is stale wording for the implemented Deno local path.

Standards — does this follow project conventions?

Sources read: AGENTS.md, docs/development-process.md, user-docs/_README.md, relevant ADR/design docs
Tooling-skipped: Go/TS compiler, Biome, API Extractor, markdown link checker, golangci-lint

  • [important · Violation] docs/acceptance/sdk-typescript-deno.md:6 and docs/acceptance/README.md:307-310 leave the plan at in-progress. For an implementation candidate after gates, the process says the PR diff should carry the proposed transition to landed (docs/development-process.md:55-57).

  • [important · Violation] Same stale doc issue as Spec: user-docs/building/typescript-sdk/local-daemon.md:178-180 says “local HTTP and SSE connection” even though the Deno path is now gRPC. User-facing behavior docs must be accurate in the same PR.

  • [advisory · Violation] user-docs/reference/typescript-sdk-api/deno.md:12 adds a generated Deno reference page, but user-docs/_README.md:134-140 still documents only core.md and node.md as generated TypeScript SDK references. Update the authoring contract so future docs work regenerates/checks deno.md.


Test adequacy — do the tests independently prove the contract?

  • [important] AC1.2 says Deno spawn() starts one loopback TCP gRPC listener with HTTP disabled. The real spawn e2e asserts transport === "grpc" and loopback grpcAddress (sdk/typescript/e2e/deno.e2e.ts:86-93), but only the separate remote fixture asserts http_address === undefined (sdk/typescript/e2e/deno-grpc.e2e.ts:167-170). Dropping --http-addr "" from spawn() could still pass while opening HTTP.

  • [important] AC1.2/security contract requires bounded signal fallbacks. Deno tests cover stdin-close success and no kill on readiness failures (sdk/typescript/test/deno-spawn.test.ts:74-89) plus parent-exit cleanup, but not a stubborn child that ignores stdin EOF/SIGTERM and requires SIGTERM→SIGKILL.

  • [important] AC1.2/security contract requires bounded, redacted stderr. Deno spawn tests use empty stderr (sdk/typescript/test/deno-spawn.test.ts:30), so a Deno-specific regression leaking secret-shaped stderr or returning an unbounded tail would not fail.


Domain — what do the specialist reviewers say?

Panel: secure-code-reviewer, software-architect, devops-expert, library-reuse-reviewer, code-duplication-reviewer

Ship-blockers (0)

None.

Mechanical fixes (2)

  • [important · Medium] sdk/typescript/src/deno-spawn.ts:137-213 and sdk/typescript/src/deno-spawn.ts:403-479 duplicate pure spawn plumbing from sdk/typescript/src/spawn.ts:197-380: bounded byte tail, SDK-owned flag validation, stderr redaction/startup diagnostics, and polling helpers.
    Sources: library-reuse-reviewer
    Action: factor a Node-free spawn-common.ts used by both spawners. Estimated net: -90 lines.

  • [advisory · Low] sdk/typescript/scripts/generate-api-docs.mjs:376-445 now has a third hand-coded core/node/deno path→load→validate→render→stdout sequence.
    Sources: code-duplication-reviewer
    Action: replace with an entrypoint table loop. Estimated net: -20 lines.

Judgement calls (1)

  • [advisory · Low] The Deno public API exports Node-named shared transport types: NodeTransportOptions / NodeTransportCommonOptions from sdk/typescript/src/deno.ts:10-20, backed by sdk/typescript/src/node-transport.ts:12-19, and exposed in generated Deno docs at user-docs/reference/typescript-sdk-api/deno.md:22-24.
    Sources: software-architect
    Recommendation: consider neutral public aliases like GrpcTransportOptions for ./deno before Deno’s first supported release.

Security / DevOps

No blocker, important, or advisory findings from security or DevOps reviewers.

Gaps

None.


Summary

  • Spec axis: 1 finding — 0 blocker, 0 important, 1 advisory
  • Standards axis: 3 findings — 0 blocker, 2 important, 1 advisory
  • Test adequacy axis: 3 findings — 0 blocker, 3 important, 0 advisory
  • Domain axis: 3 findings — 0 blocker, 1 important, 2 advisory

Most important issue: test gaps around Deno local spawn’s HTTP-disabled listener, signal escalation, and stderr redaction coverage.

PANEL: ship_blockers=0 important=6 advisory=4 reviewer_failures=0

@samuv

samuv commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review in 3f13a3ba7, 2732bbf5a, and 4dc21a395.

  • Fixed the gRPC troubleshooting wording and Deno generated-reference authoring guidance.
  • Added Deno spawn HTTP-disabled argv and native ready-document assertions, full EOF/TERM/KILL
    timing including the final one-second wait, and bounded/redacted stderr error/diagnostic tests.
  • Extracted internal Node-free spawn helpers; process ownership, timers, and runtime decoders
    remain separate. The table-driven API-doc generator produces byte-identical Markdown.
  • Confirmed the new assertions fail under planted regressions, including an actual HTTP listener
    enabled in a separate packed artifact. All production mutations are restored.

Verification: 245 SDK tests, 30 Node/Bun wire tests, all 5 exact-package checks, full Deno
2.9.3/2.9.6 qualification, API/type/lint checks, full Go tests, docs/site, and offline demo pass.
The independent follow-up panel has no outstanding findings.

Two intentional dispositions: the plan stays in-progress because the documented unrelated
macOS G115 and strict-AC-tracing failures remain; the process permits landed only after all
gates pass. Public transport aliases are unchanged per the directing user's decision.

The PR description now reflects these fixes and verification. Deno remains excluded from v0.1.0,
with no later version assigned.

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

Signed-off-by: Samuele Verzi <[email protected]>
Record the directing user's explicit separate-plan waiver for draft PR #1423. Keep Deno excluded from v0.1.0 with no later version assigned.

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

Signed-off-by: Samuele Verzi <[email protected]>
Keep native Deno.Command ownership, qualify TCP/TLS cancellation and transport disposal in the packed runtime gate, and expose TLS HTTP/2 options without adding callback-tool authority.

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

Signed-off-by: Samuele Verzi <[email protected]>
Align the acceptance index with the in-progress contract and document Deno's scoped Unix-socket network grant.

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

Signed-off-by: Samuele Verzi <[email protected]>
Require real HTTP/2 session closure while the daemon stays alive, drain active streams to termination, and grant only the fixture Unix socket scope. Publish and preserve the existing Node declaration dependency so native Deno validates transport options.

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

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
Co-Authored-By: Codex <[email protected]>

Signed-off-by: Samuele Verzi <[email protected]>
@samuv
samuv force-pushed the t3code/assess-deno-typescript-sdk branch from 4dc21a3 to 338d836 Compare September 14, 2026 16:14
@samuv

samuv commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto origin/main at 384ee336a and pushed 338d836e5 with exact-head
force-with-lease protection.

Fixed the CI failures:

  • Regenerated the Deno API report for main's new shared watch_capacity error code.
  • Resolved the new ADR collisions; Deno now uses 0339-0341. Accepted decision text is unchanged.
  • Preserved main's rewritten daemon guide together with the Deno stdin-lifetime instructions.

All four previously failing CI jobs now pass: Node 22 SDK, Node 24 SDK, Docs (matlatl),
and User docs (Docusaurus build). Local checks passed 247 SDK tests, SDK/API/package checks,
docs/site, daemon tests, all four Deno acceptance references, and native Deno 2.9.3/2.9.6
qualification. Remaining hosted jobs are still running; no blanket all-CI-green claim.

Deno remains excluded from v0.1.0, with no later release version assigned.

@kantord kantord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked the latest head and the prior panel findings are addressed.

Confirmed fixes:

  • Deno local-daemon docs now say gRPC instead of HTTP/SSE.
  • Generated Deno API reference is included in the authoring guidance.
  • Deno spawn now has direct coverage for HTTP-disabled launch args / ready document, EOF→SIGTERM→SIGKILL cleanup timing, final status-wait bound, and bounded/redacted stderr.
  • Shared spawn helpers and table-driven API-doc generation address the duplication findings.
  • Targeted checks passed locally, and the PR check suite is green aside from intentionally skipped jobs.

Approving. The only noted caveat is the intentionally retained in-progress plan status, which I’m treating as a maintainer/process decision rather than a code blocker.

@samuv
samuv merged commit b1ec0ae into main Sep 14, 2026
35 checks passed
@samuv
samuv deleted the t3code/assess-deno-typescript-sdk branch September 14, 2026 16:44
This was referenced Sep 14, 2026
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.

2 participants