0.1.0#15
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
See changelog. This is a breaking release.