Repository navigation
v1.1.0 beta.3 - #45
Conversation
|
Warning Review limit reached
Next review available in: 43 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (77)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
build-ubuntu and build-macos already give the brightdigit/swift-build step an
`id: build` and gate their coverage upload on
`steps.build.outputs.contains-code-coverage`. build-android and build-windows
did neither, so their coverage never reached Codecov even though Android
already runs tests (`android-run-tests: true`).
- Add `id: build` to the swift-build step in build-android and build-windows.
- Add the same gated Process Coverage / Upload to Codecov pair to both jobs.
The gate makes them no-ops when the action reports no coverage, so neither
job can regress.
- Normalize the one `if:` in build-ubuntu that was missing its `${{ }}`.
Closes #31
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The fire-and-forget postEvent swallowed every failure into `print(error.localizedDescription)` — invisible to structured logging, impossible to silence or redirect, and giving callers no way to react. Adds an `onError: @sendable (any Error) -> Void` to Plausible, threaded through the designated init, the transport init, and all three URLSessionTransport convenience inits — mirroring how `diagnostics` already works. print stays the default. `Plausible.defaultErrorHandler` is public and is the default parameter value, so existing behavior is byte-for-byte unchanged while the handler is now visible, overridable, and suppressible with `{ _ in }`. Errors arrive wrapped in OpenAPIRuntime.ClientError; its `underlyingError` is the transport failure. Documented in README and DocC. Closes #36 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Several badges were dead or pointed at the wrong project: - Code Climate maintainability / tech-debt / issues all render as "codeclimate: retired badge" — the Quality product was sunset. - The codebeat badge 404s, and its link pointed at MistKit, not AviaryInsights. - The Actions badge query was malformed (`&?branch=main`), so it reported the wrong workflow state. - The Twitter badge points at twitter.com, which no longer exists under that brand. Removes the Code Climate, codebeat, Twitter, and Hound badges; fixes the Actions badge query to `&branch=main`; gives the license, issues, Actions, and Swift Package Index badges real alt text and click-through links. Every surviving badge was fetched and confirmed to render. Closes #32 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Applies Pattern A from the project's Swift Testing convention (https://gist.github.com/leogdion/0806c2f41aeb2c77db6a4a846cf13c0f): the parent suite carries the `Tests` suffix and stays empty, while each concern lives in an `AviaryInsightsTests+<Concern>.swift` extension that nests its own `@Suite` type. `AviaryInsightsTests` is now an empty `@Suite("AviaryInsights") internal enum` with `Post Event`, `Initialization`, `Diagnostics` and `Error Handling` reporting under it. Removes the file-level `#if canImport(OpenAPIURLSession)` that wrapped the whole initialization extension. A file-level `#if` deletes the suite from the test list rather than reporting it skipped, so the platform check now lives in one place — `Platform.isOpenAPIURLSessionAvailable` — and is applied once as a suite-level `.enabled(if:)` trait. The defensive `#else Issue.record(...)` branches stay inside each test body: they should never be reached, but they say so if the gate ever stops matching the guards. Test helpers now extend the production types they serve rather than the suite: `Plausible.makeClient(...)` and `Plausible.assert(events:...)` in `Plausible+TestHelpers.swift`, `MockTransport.Request.headerValue(_:)` on the recorded request, and `Event`/`Revenue` fixtures renamed to `+TestHelpers`. `ErrorRecorder` and `DiagnosticsRecorder` were the same lock-guarded `@unchecked Sendable` class twice over, so they collapse into one generic `Recorder<Value>`. Two fixes to the payload assertion: - `zip` stops at the shorter sequence, so a run that recorded zero requests looped zero times and passed having asserted nothing. The helper now requires `requests.count == events.count` up front. - The batch size was `Int.random(in: 10...20)`; it is now a fixed `eventCount` so a failure reproduces from the test name alone. WASI keeps a smaller batch. Verified by mutation: deleting the `sentRequests.append(...)` call in `MockTransport.send` now fails all three Post Event tests on the count assertion, where before the batch test passed vacuously. Closes #29 Closes #37 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
openapi.yaml already declared both optional headers and the generated client already accepted them, but the Plausible wrapper hardcoded only User-Agent, so callers could not reach two of the POST /event features. Both postEvent overloads now take `forwardedFor: [IPAddress]? = nil` and `debugRequest: Bool? = nil`. `forwardedFor` is a list because Plausible documents X-Forwarded-For as a comma-separated set of addresses of which it uses the first valid one; the elements are joined with `,`. Both default to nil, in which case the header is not sent at all. Adds a public `IPAddress` value type rather than taking a bare String, so a malformed address is rejected at construction instead of silently reaching the wire. No dependency offers a portable one — Network.IPv4Address is Darwin-only and this package ships Linux/Windows/Android/WASI — so it is hand-written in pure Swift, avoiding inet_pton, which is not dependable on WASI. It is byte-backed, so equal addresses compare equal however they were spelled and `description` always renders the RFC 5952 canonical form. There is deliberately no ExpressibleByStringLiteral: a literal conformance would have to trap on bad input. No openapi.yaml change and no regeneration — Generated/Types.swift already had X_hyphen_Forwarded_hyphen_For and X_hyphen_Debug_hyphen_Request. Also exposes headerFields on MockTransport.Request so the new tests can assert what actually reached the wire. Known issue: the generated client percent-encodes header values, so the `:` of an IPv6 address and the `,` joining a multi-address list both arrive escaped (`203.0.113.7%2C198.51.100.42`). See #42; the README and DocC page carry the caveat and the tests use single IPv4 addresses so they do not depend on it. Closes #30 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
b83d208 to
3a69093
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
===========================================
+ Coverage 81.44% 95.09% +13.65%
===========================================
Files 7 10 +3
Lines 97 306 +209
===========================================
+ Hits 79 291 +212
+ Misses 18 15 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
1e65f74 to
3a69093
Compare
Refresh RELEASE_NOTES for this beta and sync README/DocC feature lists with onError, forwardedFor/debugRequest, and IPAddress. Co-authored-by: Cursor <cursoragent@cursor.com>
No description provided.