Skip to content

Add bounded file copying, decoded form iteration and reusable error mapping - #7

Merged
renerocksai merged 2 commits into
mainfrom
feat/migration-helpers
Sep 13, 2026
Merged

renerocksai merged 2 commits into
mainfrom
feat/migration-helpers

Conversation

@renerocksai

@renerocksai renerocksai commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Applications migrating from Zap had to work around file-reader copying, decode every form pair manually, and duplicate Baz's error classifications in custom hooks. This PR adds:

  • Stream.copyFrom(reader, scratch): fixed caller scratch, existing response bounds/backpressure, sticky source and sink errors, and cancellation checks between reads.
  • Params.decodedIterator(allocator, .form | .percent): one owned allocation per pair, explicit freeing or arena lifetime, ordered duplicates, and unchanged raw iteration.
  • web.defaultErrorStatus(err): the same classification used by App's default handler, reusable from custom error hooks.
  • Configurable IPv4 binding through the engine pin and shared example CLI, preserving the loopback default.

Adds runnable runtime-file and decoded-form examples, custom-error regression coverage, and a styled website walkthrough linked from the main Examples section. Documents file-reader writer limitations, file/temporary-file lifetimes, HEAD, cancellation, allocator ownership, and service shutdown responsibilities. No application-private migration source or data is included.

Dependency: merge technologylab-ai/bounded-http#6 first. Baz pins its immutable 3f0ef4644ddb51092a0580c207fc5e0f2c5de9a0 revision and package hash.

Validation at runtime source 0edbb57 (PR head 173b473 changes README placement only):

  • Local Linux: Omarchy 4.0.3, x86_64, kernel 7.2.3-arch1-3, io_uring enabled; exact Zig 0.16.0 Debug/ReleaseSafe verification passed, 244 tests plus five independent consumer tests per mode. All 11 ReleaseSafe Python suites passed, including 381 CLI checks, runtime downloads, segmented decoded forms, custom-error statuses, streaming, backpressure, deadlines, and shutdown.
  • Local macOS: macOS 26.6.2 (25G83), ARM64, exact Zig 0.16.0; the same verification and all 11 Python suites passed. Mac used identical Baz implementation/tests and engine runtime sources; the final engine pin adds only a Windows test expectation correction.
  • Hosted Linux/macOS CI passed at the current PR head.
  • Chrome 152 passed all 20 website groups, including desktop/mobile guide navigation, all published documents, filtering, keyboard/print behavior, and source fidelity. The Pages build passed; deployment occurs after merging Baz.
  • Native Windows CI passed: Windows Server 2025 x64 build 26100, image win25-vs2026/20260907.229.1, exact Zig 0.16.0. Both modes passed 244 tests plus five consumer tests; all 12 Python suites passed, including three Windows shard/pipeline/console-shutdown groups. The PR merge-check commit 1954ac1 has the same complete Git tree as head 173b473. The separate engine Windows gate also passed.

These are correctness checks, not performance measurements. Runtime I/O and general allocator work stay on application workers; cancellation cannot interrupt arbitrary source operations already in progress.

@renerocksai
renerocksai merged commit 8025ecb into main Sep 13, 2026
8 checks passed
renerocksai added a commit that referenced this pull request Sep 25, 2026
bounded/http PR #7 now starts a request deadline at the request's first
byte and bounds idle keep-alive time with `idle_timeout_ms`. Idle time no
longer shortens a following request or stream.

LIMITS.md and SSE.md describe the new start point and the idle bound. The
continuations suite adds a stream that follows 2.5 idle seconds on a
kept-alive connection with a 3-second default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
renerocksai added a commit that referenced this pull request Sep 25, 2026
`RouteOptions.timeout_ms` gives one route its own deadline in place of
`server.timeout_ms`. Registration requires `server.max_timeout_ms` to cover
the value and rejects it otherwise with `error.InvalidRouteTimeout`. Baz asks
the engine for the deadline before route middleware and continuation start.

The continuations example adds `/long-stream`, which outlives the 3-second
server deadline. Its integration case checks both execution modes and the
following keep-alive request.

Pins bounded/http PR #7 (`96c249b`), which adds `Config.max_timeout_ms` and
`Context.setRequestTimeout`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
renerocksai added a commit that referenced this pull request Sep 25, 2026
bounded/http PR #7 now starts a request deadline at the request's first
byte and bounds idle keep-alive time with `idle_timeout_ms`. Idle time no
longer shortens a following request or stream.

LIMITS.md and SSE.md describe the new start point and the idle bound. The
continuations suite adds a stream that follows 2.5 idle seconds on a
kept-alive connection with a 3-second default.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
renerocksai added a commit that referenced this pull request Sep 25, 2026
bounded-http PR #7 is merged; pin its merge commit 874a8f3 on main
instead of the branch head dae8961. The package hash is unchanged: the
merged tree is the one verified on the branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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