Skip to content

Follow the tightened script request bodies in gateway 0.7.0 - #102

Draft
bburda wants to merge 1 commit into
mainfrom
fix/gateway-070-script-bodies
Draft

Follow the tightened script request bodies in gateway 0.7.0#102
bburda wants to merge 1 commit into
mainfrom
fix/gateway-070-script-bodies

Conversation

@bburda

@bburda bburda commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Summary

The gateway 0.7.0 spec describes both script request bodies instead of leaving them open. The upload body declares a required file part with optional metadata; the execution body is ScriptExecutionRequest, with execution_type required. Two casts in api-dispatch.ts existed only because those bodies used to be untyped, and they stop compiling against the 0.7.0 client.

The execution cast is gone. StartScriptExecutionRequest already has the same shape as the generated ScriptExecutionRequest, so the body passes straight through, and if the two ever drift apart it becomes a type error here.

The upload keeps a cast, because FormData is a DOM interface and can never be assignable to a generated object type. It now names the declared body type instead of Record<string, unknown>, so a change to the parts is caught at compile time rather than as a 400 at runtime.

No request path changed between 0.6.0 and 0.7.0, so nothing else is affected.

This is a draft on purpose. The client pin moves to ^0.7.0, which is not published yet, so package-lock.json still records 0.6.0 and npm ci will fail until the release exists. Run npm install to refresh the lock once @selfpatch/ros2-medkit-client-ts 0.7.0 is out, then this is ready.


Issue


Type

  • Bug fix
  • New feature
  • Breaking change
  • Documentation only

Testing

Verified against a gateway built from the 0.7.0 release branch, with the client regenerated from that gateway's exported spec and installed locally.

  • npm run typecheck and npm run build are clean. Before the change they failed with four errors in src/lib/api-dispatch.ts.
  • npm run lint is clean.
  • npm test passes 682 tests in 34 files. Worth noting that it also passed before the change, because vitest does not typecheck, so the unit suite is not what catches this.
  • npx playwright test against the live 0.7.0 gateway passes 16 tests, 3 skipped (the rosbag project needs its own stack). This covers the upload, run and delete path and the execution path, which are the lines the casts sit on.

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Docs were updated if behavior or public API changed

The gateway now describes both script request bodies instead of leaving
them open. The upload body declares a required `file` part with optional
`metadata`; the execution body is `ScriptExecutionRequest`, with
`execution_type` required. Two casts that existed only because those
bodies used to be untyped no longer compile against the generated types.

The execution cast goes away entirely - StartScriptExecutionRequest
already mirrors the generated shape, so the body passes through and any
future divergence between the two surfaces as a type error. The upload
keeps a cast, because FormData is a DOM interface and can never be
assignable to a generated object type, but it now names the declared body
instead of `Record<string, unknown>`, so a change to the parts is caught
at compile time rather than as a 400 at runtime.
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.

Follow the tightened script request bodies in gateway 0.7.0

1 participant