Skip to content

feat(token-report): 2-decimal USD, cost-per-day chart, PR titles - #465

Merged
don-petry merged 6 commits into
mainfrom
chore/usd-2-decimals
Jun 7, 2026
Merged

feat(token-report): 2-decimal USD, cost-per-day chart, PR titles#465
don-petry merged 6 commits into
mainfrom
chore/usd-2-decimals

Conversation

@don-petry

@don-petry don-petry commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Three report enhancements (all in scripts/token_report.sh), each tested.

1. Round all dollar amounts to 2 decimals (cents) + org standard

  • _fmt_usd now uses printf "$%.2f" — every surfaced USD figure (totals, by workflow/tier/model, by repo, per-day, per-PR) goes through this single formatter, so they stay consistent. Sub-cent values render $0.00; ET remains the fine-grained comparator.
  • Codified as an org standard in AGENTS.md → Cost reporting (with a note on how to promote it org-wide via petry-projects/.github).

2. "Cost per day (stacked by repo)" chart

  • New ASCII stacked-bar chart: one bar per day, length scaled to the priciest day, each segment a top-6 repo (rest bucketed as .), with a legend of per-repo window totals.
  • GitHub Markdown / Mermaid has no native stacked-bar type, so an ASCII bar in a fenced block is the reliable cross-renderer choice.
  • Needed a per-record date → appended to annotate_records as col 13 (downstream columns unchanged).
2026-06-01  $  8.41  AAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBCCCCC..
2026-06-02  $  3.10  AAAAAAAAAAAAAABBBBB.

