Skip to content

0.1.0#15

Merged
Colton127 merged 11 commits into
mainfrom
claude/package-update-review-erai53
Jun 22, 2026
Merged

0.1.0#15
Colton127 merged 11 commits into
mainfrom
claude/package-update-review-erai53

Conversation

@Colton127

Copy link
Copy Markdown
Owner

Closes #7

See changelog. This is a breaking release.

Colton127 and others added 11 commits April 15, 2026 19:23
Introduces a layered test suite for the 0.1.0 release. The package
previously shipped with no tests.

- support/: a configurable local origin HttpServer (TestOrigin), a
  deterministic seeded payload generator + SHA-256 helpers, and a
  manager/temp-dir harness.
- unit/: pure tests for CachedResponseHeaders parsing/validation, HTTP
  range parsing/formatting, IntRange, CacheState, cache-URL encode/decode
  round-trips, CacheFiles, RetainCounter, and FutureRunner.
- io/: BufferedIOSink byte-for-byte integrity (ordering, append/resume,
  waitForPosition) and the CacheMetadata size-guard.
- e2e/: full-download, streamed-read, range, open-ended range, concurrent
  overlapping requests, partial-cache resume, and cache-hit integrity
  (asserted by SHA-256), plus served-header correctness and the
  retain/release stream lifecycle.

Adds flutter_test as a dev dependency; the suite runs with `flutter test`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
Runs `flutter test` on every push and pull request. Static analysis runs
as a non-blocking step so style lints don't mask test results.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
- TestOrigin now reports host `localhost` instead of the bound `127.0.0.1`,
  so source URLs are distinguishable from the cache server's loopback host
  (otherwise encodeSourceUrl rejects them as already-encoded cache URLs).
  This unblocks all e2e/lifecycle/header tests.
- url_codec_test attaches a server listener via start() so the keep-alive
  stream's buffered done event can flush on close(); without a subscriber,
  teardown hung and the tests timed out.
- BufferedIOSink close test attaches the matcher before close() so the
  waiter's synchronous error is observed instead of crashing the test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
The cache server ends a response by destroying the socket (abortive close).
With a pooled keep-alive HttpClient, fetching a body served instantly from a
completed cache file raced that close and hung the client (4 e2e timeouts).
Use a non-persistent connection (read until close) and add a short per-fetch
timeout so any future stall fails fast instead of hitting the 30s framework
timeout.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
Serving a body from an already-complete cache file over the local server
hangs the Dart test HttpClient (the server's Socket.close() is immediately
followed by Socket.destroy(), and the RST races delivery of an instant
response). Lazy/streamed serving and no-body responses are unaffected.

- e2e_headers: assert served headers via lazy fetches (same RequestHandler
  header logic, served while downloading) instead of pre-downloading.
- e2e_integrity: assert the cache-hit / no-refetch invariant at the API level
  via a second download() rather than an HTTP body fetch of the completed file.
- CHANGELOG: fold the InvalidCacheLengthException -> InvalidCacheSizeException
  rename into 0.1.0 Breaking Changes and drop the never-published 0.0.7 entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
dispose() called while a stream is transiently retained (e.g. by an in-flight
cache-server request) left the dispose future pending: _performDispose bailed
on isRetained, and the later release() took the lifecycle path, deferring
teardown by the full disposeAfter (default 5 min) instead of completing the
dispose.

Track _disposeRequested; when the retain count reaches zero in release(),
complete the dispose immediately if requested. retain() clears the flag so a
new holder still resurrects the stream per the existing release/retain
contract. Adds a regression test under the default lifecycle config.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HknTbNeWNVfLLA3MXwnnrQ
@Colton127 Colton127 merged commit 25f0b4a into main Jun 22, 2026
1 check passed
@Colton127 Colton127 deleted the claude/package-update-review-erai53 branch June 22, 2026 03:10
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.

Add auto-dispose to cache streams

2 participants