Repository navigation
Write one bar.perk.available point per Reset Credit - #24
Conversation
A single point for all credits kept only the earliest expiry. Each available credit now gets its own point with its perk.id and expiry, as Telemetry Spec v1 asks when the tool identifies each Perk.
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change; it is mergeable after normal checks. Bar UI display validation remains planned for after release. Pre-merge checks |
|
|
There was a problem hiding this comment.
🟡 Changes recommended
Inconsistent API data can make the emitted gauge exceed the authoritative available count, and the telemetry documentation remains outdated.
2 open findings
What changed in this PR
Updates reset-credit telemetry so Bar UI can display each identified credit and expiry separately.
Changes:
- Emits one gauge point per available credit.
- Preserves totals with fallback and zero points.
- Adds encoder coverage for these cases.
| File | Description |
|---|---|
Sources/CodexBarCore/OTLPTelemetryEncoder.swift |
Encodes per-credit perk points. |
Tests/CodexBarCoreTests/BarTelemetryTests.swift |
Tests detailed, capped, and empty credit lists. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
If the list holds more available rows than availableCount, only that many are written, soonest expiry first, so the points never add up past the count. The telemetry doc now describes the per-credit gauge.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |


Summary
CodexBar wrote one
bar.perk.availablepoint for all Reset Credits, carrying only the earliest expiry. With three credits expiring 23 Oct, 30 Oct and 7 Nov, Bar UI only ever saw 23 Oct.Each available credit now gets its own point: value 1,
perk.kind=reset_credit,perk.id(the same ID ascodex.reset_credit.id) and that credit'sperk.expires_at. If the API caps the credit list belowavailableCount, the rest go into one point with no ID, so Bar UI's total still matches. With no credits, CodexBar still writes a single 0 point, so Bar UI sees them run out.This follows the Telemetry Spec v1 §4.3 amendment in GordonBeeming/bar-ui#19.
Test plan
swift test: 87 tests, 0 failures, andswift build --build-testshas no warningsCloses #23
Summary by CodeRabbit