Repository navigation
Add license, tests, CI and governance; harden multipart file read - #1
Merged
Merged
Conversation
- Add MIT LICENSE (composer.json already declared MIT; file was missing) - Add PHPUnit suite for pure-PHP units: MultipartEncoder, PacketBuffer, RequestOptions::toTransportArray() (27 tests, 51 assertions) - Add GitHub Actions CI: PHP 8.2-8.4 (validate/lint/test) + Go build/vet - Add CONTRIBUTING, SECURITY, CODE_OF_CONDUCT, CHANGELOG, issue/PR templates - MultipartEncoder::encode(): validate file readability before reading, so a missing/unreadable path throws AstraException cleanly instead of emitting a raw PHP warning - Align composer.json description; export-ignore dev files from the dist; gitignore composer.lock and .phpunit.cache Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
go vet (added in CI) surfaced real issues in the Go transport:
- SSE and WebSocket read loops used `break` inside a `select`, which only
breaks the select, not the enclosing `for {}`. The loops never terminated
on EOF / normal close / cancellation: a spin after the stream ended and the
trailing "end" frame was unreachable (never sent to PHP). Use labeled
`break sseLoop` / `break wsLoop` so the loop exits and the end frame is sent.
- processRequest created a cancellable context before the protocol dispatch,
leaking it on the websocket/sse/http3 early-return paths (which manage their
own). Create it only on the default HTTP path that uses it.
Fixes: core.go unreachable-code (977, 1176) and lostcancel (132) vet findings.
go build ./... passes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Hardens packaging and trust for
astrahttp/httpwithout touching the public API.LICENSE(composer.json already declared MIT; the file was missing).MultipartEncoder,PacketBuffer,RequestOptions::toTransportArray(). 27 tests, 51 assertions, green on PHP 8.4..github/workflows/ci.yml: PHP matrix 8.2/8.3/8.4 (composer validate --strict+ lint + test) and a Go job (go build/go vetinsrc-go).CONTRIBUTING,SECURITY,CODE_OF_CONDUCT,CHANGELOG, issue + PR templates.MultipartEncoder::encode()validates file readability before reading, throwingAstraExceptioncleanly instead of emitting a raw PHP warning.break) so the trailing "end" frame is sent;processRequestno longer leaks a cancellable context on protocol early-return paths. (Both surfaced bygo vet.)composer.jsondescription;export-ignoredev files from the Composer dist; gitignorecomposer.lockand.phpunit.cache.Verification
CI: all green (PHP 8.2/8.3/8.4 + Go transport).
No secrets or binaries committed. Public API (
Client,RequestOptions,Response) unchanged.