Skip to content

Commit 778c0c7

Browse files
committed
fix: guard against unknown epic IDs inflating progress above 100%
Unknown/legacy epic IDs persisted in state but absent from EPIC_CONFIG would pass the `!EPIC_CONFIG[num]?.onDemand` filter (since `undefined?.onDemand` is `undefined`, and `!undefined` is `true`), inflating completedEpics count above the totalEpics denominator. Add `EPIC_CONFIG[num] &&` guard in both `getProgressPercentage()` and `_calculateProgressFromState()` so only known epics are counted.
1 parent 55eed06 commit 778c0c7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

.aiox-core/core/orchestration/master-orchestrator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,7 @@ class MasterOrchestrator extends EventEmitter {
13581358
if (totalEpics === 0) return 0;
13591359

13601360
const completedEpics = Object.entries(state.epics).filter(
1361-
([num, epic]) => epic.status === EpicStatus.COMPLETED && !EPIC_CONFIG[num]?.onDemand,
1361+
([num, epic]) => epic.status === EpicStatus.COMPLETED && EPIC_CONFIG[num] && !EPIC_CONFIG[num].onDemand,
13621362
).length;
13631363

13641364
return Math.round((completedEpics / totalEpics) * 100);
@@ -1415,7 +1415,7 @@ class MasterOrchestrator extends EventEmitter {
14151415
if (totalEpics === 0) return 0;
14161416

14171417
const completedEpics = Object.entries(this.executionState.epics).filter(
1418-
([num, epic]) => epic.status === EpicStatus.COMPLETED && !EPIC_CONFIG[num]?.onDemand,
1418+
([num, epic]) => epic.status === EpicStatus.COMPLETED && EPIC_CONFIG[num] && !EPIC_CONFIG[num].onDemand,
14191419
).length;
14201420

14211421
return Math.round((completedEpics / totalEpics) * 100);

0 commit comments

Comments
 (0)