fix(task-board): don't count unpriced runs in the task-cost run count - #6177
Merged
Merged
Conversation
The task-cost chip (#6154/#6159) summed only threads with a recorded costUsd but reported the count of ALL linked threads, including ones with no finish part yet (still running, or crashed before one). A task with 1 priced run and 1 still-running thread showed "$X in 2 runs", claiming the total covered a run it never touched. Extracted the count/total logic into a pure summarizeTaskCost() helper and fixed it to count only priced threads, with a unit test covering the mismatch.
pedrofrxncx
enabled auto-merge (squash)
August 18, 2026 14:39
decocms Bot
pushed a commit
that referenced
this pull request
Aug 18, 2026
PR: #6177 fix(task-board): don't count unpriced runs in the task-cost run count Bump type: patch - decocms (apps/api/package.json): 4.226.3 -> 4.226.4 - @decocms/native (apps/native/package.json): 4.226.3 -> 4.226.4 Deploy-Scope: web
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #6154/#6159 (the task-cost chip and its plural fix).
Bug:
TaskCostintask-dialog.tsxsummed cost only over threads with a non-nullcostUsd, but reported the run count as(threads ?? []).length— every linked thread, including ones with nofinishpart yet (still running, or crashed before completing one, perparseCostUsd/the cost lateral join inapps/api/src/storage/task-board.ts). A task with one priced run and one still-running thread showed "$X in 2 runs", but the total only ever covered the one priced run — the tooltip explicitly claims the total is "across all {runs} of its runs", which was false.Fix: extracted the count/total logic into a pure
summarizeTaskCost()helper (task-cost.ts) and made the run countpriced.lengthinstead of the full thread list, so the displayed count always matches what the total actually sums.Regression test:
task-cost.test.ts—summarizeTaskCost([priced, unpriced, priced])now assertsrunCount: 2, not 3.To confirm:
bun test apps/web/src/layouts/task-board/task-cost.test.tsLocally verified:
bun run fmt,bunx tsc --noEmitinapps/web(one pre-existing, unrelatedmustachetype error on main, nothing in the touched files),bunx oxlinton the three changed files (0 warnings/errors), and the targeted test above. Full CI validates the rest.Summary by cubic
Fixes the task board cost chip to count only runs that recorded
costUsd, so the run count matches the summed total. Previously it summed priced threads but reported the count of all threads, including still-running or crashed ones.summarizeTaskCost()intask-cost.tsand uses it inTaskCost; the chip is hidden when no priced runs exist.task-cost.test.tsto cover exclusion of unpriced threads and null cases;task-dialog.tsxis refactored to consume the helper.Written for commit 7615a9a. Summary will update on new commits.