Skip to content

Add bounded SSE reader for HTTP client streams - #335

Draft
danjboyd wants to merge 2 commits into
mainfrom
feat/v040-sse-reader
Draft

danjboyd wants to merge 2 commits into
mainfrom
feat/v040-sse-reader

Conversation

@danjboyd

@danjboyd danjboyd commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

ALNHTTPClient already delivers raw streaming chunks, but apps still need to split SSE lines and events themselves. This adds an independent ALNSSEReader that accepts arbitrary chunks and delivers immutable ALNSSEEvent values inline, with default 64 KiB line and 1 MiB event-data bounds.

The reader handles split UTF-8/BOM, CR/LF/CRLF, multiline data, event types and persistent/reset IDs. Limits are checked before buffer growth; errors and handler stops are permanent. Completed lines use strict UTF-8 validation rather than browser-style replacement decoding. EOF discards incomplete events. The HTTP guide includes HelpDesk's requirement that apps must see their own terminal event: HTTP success and parser finish alone cannot prove application completion.

Validation:

  • Sourced tools/source_gnustep_env.sh; used the pinned vendored XCTest runner.
  • make test-unit-filter TEST=SSEReaderTests ARLEN_TEST_JUNIT=1: 16 methods pass, zero failures/errors/skips. Includes every two-chunk split and byte-by-byte input, malformed UTF-8, byte boundaries, stop/EOF behavior, reentrancy and a large multi-event chunk.
  • make test-inventory: all 1675 discovered methods match the baseline (1409 unit, 266 integration); this check lists tests without running the full suites.
  • make docs-api docs-html ci-docs: passes; generated public API docs and newcomer references are updated.

Refs #332. Draft for v0.4.0 consideration, based on main e26a755e. No HTTP transport, ALNRequest or search changes; no automatic retry/reconnect, vendor terminal semantics, CI lane changes or ABI/runtime-pin changes. Existing v0.3.2 worktrees and evidence are preserved. No milestone assigned; no merge, tag or publishing requested.

Follow-up static analysis: commit e0a73db5 moves writes to the autoreleasing NSError output parameter outside the per-line pool. The same 16 focused tests pass. The local full scan-build run now reports zero SSE findings; its overall gate fails on two findings in unchanged files (ALNAuthModule.m:3345 and ALNHTTPServer.m:2714) that were absent from the original PR CI report. No analyzer baseline, suppressions or exclusions changed. Normal PR CI will verify the updated head on its existing runners.

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