@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/report.js +20 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackerrank/astra-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Minimal zero-dependency AI coding agent for the HackerRank AI Gateway.",
5
5
  "type": "module",
6
6
  "bin": {
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
- const runs = scanRuns(rootDir);
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);