Skip to content

refactor: structure TypeScript response dispatch - #160

Open
adamcavendish wants to merge 1 commit into
mainfrom
adamcavendish/structure-typescript-response-dispatch
Open

adamcavendish wants to merge 1 commit into
mainfrom
adamcavendish/structure-typescript-response-dispatch

Conversation

@adamcavendish

Copy link
Copy Markdown
Collaborator

Summary

Use structured sigil-stitch fragments for TypeScript Fetch response-status dispatch, lazy error payloads, and named/array JSON conversion callbacks. Keep types and imports semantic through final rendering.

Problem

Response dispatch and error throws still assembled dynamic source with formatted strings. That bypassed structured code composition and made import tracking and emission failures harder to preserve.

Behavior

Surface Result
Response selection Exact statuses precede wildcards, then the existing fallback.
Error payloads JSON, text, blob, and void decoding stay lazy and cached.
camelCase JSON responses Named and array conversion callbacks retain semantic imports.
Emission failures Invalid lowered types retain API context and original errors.
Source layout Long-type continuations use structural branch indentation.
JVM output expectations Closed-sum snapshots reflect normalized nested code composition.

Compatibility and boundaries

  • No generated-client API or wire-behavior change is intended. The new fixture covers exact, wildcard, default-only, success-only, and error-only response combinations in ordinary and camelCase configurations.
  • Existing TypeScript golden changes are limited to continuation indentation in three projects. The 50 changed JVM golden files and two adapter-render expectations differ only in whitespace; JVM generator logic and strict assertions are unchanged.
  • This PR does not change Cargo.toml or Cargo.lock, add dependency patches, or include any machine-local Cargo configuration.
  • Dependency prerequisite: these emissions and expectations require the upstream sigil-stitch code-composition fixes (d87abd2 and 455acfe), which are not in the currently published and locked 0.7.3 release. Without that fix, exact-render and golden checks fail. The released dependency prerequisite must be resolved before merging; fixed-checkout results must not be treated as validation of the unchanged published dependency.

- Replace formatted status branches, lazy error payloads, and JSON conversion
  callbacks with structured sigil-stitch blocks and semantic types and imports.
- Preserve response precedence, decoding behavior, generated APIs, wire payloads,
  and contextual emission errors while pinning response combinations and renders.
- Synchronize Java and Kotlin closed-sum snapshots and exact adapter expectations
  with normalized composition, changing only whitespace and keeping assertions.
- Require the upstream composition fixes without committing machine-local Cargo
  configuration or local-only dependency lockfile changes.
@adamcavendish
adamcavendish force-pushed the adamcavendish/structure-typescript-response-dispatch branch from 8862089 to 3fb8bbe Compare October 23, 2026 13:03
@adamcavendish
adamcavendish added this pull request to stack #162 October 23, 2026 13:26

This branch has not been deployed

No deployments
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