Skip to content

fix(frontend): correct build time 'Used in period' always showing 0m#2033

Merged
Dalanir merged 1 commit into
mainfrom
fix/build-time-usage-display
May 5, 2026
Merged

fix(frontend): correct build time 'Used in period' always showing 0m#2033
Dalanir merged 1 commit into
mainfrom
fix/build-time-usage-display

Conversation

@Dalanir
Copy link
Copy Markdown
Contributor

@Dalanir Dalanir commented May 5, 2026

Summary (AI generated)

  • Fixed the "Used in period" field for Build Time always displaying "0m" on the Usage page, despite the percentage bar showing the correct value (e.g. 63%).

Motivation (AI generated)

The statistics backend returns build_time_seconds in its response, but the frontend type definitions and data aggregation code were referencing build_time_unit — a field that doesn't exist in the API response. This caused the value to always be undefined, falling back to 0. The percentage was unaffected because it comes from a separate RPC (get_plan_usage_percent_detailed) that queries the database directly.

Business Impact (AI generated)

Users see incorrect build time usage (always 0m) on the org Usage page, which prevents them from understanding their actual consumption and making informed decisions about plan upgrades.

Test Plan (AI generated)

  • Navigate to Settings > Organization > Usage
  • Verify "Used in period" for Build Time shows the actual accumulated build time (not 0m)
  • Verify the percentage and progress bar remain consistent with the displayed value
  • Run bun typecheck — passes cleanly

Generated with AI

Summary by CodeRabbit

  • Bug Fixes
    • Fixed build time metrics calculation to use seconds instead of units, improving accuracy in usage tracking and credit overage estimation. Build time statistics displayed in the organization dashboard now reflect proper time measurements.

The statistics backend returns build_time_seconds in its response but the
frontend was reading build_time_unit (which was always undefined, defaulting
to 0). The percentage was correct because it comes from a separate RPC.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 443bf273-bee4-4d80-b6f9-ee3f973ca1e2

📥 Commits

Reviewing files that changed from the base of the PR and between 12d5d55 and 2ddfcc7.

📒 Files selected for processing (3)
  • src/pages/settings/organization/Usage.vue
  • src/services/supabase.ts
  • src/stores/main.ts

📝 Walkthrough

Walkthrough

The PR updates the organization usage metrics to track build time in seconds instead of arbitrary units. A field named build_time_unit is renamed to build_time_seconds across type definitions, store state, and UI computation logic.

Changes

Build Time Metric Rename

Layer / File(s) Summary
Data Model Types
src/services/supabase.ts
AppUsageByApp and AppUsageGlobal interfaces rename build_time_unit: number to build_time_seconds: number. The getAllDashboard function's response typing is updated accordingly.
Store State
src/stores/main.ts
TotalStats interface replaces build_time_unit: number with build_time_seconds: number. The totalStats initial state and getTotalStats reducer are updated to accumulate build_time_seconds.
UI Computation
src/pages/settings/organization/Usage.vue
getUsage() now sums entry.build_time_seconds instead of entry.build_time_unit when computing total build time.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes


🐰 A hop through the code, a field that's refined,
From units to seconds, the metrics aligned,
Through store and through UI, the change flows so clean,
Build time in numbers—the clearest we've seen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the bug fix: correcting the 'Used in period' display for build time that was showing 0m. It accurately reflects the main change in the changeset.
Description check ✅ Passed The description includes Summary, Motivation, Business Impact, and Test Plan sections with substantive content, covering the issue, root cause, impact, and verification steps. However, the Checklist section is incomplete with all items unchecked.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix/build-time-usage-display

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

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 5, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing fix/build-time-usage-display (2ddfcc7) with main (12d5d55)

Open in CodSpeed

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@Dalanir Dalanir merged commit fb41fa5 into main May 5, 2026
38 checks passed
@Dalanir Dalanir deleted the fix/build-time-usage-display branch May 5, 2026 19:10
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.

1 participant