Scope the By branch fetch by the app project filter

getBranchSpend was the only data fetch in createBridgeHandlers without
projectArgs(), so a project hidden by the Projects pane filter still showed
its branches in the Spend > By branch lens.

Extends the existing "scopes every fetch" test to cover the channel.
This commit is contained in:
iamtoruk 2026-09-12 13:25:15 -07:00
parent bb6a67b521
commit dc8583fde8
2 changed files with 6 additions and 1 deletions

View file

@ -833,6 +833,8 @@ describe('project filter', () => {
expect(calls[0]).toEqual(['sessions', '--format', 'json', '--period', 'week', '--project=my-company', '--exclude=scratch'])
await handlers['codeburn:getSessionsContributions']!('week', 'all')
expect(calls[1]).toEqual(['sessions', '--format', 'json', '--contributions', '--period', 'week', '--project=my-company', '--exclude=scratch'])
await handlers['codeburn:getBranchSpend']!('week', 'all')
expect(calls[2]).toEqual(['spend', '--format', 'branch-json', '--period', 'week', '--project=my-company', '--exclude=scratch'])
})
})

View file

@ -576,7 +576,10 @@ export function createBridgeHandlers(deps: Deps = { spawnCli, spawnCliAction, re
// Spend "By branch" lens: spend per canonical project × branch (plus
// coverage for sources without branch metadata).
'codeburn:getBranchSpend': run((period: string, provider: string, range?: DateRange) => [
'spend', '--format', 'branch-json', '--period', vPeriod(period), ...providerArgs(vProvider(provider)), ...rangeArgs(vRange(range)),
'spend', '--format', 'branch-json', '--period', vPeriod(period),
...providerArgs(vProvider(provider)),
...projectArgs(),
...rangeArgs(vRange(range)),
], 3),
'codeburn:getOptimizeReport': run((period: string, provider: string, range?: DateRange) => [
'optimize', '--format', 'json', '--period', vPeriod(period),