feat: classify recovered naming drift
This commit is contained in:
@@ -41,9 +41,11 @@ for (const stateName of stateNames) {
|
||||
const expectedTaskIds = Array.from({ length: 7 }, (_, index) => `ORA-GUI-WF-${String(index).padStart(3, '0')}`)
|
||||
if (!Array.isArray(workflow.progress) || workflow.progress.map((entry) => entry.taskId).join(',') !== expectedTaskIds.join(',')) fail('workflow progress must contain ordered ORA-GUI-WF-000 through 006 tasks.')
|
||||
const statuses = workflow.progress.map((entry) => entry.status)
|
||||
if (statuses.filter((status) => status === 'in_progress').length !== 1 || statuses.some((status) => !['completed', 'in_progress', 'pending'].includes(status))) fail('workflow progress must have exactly one in-progress task.')
|
||||
const inProgressCount = statuses.filter((status) => status === 'in_progress').length
|
||||
if (inProgressCount > 1 || statuses.some((status) => !['completed', 'in_progress', 'pending'].includes(status))) fail('workflow progress has invalid statuses.')
|
||||
const inProgressIndex = statuses.indexOf('in_progress')
|
||||
if (statuses.slice(0, inProgressIndex).some((status) => status !== 'completed') || statuses.slice(inProgressIndex + 1).some((status) => status !== 'pending')) fail('workflow progress is not a contiguous serial queue.')
|
||||
if (inProgressCount === 0 && statuses.some((status) => status !== 'completed')) fail('workflow progress without an in-progress task must be fully completed.')
|
||||
if (inProgressCount === 1 && (statuses.slice(0, inProgressIndex).some((status) => status !== 'completed') || statuses.slice(inProgressIndex + 1).some((status) => status !== 'pending'))) fail('workflow progress is not a contiguous serial queue.')
|
||||
for (const [index, entry] of workflow.progress.entries()) {
|
||||
if (!Array.isArray(entry.evidence)) fail(`${entry.taskId} evidence must be an array.`)
|
||||
if (index < inProgressIndex && entry.evidence.length === 0) fail(`${entry.taskId} is completed without evidence.`)
|
||||
@@ -55,6 +57,6 @@ console.log(JSON.stringify({
|
||||
primaryCommand: family.primaryCommand,
|
||||
primaryExactTask: family.primaryExactTask,
|
||||
completed: statuses.filter((status) => status === 'completed').length,
|
||||
inProgress: workflow.progress[inProgressIndex].taskId,
|
||||
inProgress: inProgressIndex >= 0 ? workflow.progress[inProgressIndex].taskId : null,
|
||||
pending: statuses.filter((status) => status === 'pending').length,
|
||||
}, null, 2))
|
||||
|
||||
Reference in New Issue
Block a user