Skip to content

Commit 3a662ec

Browse files
veksenclaude
andcommitted
fix: compute total from uploadable results instead of log entries
The `total` counter was incrementing during log parsing, counting raw entries before deduplication and optimization. This caused the CI comment to show a different query count than the site, which only displays queries with uploadable states (improvements_available, no_improvement_found, error). Compute `total` from the deduplicated, optimized results filtered to uploadable states so the CI comment and site always agree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 00be1d0 commit 3a662ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/runner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ export class Runner {
8484
error = err;
8585
});
8686

87-
let total = 0;
88-
8987
console.time("total");
9088
const recentQueries: RecentQuery[] = [];
9189
for await (const chunk of stream) {
@@ -134,7 +132,6 @@ export class Runner {
134132
continue;
135133
}
136134

137-
total++;
138135
const recentQuery = await RecentQuery.fromLogEntry(query, hash);
139136
recentQueries.push(recentQuery)
140137
}
@@ -155,7 +152,7 @@ export class Runner {
155152
});
156153

157154
console.log(
158-
`Matched ${this.remote.optimizer.validQueriesProcessed} queries out of ${total}`,
155+
`Matched ${this.remote.optimizer.validQueriesProcessed} queries`,
159156
);
160157

161158
const recommendations: ReportIndexRecommendation[] = [];
@@ -220,6 +217,9 @@ export class Runner {
220217
}
221218
}
222219

220+
const uploadableStates = new Set(["improvements_available", "no_improvement_found", "error"]);
221+
const total = allResults.filter((q) => uploadableStates.has(q.optimization.state)).length;
222+
223223
const statistics = deriveIndexStatistics(filteredRecommendations);
224224
const timeElapsed = Date.now() - startDate.getTime();
225225
const reportContext: ReportContext = {

0 commit comments

Comments
 (0)