Skip to content

FM-PS-LYNX-014 T1+T4: adapters own Response; name NDJSON Accept policy - #44

Merged
darekaze merged 3 commits into
mainfrom
drkz/t1-t4-transport-ownership-9c22
Sep 10, 2026
Merged

darekaze merged 3 commits into
mainfrom
drkz/t1-t4-transport-ownership-9c22

Conversation

@djwok

@djwok djwok commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Implements T1 + T4 only from issue #34 on current main. Does not include T2 / ADR-0004 / LynxFetchModule streaming-fallback deletion, T3/NativeSql, or N1–N4.

T1 — Transport adapters own their Response

Each SyncStreamTransport interprets its own wire shape and returns a finished Response:

  • NativeHttpFetch maps NativeHttpFetchEnvelope (streamingId vs idle-complete body / bodyBase64)
  • LynxFetchModule maps LynxFetchSuccessPayload including lynxExtension.streamingId
  • HostFetch keeps the identifier Fetch body and does not inspect Response.lynxExtension.streamingId

One internal constructor: syncStreamResponse({ bytes } | { streamingId } | { streamingFallback: true }). The fallback variant is the existing nameless GlobalEventEmitter path (left for the stacked T2 agent).

enterEarlyCapture() is removed from LynxRemote. Only NativeHttpFetch owns early capture (preserves #36 abort / retirement / multi-emitter / overflow).

response.ts exports shrink to three functions:

  1. syncStreamResponse
  2. stabilizeStreamingResponse
  3. stabilizeJsonResponse

Plus the constructor init type SyncStreamResponseInit. Dropped from oxlint.config.ts ignore: bytes.ts, events.ts, response.ts.

T4 — Name NDJSON header policy

headerMap is a copy-only shape conversion. preferNdjsonAccept (BSON Accept → NDJSON, default Accept-Encoding: identity) runs at syncStreamRequestFromFetch. Behavior is unchanged for /sync/stream requests.

Tests

Verification

  • pnpm typecheck — pass
  • pnpm lint — pass
  • pnpm test — 112/112 pass
  • make test — native SQL RPC + shared NDJSON fixture checks pass

Paste-ready comment for #34

GitHub issue write access was not available from this agent (gh issue view 34 / issue list both 403). Suggested comment:

T1 + T4 implemented on current main: #44

T1: Each SyncStreamTransport returns a finished Response and owns its wire shape. syncStreamResponse({bytes}|{streamingId}|{streamingFallback}) is the one constructor. enterEarlyCapture lives only on NativeHttpFetch. HostFetch no longer reads lynxExtension.streamingId. response.ts exports are syncStreamResponse, stabilizeStreamingResponse, stabilizeJsonResponse. Transport files dropped from the oxlint ignore list.

T4: preferNdjsonAccept is applied in syncStreamRequestFromFetch; headerMap only copies.

Not in this PR: T2 / ADR-0004 / LynxFetchModule streaming-fallback deletion, T3/NativeSql, N1–N4.

#36 stream lifecycle (abort, retirement, multi-emitter, overflow) and #40 UX are preserved. pnpm typecheck, pnpm lint, pnpm test (112), and make test all pass.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 9, 2026 16:15
T1: each SyncStreamTransport interprets its own wire shape and returns a
finished Response via syncStreamResponse({bytes}|{streamingId}). NativeHttpFetch
alone owns enterEarlyCapture; HostFetch no longer sniffs lynxExtension.streamingId.
response.ts shrinks to syncStreamResponse, stabilizeStreamingResponse, and
stabilizeJsonResponse. Drop transport files from the oxlint ignore list.

T4: preferNdjsonAccept runs at syncStreamRequestFromFetch, not inside headerMap.

Co-authored-by: 達達 <djwok@users.noreply.github.com>
Satisfy oxlint anti-slop and tsc after dropping transport files from the ignore list.

Co-authored-by: 達達 <djwok@users.noreply.github.com>
Deliver identifier fallback events after the reader attaches. Early capture
belongs only to NativeHttpFetch (T1). Format the touched transport files.

Co-authored-by: 達達 <djwok@users.noreply.github.com>
@djwok
djwok marked this pull request as ready for review September 9, 2026 16:19
@darekaze
darekaze merged commit 54ed874 into main Sep 10, 2026
1 check passed
@darekaze
darekaze deleted the drkz/t1-t4-transport-ownership-9c22 branch September 10, 2026 00:52
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.

3 participants