Skip to content

Commit 0d30b5f

Browse files
mbovelclaude
andcommitted
Remove minor version requirement from compare view
Look up each version's patch version automatically from the index, so compare URLs work without requiring a specific minor version to be selected. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2410165 commit 0d30b5f

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

visualizer/src/App.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,14 @@ export default function App() {
166166
route.compareVersions.length < 2 ||
167167
!index ||
168168
!config.machine ||
169-
!config.jvm ||
170-
!config.minorVersion
169+
!config.jvm
171170
)
172171
return;
173172
let active = true;
174173
setCompareLoading(true);
175174
fetchComparisonData(
176175
config.machine,
177176
config.jvm,
178-
config.minorVersion,
179177
route.compareVersions,
180178
index,
181179
)
@@ -192,7 +190,7 @@ export default function App() {
192190
return () => {
193191
active = false;
194192
};
195-
}, [route.view, route.compareVersions, config.machine, config.jvm, config.minorVersion, index]);
193+
}, [route.view, route.compareVersions, config.machine, config.jvm, index]);
196194

197195
// Derive available options from the index
198196
const machines = index?.machines ?? [];
@@ -203,9 +201,7 @@ export default function App() {
203201
`${config.machine}/${config.jvm}/${config.minorVersion}`
204202
] ?? [];
205203
const rawVersions =
206-
index?.rawVersions[
207-
`${config.machine}/${config.jvm}/${config.minorVersion}`
208-
] ?? [];
204+
index?.allRawVersions[`${config.machine}/${config.jvm}`] ?? [];
209205

210206
const isCompare = route.view === "compare";
211207

@@ -270,6 +266,7 @@ export default function App() {
270266
versions={versions}
271267
metrics={metrics}
272268
hideMetric={isCompare}
269+
hideVersion={isCompare}
273270
hideDisplayOptions={isCompare}
274271
/>
275272

visualizer/src/api.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export interface DataIndex {
2020
rawVersions: Record<string, string[]>;
2121
/** machine/jvm/patchVersion/version → CSV filenames (from raw/) */
2222
rawFiles: Record<string, string[]>;
23+
/** machine/jvm → all raw version strings (across all patch versions) */
24+
allRawVersions: Record<string, string[]>;
25+
/** machine/jvm/version → patchVersion (reverse lookup) */
26+
rawVersionToPatch: Record<string, string>;
2327
}
2428

2529
/** Fetches the full aggregated tree in a single API call and parses the hierarchy. */
@@ -67,13 +71,19 @@ export async function fetchDataIndex(): Promise<DataIndex> {
6771

6872
const rawVersionSets: Record<string, Set<string>> = {};
6973
const rawFilesMap: Record<string, string[]> = {};
74+
const allRawVersionSets: Record<string, Set<string>> = {};
75+
const rawVersionToPatch: Record<string, string> = {};
7076

7177
for (const parts of rawPaths) {
7278
if (parts.length !== 5) continue;
7379
const [machine, jvm, patchVersion, version, file] = parts;
7480
const key = `${machine}/${jvm}/${patchVersion}`;
7581
(rawVersionSets[key] ??= new Set()).add(version);
7682
((rawFilesMap[`${key}/${version}`]) ??= []).push(file);
83+
84+
const mjKey = `${machine}/${jvm}`;
85+
(allRawVersionSets[mjKey] ??= new Set()).add(version);
86+
rawVersionToPatch[`${mjKey}/${version}`] = patchVersion;
7787
}
7888

7989
const toSorted = (s: Set<string>) => [...s].sort();
@@ -94,6 +104,10 @@ export async function fetchDataIndex(): Promise<DataIndex> {
94104
Object.entries(rawVersionSets).map(([k, v]) => [k, toSorted(v)]),
95105
),
96106
rawFiles: rawFilesMap,
107+
allRawVersions: Object.fromEntries(
108+
Object.entries(allRawVersionSets).map(([k, v]) => [k, toSorted(v)]),
109+
),
110+
rawVersionToPatch,
97111
};
98112
}
99113

@@ -212,12 +226,13 @@ async function fetchRawDataForVersion(
212226
export async function fetchComparisonData(
213227
machine: string,
214228
jvm: string,
215-
patchVersion: string,
216229
versions: string[],
217230
index: DataIndex,
218231
): Promise<ComparisonData> {
219232
const entries = await Promise.all(
220233
versions.map(async (version) => {
234+
const patchVersion = index.rawVersionToPatch[`${machine}/${jvm}/${version}`];
235+
if (!patchVersion) return [version, new Map() as RawSuiteData] as const;
221236
const data = await fetchRawDataForVersion(machine, jvm, patchVersion, version, index);
222237
return [version, data] as const;
223238
}),

visualizer/src/components/ConfigPanel.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ interface ConfigPanelProps {
1111
versions: string[];
1212
metrics: string[];
1313
hideMetric?: boolean;
14+
hideVersion?: boolean;
1415
hideDisplayOptions?: boolean;
1516
}
1617

@@ -22,6 +23,7 @@ export default function ConfigPanel({
2223
versions,
2324
metrics,
2425
hideMetric,
26+
hideVersion,
2527
hideDisplayOptions,
2628
}: ConfigPanelProps) {
2729
return (
@@ -51,14 +53,16 @@ export default function ConfigPanel({
5153
onSelectedChange={(v) => onConfigChange({ ...config, metric: v })}
5254
/>
5355
)}
54-
<SelectorOption
55-
label="Minor version"
56-
items={versions}
57-
selected={config.minorVersion}
58-
onSelectedChange={(v) =>
59-
onConfigChange({ ...config, minorVersion: v })
60-
}
61-
/>
56+
{!hideVersion && (
57+
<SelectorOption
58+
label="Minor version"
59+
items={versions}
60+
selected={config.minorVersion}
61+
onSelectedChange={(v) =>
62+
onConfigChange({ ...config, minorVersion: v })
63+
}
64+
/>
65+
)}
6266
{!hideDisplayOptions && (
6367
<DisplayOptions
6468
yAxisAtZero={config.yAxisAtZero}

0 commit comments

Comments
 (0)