Repository navigation
feat(usage): polymorfa usage summary, records and gates - #28
Conversation
Reads /platform/usage, /platform/usage/records and /platform/gates through the raw client until the typed SDK resource is published. Usage is measured, not charged. Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reached
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 41 minutes. View limit detailsLimit details: You’ve used the included review currently available. Your 74 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Comment |
Co-Authored-By: Claude <noreply@anthropic.com>
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8023bae7d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| ...summary.numbers.map( | ||
| (number) => | ||
| `${number.session}\t${number.meters | ||
| .map((total) => `${total.meter} ${total.quantity} ${total.unit}`) | ||
| .join(', ')}`, |
There was a problem hiding this comment.
Include project IDs in cross-project number rows
When a team key requests a summary without --project, summary.projectId is null and the response can contain numbers from multiple projects, but these rows discard each entry's projectId. Sessions with the same name therefore render as indistinguishable duplicate rows, so users cannot attribute the per-number totals to the correct project; include the per-entry project identifier in this cross-project view.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 83dce18: when the summary covers every project (projectId null), each number row prints its project after the session. Project-scoped summaries keep the header line only. Tests cover both cases.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8023bae7d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| record.occurredAt, | ||
| record.meter, | ||
| `${record.quantity} ${record.unit}`, | ||
| record.session ?? '-', |
There was a problem hiding this comment.
Show each record's project in cross-project output
When a team key runs usage records without --project, the response can contain records from multiple projects, but the human-readable rows discard record.projectId. Sessions can share names across projects, so users cannot reliably attribute these records to a project; include the project identifier in the cross-project rendering.
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
usage records prints each record's project, and usage summary without a project prints each number's project, so numbers that share a session name across projects stay distinguishable. Co-Authored-By: Claude <noreply@anthropic.com>
…gates # Conflicts: # README.md
…gates # Conflicts: # README.md # docs/command-research/campaigns.md # src/services/campaigns.ts # test/commands/campaigns.test.ts
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 281e3b8960
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| ), | ||
| { | ||
| ...(flags.period === undefined ? {} : {period: flags.period}), | ||
| ...(flags.project === undefined ? {} : {project: flags.project}), |
There was a problem hiding this comment.
Send the resolved project UUID to usage APIs
When an organization-key user passes a project slug, developerEnvironment resolves it to a canonical UUID, but this reconstructs the projectId query from the original flags.project value. The API therefore receives the slug in a UUID field and rejects an otherwise supported --project <slug> invocation. The records and gates commands repeat the same pattern; retain the resolved environment and pass environment.context.projectId, as the call-analytics commands do.
Useful? React with 👍 / 👎.
|
Merge gate for exact head |
Adds
polymorfa usage summary,usage records, andusage gatesfor the Calls metering contract merged in monorepo #228 atfdaff9a86220e3ef1f8ad75cc838dbfd03ede4eb. The commands use typedClient.usagemethods from SDK #283, merged ateaa7f67a6dd24e67fea4a1a22fc5a85fad39deb9. The exact published@polymorfa/sdk@0.1.0-dev.20260923132258tarball is pinned in the lockfile with integritysha512-ol2nSNl0tfRJQOAk1kywPwMu3+7KJxO1pVVlZj5S6Akj2+mnyKzjSgSU1EVHIObDLY9LLgg/kkTSeVbBmf0FGg==.summaryreports one UTC month by meter and number;recordsreads newest-first pages and prints the next cursor;gatesshows team gate state. Team keys can read across projects or select one with--project. Project tokens can read only their bound project's summary and records, with--projector a project-bound profile; the API refuses their gate reads with 403. A malformed period fails before a request. Usage is measured and unpriced; the outgoing Calls gate remains record-only. Calls remains unreleased, so merged commands alone do not establish customer access.The branch normally merges current CLI
devata63a6d84989c7c845e99d69af6c84a07e0f27ad9; its diff against that base is limited to usage commands, their typed service and tests, the exact SDK pin, and usage guidance. The latest dev Campaign behavior, including immediate stop without an operation, is retained.Full Node 22
npm run verifypassed against the exact published SDK: formatting, lint, typecheck, 730 tests in 79 files, build, package dry run, and production audit with zero vulnerabilities. Command-level HTTP tests cover project-token binding, team-wide/default reads, pagination, malformed period, gate refusal, response metadata and output. A live credential and deployed API were not exercised. Fresh current-head CI and review are required before merge.