3. PR titles in "Most expensive PRs"

  • Table gains a Title column showing the first 35 chars (+) of each PR title.
  • main() resolves titles for the top-10 PRs via gh and passes them to the pure renderer through PR_TITLE_FILE; titles are pipe-sanitized (so the table can't break) and newline-stripped. Renderer stays network-free (blank title when no file → unit tests unaffected).

Test plan

  • shellcheck --severity=warning clean on all touched scripts
  • bats — token_report (23), model_pricing (13), fleet_report (40): 0 failures
  • New tests: 2-decimal + sub-cent rounding; cost-per-day chart presence + bar scaling; PR-title truncation, pipe-sanitization, and blank-fallback
  • markdownlint clean on AGENTS.md + docs

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added cost-per-day visualization chart (stacked bar format with repo segmentation) to token reports.
    • Enhanced most-expensive PRs section to display PR titles with truncation and formatting.
  • Documentation

    • Updated token report documentation with standardized USD formatting specifications and cost visualization details.

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 7, 2026 22:02
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: dc3664a4-94dd-463f-b28b-2ba5fc9fcb46

📥 Commits

Reviewing files that changed from the base of the PR and between 8991594 and 4e0e3b8.

📒 Files selected for processing (4)
  • AGENTS.md
  • docs/token-report.md
  • scripts/token_report.sh
  • tests/token_report.bats

📝 Walkthrough

Walkthrough

This PR enhances the token report with standardized USD cost formatting, adds per-day cost attribution tracking, introduces a cost-per-day stacked breakdown visualization, and embeds PR titles in the most-expensive-PR section. Changes span standards documentation, data schema expansion, new rendering features, and comprehensive test coverage.

Changes

Token Report Cost Attribution Enhancement

Layer / File(s) Summary
USD Formatting Standard and Implementation
scripts/token_report.sh, AGENTS.md, tests/token_report.bats
_fmt_usd() function rounds USD values to two decimals (cents). AGENTS.md documents the cost reporting standard: consistent formatting via _fmt_usd, effective-token comparisons, model-pricing sourcing from scripts/lib/model-pricing.tsv, and guidance for promoting to org-wide standards. Unit tests verify cent-precision rounding and sub-cent fallback to $0.00.
Enriched Record Schema with Date and Cache Fields
scripts/token_report.sh, tests/token_report.bats
annotate_records() now emits cache_write and date fields in the enriched TSV, enabling per-day cost attribution. Total cost test expectation is updated to expect the cent-rounded format from _fmt_usd.
Cost Per Day Report and PR Title Features
docs/token-report.md, scripts/token_report.sh, tests/token_report.bats
Cost-per-day stacked breakdown (ASCII bar chart by repo segment and rest bucket) is rendered from enriched data; PR titles are resolved once for top-10 PRs and passed to the renderer via PR_TITLE_FILE environment variable. "Most expensive PRs" section reads titles from PR_TITLE_FILE with truncation (35 chars + ellipsis), pipe-character sanitization to preserve table structure, and blank-title fallback when the file is absent. Test coverage includes chart legend/row assertions, title truncation validation, and missing-file behavior.

Sequence Diagram

sequenceDiagram
  participant main as main()
  participant annotate as annotate_records()
  participant render_cost as render_cost_per_day()
  participant render_report as render_token_report()
  participant titles_fetch as fetch PR titles
  
  main->>titles_fetch: resolve top-10 PR titles
  titles_fetch-->>main: populate PR_TITLE_FILE
  main->>annotate: emit enriched records
  annotate-->>main: cache_write, date fields
  main->>render_cost: render daily breakdown
  render_cost-->>main: stacked bar chart
  main->>render_report: render final report
  render_report->>PR_TITLE_FILE: read title data
  render_report-->>main: report with titles embedded
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • petry-projects/.github-private#456: Earlier iteration on the token-report workflow that introduced core rendering infrastructure extended by this PR's additions of USD formatting, cost-per-day breakdown, and PR title embedding.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/usd-2-decimals

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 7, 2026 22:03
@don-petry
don-petry disabled auto-merge June 7, 2026 22:04

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements to the token and cost reporting tool, including rounding USD amounts to two decimal places, adding an ASCII stacked-bar chart for daily cost by repository, and displaying PR titles in the most expensive PRs table. Feedback on these changes focuses on improving portability, efficiency, and resource cleanup. Specifically, it is recommended to replace a non-portable awk split call with a substr loop, consolidate multiple piped commands inside a loop into a single awk invocation to reduce process overhead, and write the temporary titles file to the tracked $jsonl_dir directory to leverage its automatic cleanup trap.

Comment thread scripts/token_report.sh Outdated
Comment thread scripts/token_report.sh Outdated
Comment thread scripts/token_report.sh Outdated
Comment thread scripts/token_report.sh Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
Files changed: none
Skipped (informational): Quality Gate passed — 0 new issues, 0 security hotspots
  reported. No open review threads from this bot. No hotspot patterns detected
  in changed files.
```

@don-petry
don-petry enabled auto-merge (squash) June 7, 2026 22:04
donpetry-bot
donpetry-bot previously approved these changes Jun 7, 2026

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: f5e4679ab4561820669651fbd7a91bdc43196696
Review mode: triage-approved (single reviewer)

Summary

Three additive enhancements to scripts/token_report.sh: (1) all surfaced USD amounts now route through _fmt_usd and render at 2 decimals (cents), codified as an org standard in AGENTS.md; (2) a new ASCII "Cost per day (stacked by repo)" chart built from a new date column appended to annotate_records; (3) the "Most expensive PRs" table gains a Title column, with titles resolved by main() and passed to the pure renderer via PR_TITLE_FILE. Docs and tests are updated to match.

Linked issue analysis

No issues linked. The PR description itself is well-structured and clearly motivates each of the three changes (formatting consistency, missing daily/repo visualization, PR identifiability).

Findings

  • Risk surface: none touched — no auth, secrets, crypto, DB/migrations, CI workflows, or dependency changes. Pure scripting + docs + tests.
  • Code quality (spot-checks):
    • gh pr view "$purl" is invoked with the URL properly quoted; the URL set comes from top_pr_urls (reading the internal JSONL context column), and titles are sanitized (tr -d '\r\n', tr '|' '/', length-capped to 35 chars + ) before insertion into the Markdown table — table can't be broken by hostile titles.
    • mktemp titles file is cleaned up with rm -f immediately after render_token_report returns. Gemini's suggestion to place it under $jsonl_dir (which has a trap-based cleanup) is a nice-to-have for crash-safety but not blocking.
    • Downstream column indices preserved (cache_write=12, date=13 appended), so existing consumers are unaffected.
    • render_cost_per_day is pure (reads only the enriched TSV) and no-ops cleanly when there are no priced, dated rows.
  • Tests: 4 new bats cases cover 2-decimal + sub-cent rounding, cost-per-day chart presence, bar scaling, title truncation, pipe sanitization, and the blank-fallback path. All bats suites green (token_report 23, model_pricing 13, fleet_report 40).
  • Non-blocking suggestions from gemini-code-assist (worth considering in a follow-up, not required for this approval):
    1. Replace non-portable awk split with a substr loop.
    2. Consolidate per-iteration piped commands in the title-fetch loop into one awk invocation.
    3. Write the titles tempfile under $jsonl_dir to inherit its trap-based cleanup.

CI status

All required checks green; nothing failing. SonarCloud Quality Gate passed (0 new issues, 0 security hotspots, 0 duplication). CodeQL, gitleaks, AgentShield, Agent Security Scan, shellcheck, bats, and unit-tests all SUCCESS. CodeRabbit was rate-limited and did not review, but the other static-analysis lanes provide adequate coverage for this scope.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the org-wide token cost report generator by standardizing USD formatting, adding a daily cost visualization, and enriching the “most expensive PRs” section with PR titles while keeping the renderer network-free.

Changes:

  • Standardize all surfaced USD amounts to 2-decimal (cents) rendering via _fmt_usd.
  • Add a “Cost per day (stacked by repo)” ASCII chart driven by an appended per-record date column.
  • Add an optional PR Title column to the “Most expensive PRs” table, with titles fetched in main() and passed via PR_TITLE_FILE.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/token_report.bats Updates and expands unit tests for 2-decimal USD formatting, the cost-per-day chart, and PR title rendering/sanitization.
scripts/token_report.sh Implements 2-decimal USD formatting, daily stacked cost chart generation, and PR title resolution + rendering via PR_TITLE_FILE.
docs/token-report.md Documents the new chart and PR title behavior and the 2-decimal USD formatting standard.
AGENTS.md Codifies the 2-decimal USD cost reporting rule as a repo-local standard.

Comment thread scripts/token_report.sh Outdated
Comment thread scripts/token_report.sh
@don-petry
don-petry disabled auto-merge June 7, 2026 22:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80bd0ccba8

ℹ️ 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".

Comment thread scripts/token_report.sh Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 7, 2026 22:16
@don-petry
don-petry disabled auto-merge June 7, 2026 22:17
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #465
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-07T22:52:06Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-06-07T22:52:06Z

@don-petry
don-petry enabled auto-merge (squash) June 7, 2026 22:22
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 7, 2026
@don-petry
don-petry disabled auto-merge June 7, 2026 22:22
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry
don-petry disabled auto-merge June 7, 2026 22:51
@don-petry

Copy link
Copy Markdown
Collaborator Author

@donpetry-bot review

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 7, 2026 22:53
@don-petry

Copy link
Copy Markdown
Collaborator Author

@donpetry-bot review

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: f6df3d4455570044103a0ee81d3a0ed0ed9fa522
Review mode: triage-approved (single reviewer)

Summary

Confirming the triage tier's LOW-risk assessment. The PR makes three additive changes — all in scripts/token_report.sh plus docs and tests:

  1. _fmt_usd now renders dollars at 2 decimals (cents) via printf "$%.2f"; this is codified as an org standard in AGENTS.md → Cost reporting (with a promotion note for petry-projects/.github).
  2. New render_cost_per_day produces an ASCII stacked-bar chart (one bar per day, length scaled to the priciest day, top-6 repos lettered + others bucketed as .); annotate_records was extended with a date column (col 13) to feed it.
  3. The "Most expensive PRs" table gains a Title column; main() resolves titles for the top-10 PRs via gh pr view and passes them to the pure renderer through PR_TITLE_FILE (titles are pipe-sanitized, newline-stripped, and truncated to 35 chars + ).

Linked issue analysis

No issues linked. The PR description clearly motivates each of the three changes (formatting consistency, missing daily/repo visualization, PR identifiability) and includes an explicit test plan.

Findings

  • Risk surface: none touched — no auth, secrets, crypto, DB/migrations, CI workflow, or dependency changes. Pure shell + docs + bats.
  • Code quality (spot-checks):
    • Renderer remains network-free: only main() calls gh pr view, then writes pr_titles.tsv into $jsonl_dir so it inherits the existing trap-based cleanup. Renderer reads via PR_TITLE_FILE only.
    • Title sanitization is defense-in-depth against table-breakage and CR/LF leaks: gsub(/\r/,""), gsub(/\|/,"/"), length-capped to 35 chars + before insertion into the Markdown row.
    • Downstream column indices are preserved (cache_write=12 unchanged; date appended as col 13), so existing consumers of annotate_records aren't affected.
    • top_pr_urls is pure and reuses annotate_records; only priced rows contribute ($10 == 1).
    • render_cost_per_day no-ops cleanly when there are no priced, dated rows (nd == 0 → exit 0).
    • _fmt_usd change is consistent everywhere costs are surfaced; ET is preserved as the fine-grained comparator.
  • Tests: new bats cases cover 2-decimal rounding (incl. sub-cent → $0.00), cost-per-day chart presence and bar-length scaling, PR-title truncation, pipe sanitization, and the no-PR_TITLE_FILE blank-fallback path. All bats suites pass per the PR's test plan.
  • Prior bot reviews: gemini-code-assist offered non-blocking portability suggestions (use substr loop instead of awk split; consolidate per-iteration pipes into one awk; write tempfile under $jsonl_dir). The third has already been adopted (titles_file="$jsonl_dir/pr_titles.tsv"); the other two are nice-to-have follow-ups, not blocking. copilot-pull-request-reviewer left 2 inline notes, no blocking issues. coderabbitai was rate-limited and did not produce a review, but the other static-analysis lanes provide adequate coverage for this scope.

CI status

All required checks green. SonarCloud Quality Gate passed (0 new issues, 0 security hotspots, 0 duplication). CodeQL, gitleaks (Secret scan), AgentShield, Agent Security Scan, shellcheck, ShellCheck (CI), bats, validate-agent-profiles, gh-aw-compile, Compile agentic workflows, unit-tests, and the dependency-audit lane all completed without failure (npm/pnpm/cargo/pip/govulncheck/dependabot SKIPPED as expected for this change set).


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.

@don-petry
don-petry disabled auto-merge June 7, 2026 23:01
@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #465
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-07T23:32:48Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

Note

@don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically.
Next attempt after: 2026-06-07T23:32:48Z

@don-petry
don-petry merged commit 370cce5 into main Jun 7, 2026
25 of 26 checks passed
@don-petry
don-petry deleted the chore/usd-2-decimals branch June 7, 2026 23:02
don-petry added a commit that referenced this pull request Jun 12, 2026
* feat(token-report): 2-decimal USD, cost-per-day chart, PR titles

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: apply manual instructions [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 14, 2026
* feat(token-report): 2-decimal USD, cost-per-day chart, PR titles

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: apply manual instructions [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 18, 2026
* feat(token-report): 2-decimal USD, cost-per-day chart, PR titles

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: apply manual instructions [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…ozen @v2) (#919)

* chore(auto-rebase): pin caller to @auto-rebase/stable channel (was @v2)

This repo's auto-rebase caller pinned the frozen `@v2` tag (376a4fcb,
2026-05-19), which predates the review-ready eligibility gate (#465/#468)
and violates the org standard (callers MUST pin the centrally-advanced
`auto-rebase/stable` channel, never a frozen `@vX` — see
standards/ci-standards.md → Reusable workflow versioning).

Re-syncs the caller stub from standards/workflows/auto-rebase.yml:
  - uses: ...auto-rebase-reusable.yml@v2 → @auto-rebase/stable
  - corrected "MUST NOT change the uses ref" header guidance
  - documents the eligibility / ready_label inputs

Effect: once the `auto-rebase/stable` channel is promoted to a commit
containing #528 (the tooling_ref fix) + #468 (the gate), this repo
automatically adopts the review-ready restriction. Until then it runs the
current channel head (unchanged unrestricted behavior) — no broken state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019LUUSUQHqwLWZ583SAs41K

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
* feat(token-report): 2-decimal USD, cost-per-day chart, PR titles

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: apply manual instructions [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
* feat(token-report): 2-decimal USD, cost-per-day chart, PR titles

- Round all surfaced dollar amounts to 2 decimals (cents) via _fmt_usd
  (printf "$%.2f"); codify it as an org standard in AGENTS.md → Cost reporting.
- Add a "Cost per day (stacked by repo)" ASCII stacked-bar chart: one bar per
  day, length scaled to the priciest day, segments lettered per top-6 repo with
  the rest bucketed as "." plus a legend of per-repo window totals. (GitHub
  Markdown/Mermaid has no native stacked bar; an ASCII bar renders everywhere.)
  Requires a date column — appended to annotate_records as col 13.
- Add the first 35 chars of each PR title to the "Most expensive PRs" table.
  main() resolves titles for the top-10 PRs via gh and passes them to the pure
  renderer through PR_TITLE_FILE; titles are pipe-sanitized and ellipsized.

Tests: 2-decimal rounding (+ sub-cent), cost-per-day chart presence and bar
scaling, PR-title truncation/sanitization/blank-fallback. All bats green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: apply manual instructions [skip ci-relay]

* fix(reviews): address review comments [skip ci-relay]

---------

Co-authored-by: donpetry-bot <{}+donpetry-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jul 14, 2026
…eview-ready deadlock (#1201)

* fix(dev-lead): label opened PRs auto-rebase:ready to break the review-ready deadlock

The auto-rebase 'review-ready' gate (#465) only rebases PRs that are approved
OR carry the auto-rebase:ready label. That label half was never wired up — no
producer applies it — so the only path to eligibility is an approval. A dev-lead
PR that falls behind before it is approved is therefore skipped by auto-rebase,
drifts into a merge conflict, and can never be approved (pr-review skips
red/conflicting PRs): a deadlock that rots the PR for weeks.

dev-lead now applies auto-rebase:ready to every PR it opens, so its PRs are
auto-rebase-eligible from creation and stay current until merge. The label is
created idempotently (--force) first so a repo missing it does not break, and
all label operations are guarded so PR creation never fails on a labeling hiccup.

Addresses Part A of petry-projects/.github#711. Part C (escalate skipped-but-
conflicting PRs) and standardizing the label in labels.yml are tracked follow-ups.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Juznz5V6su81ffSND8fg7s

* test: address CodeRabbit — drop needless LABEL_RECORD export, use STUB_BIN_DIR

The record path is baked into the gh stub via the unquoted heredoc, so exporting
it was unnecessary; placing it under STUB_BIN_DIR lets teardown clean it up.
(The reviewer's other suggestion — return '[]' for the pulls?state=open case —
is not applicable: the mock gh bypasses --jq, so check_existing_pr reads the raw
echo and needs the post-jq count '0'; returning '[]' would make [ ... -gt 0 ] throw.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Juznz5V6su81ffSND8fg7s

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants