@hackerrank/astra-cli 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/report.js +20 -1
package/package.json
CHANGED
package/src/report.js
CHANGED
|
@@ -20,7 +20,11 @@ export function refreshReport(root) {
|
|
|
20
20
|
if (!fs.existsSync(rootDir)) {
|
|
21
21
|
throw new Error(`bench root not found: ${rootDir}`);
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
// Task versions are immutable benchmark definitions. A task output directory
|
|
24
|
+
// may retain old attempts for auditability, but combining versions changes
|
|
25
|
+
// the measured task and makes the dashboard misleading. Show the newest
|
|
26
|
+
// version for each task while preserving unversioned legacy runs.
|
|
27
|
+
const runs = latestTaskRuns(scanRuns(rootDir));
|
|
24
28
|
const summary = buildSummary(runs);
|
|
25
29
|
|
|
26
30
|
for (const run of runs) {
|
|
@@ -82,6 +86,21 @@ export function scanRuns(rootDir) {
|
|
|
82
86
|
return runs;
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
function latestTaskRuns(runs) {
|
|
90
|
+
const latestVersionByTask = new Map();
|
|
91
|
+
for (const run of runs) {
|
|
92
|
+
const taskId = run.project?.id;
|
|
93
|
+
const version = Number(run.project?.version);
|
|
94
|
+
if (!taskId || !Number.isFinite(version)) continue;
|
|
95
|
+
latestVersionByTask.set(taskId, Math.max(latestVersionByTask.get(taskId) ?? version, version));
|
|
96
|
+
}
|
|
97
|
+
return runs.filter((run) => {
|
|
98
|
+
const taskId = run.project?.id;
|
|
99
|
+
const version = Number(run.project?.version);
|
|
100
|
+
return !taskId || !Number.isFinite(version) || latestVersionByTask.get(taskId) === version;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
85
104
|
export function buildSummary(runs) {
|
|
86
105
|
runs = runs.map((run) => ({ ...run, criteria: flattenCriteria(run.criteria) }));
|
|
87
106
|
const verifierCriteria = summarizeCriteria(runs);
|