Skip to content

Commit dc7dadd

Browse files
authored
fix(inference): link single-run changelog to its producing run, not the date (#464)
The Config Changelog's single-run date block rendered date-level Git Commit and Workflow Run links (`data.changelogs.at(-1).head_ref` and `data.runs.at(-1).html_url`): the last entry/run on the calendar date, regardless of config. When two unrelated PRs merged the same day, a config whose data came from the earlier run showed the later run's commit/run links next to its own correct changelog description. Drive the links off the run that actually produced the selected config's data (the sole `dataRunsForDate` entry, the same source the multi-run branch uses) and drop the date-level `headRef`/`runUrl` fields entirely so the bad attribution cannot recur. Both branches now share a `renderRunLinks` helper, and the single-run separator renders only when a link exists (no dangling em-dash when a changelog entry has no matching benchmark run). Fixes #408
1 parent 8d8f505 commit dc7dadd

3 files changed

Lines changed: 40 additions & 50 deletions

File tree

packages/app/src/components/inference/ui/ComparisonChangelog.tsx

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,36 @@ import { dataRunsForDate } from '@/components/inference/utils/runEnumeration';
1616
import { getHardwareConfig } from '@/lib/constants';
1717
import { getDisplayLabel, updateRepoUrl } from '@/lib/utils';
1818

19+
/** Git Commit and Workflow Run external links for a run, each shown when known. */
20+
function renderRunLinks(headRef?: string, runUrl?: string) {
21+
return (
22+
<>
23+
{headRef && (
24+
<a
25+
href={`https://github.com/SemiAnalysisAI/InferenceX/commit/${headRef}`}
26+
target="_blank"
27+
rel="noopener noreferrer"
28+
className="text-sm hover:underline text-foreground underline"
29+
>
30+
Git Commit
31+
<ExternalLinkIcon />
32+
</a>
33+
)}
34+
{runUrl && (
35+
<a
36+
href={updateRepoUrl(runUrl)}
37+
target="_blank"
38+
rel="noopener noreferrer"
39+
className="text-sm hover:underline text-foreground underline"
40+
>
41+
Workflow Run
42+
<ExternalLinkIcon />
43+
</a>
44+
)}
45+
</>
46+
);
47+
}
48+
1949
/** One changelog entry's description. The GPU and run # are shown in the entry title. */
2050
function renderDescription(
2151
entry: { config_keys: string[]; description: string },
@@ -262,28 +292,7 @@ export default function ComparisonChangelog({
262292
{gpuLabel ? ` ${gpuLabel}` : ''} #{idx + 1}
263293
</span>
264294
<span className="text-muted-foreground">&mdash;</span>
265-
{run.headRef && (
266-
<a
267-
href={`https://github.com/SemiAnalysisAI/InferenceX/commit/${run.headRef}`}
268-
target="_blank"
269-
rel="noopener noreferrer"
270-
className="text-sm hover:underline text-foreground underline"
271-
>
272-
Git Commit
273-
<ExternalLinkIcon />
274-
</a>
275-
)}
276-
{run.runUrl && (
277-
<a
278-
href={updateRepoUrl(run.runUrl)}
279-
target="_blank"
280-
rel="noopener noreferrer"
281-
className="text-sm hover:underline text-foreground underline"
282-
>
283-
Workflow Run
284-
<ExternalLinkIcon />
285-
</a>
286-
)}
295+
{renderRunLinks(run.headRef, run.runUrl)}
287296
{onChart ? (
288297
<button
289298
type="button"
@@ -328,7 +337,11 @@ export default function ComparisonChangelog({
328337
});
329338
}
330339

331-
// Single (or no) matching run → one block keyed by the date.
340+
// Single (or no) matching run → one block keyed by the date. Link to
341+
// the run that produced this config's data so a date with unrelated
342+
// same-day runs never borrows another run's commit/run links. No
343+
// matching run (e.g. a pinned endpoint) → no links.
344+
const { headRef, runUrl } = runs[0] ?? {};
332345
const dateGpuLabel = gpuLabelsFor(item.entries);
333346
return (
334347
<div key={item.date} className="flex flex-col gap-1">
@@ -337,31 +350,10 @@ export default function ComparisonChangelog({
337350
{item.date}
338351
{dateGpuLabel ? ` ${dateGpuLabel}` : ''}
339352
</span>
340-
{item.entries.length > 0 && (
353+
{item.entries.length > 0 && (headRef || runUrl) && (
341354
<>
342355
<span className="text-muted-foreground">&mdash;</span>
343-
{item.headRef && (
344-
<a
345-
href={`https://github.com/SemiAnalysisAI/InferenceX/commit/${item.headRef}`}
346-
target="_blank"
347-
rel="noopener noreferrer"
348-
className="text-sm hover:underline text-foreground underline"
349-
>
350-
Git Commit
351-
<ExternalLinkIcon />
352-
</a>
353-
)}
354-
{item.runUrl && (
355-
<a
356-
href={updateRepoUrl(item.runUrl)}
357-
target="_blank"
358-
rel="noopener noreferrer"
359-
className="text-sm hover:underline text-foreground underline"
360-
>
361-
Workflow Run
362-
<ExternalLinkIcon />
363-
</a>
364-
)}
356+
{renderRunLinks(headRef, runUrl)}
365357
</>
366358
)}
367359
{datesOnChart.has(item.date) ? (

packages/app/src/components/inference/utils/runEnumeration.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ describe('dataRunsForDate', () => {
8888
});
8989

9090
it('carries run url and head sha through', () => {
91+
// The single-run changelog block links off these per-run fields (#408), so a
92+
// date with unrelated same-day runs cannot borrow another run's commit/run links.
9193
const rows = [
9294
rc({
9395
github_run_id: 7,

packages/app/src/hooks/api/use-comparison-changelogs.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ export interface ComparisonRun {
2626

2727
export interface ComparisonChangelog {
2828
date: string;
29-
headRef?: string;
30-
runUrl?: string;
3129
/** All of the date's changelog entries (flattened across runs). */
3230
entries: ComparisonChangelogEntry[];
3331
/** Individual runs on this date, in chronological order (earliest first). */
@@ -117,8 +115,6 @@ export function useComparisonChangelogs(
117115

118116
results.push({
119117
date: datesToQuery[i],
120-
headRef: data.changelogs.at(-1)?.head_ref,
121-
runUrl: data.runs.at(-1)?.html_url ?? undefined,
122118
entries: data.changelogs.map((c: ChangelogRow) => ({
123119
config_keys: c.config_keys,
124120
description: c.description,

0 commit comments

Comments
 (0)