feat: ship deterministic parser and lifecycle release
This commit is contained in:
1 parent
208c434b31
commit
7b5d855b09
176 files changed
+20248
-1362
No files matched your search
@@ -29,3 +29,52 @@ test('failures after the write boundary become uncertain', () => {
|
||||
assert.equal(guard.failureState({ state: 'submitted' }), 'uncertain');
|
||||
assert.equal(guard.rootTaskId('TASK-1#2'), 'TASK-1');
|
||||
});
|
||||
|
||||
test('an explicit network-before-submit block is safe to classify as no ERP write', () => {
|
||||
const report = {
|
||||
status: 'live_submit_blocked',
|
||||
execution_phase: 'prewrite_blocked',
|
||||
write_attempted: false,
|
||||
no_erp_write: true,
|
||||
submit_safety: { live_submit_attempted: false },
|
||||
native_request: null,
|
||||
server_response: null,
|
||||
requery: null,
|
||||
side_effects: [],
|
||||
ajax_records: [{ prevented_from_network: true, network_request_attempted: false }]
|
||||
};
|
||||
assert.equal(guard.confirmedPrewriteNoErpWrite(report), true);
|
||||
assert.equal(guard.confirmedPrewriteNoErpWrite({ ...report, write_attempted: true }), false);
|
||||
assert.equal(guard.confirmedPrewriteNoErpWrite({
|
||||
...report,
|
||||
ajax_records: [{ prevented_from_network: false, network_request_attempted: true }]
|
||||
}), false);
|
||||
assert.equal(guard.confirmedPrewriteNoErpWrite({ ...report, side_effects: { unknown: true } }), false);
|
||||
});
|
||||
|
||||
test('local extension history stays bounded without pruning active or uncertain roots', () => {
|
||||
const tasks = {};
|
||||
const results = {};
|
||||
const executions = {};
|
||||
for (let index = 1; index <= 6; index += 1) {
|
||||
const taskId = `TASK-${index}`;
|
||||
const updatedAt = `2026-08-${String(index).padStart(2, '0')}T00:00:00.000Z`;
|
||||
tasks[taskId] = { task_id: taskId, updated_at: updatedAt };
|
||||
results[taskId] = { status: 'completed', updated_at: updatedAt };
|
||||
executions[taskId] = { state: 'completed', updated_at: updatedAt };
|
||||
}
|
||||
executions['TASK-1'] = { state: 'running', updated_at: '2026-08-01T00:00:00.000Z' };
|
||||
results['TASK-2'] = { status: 'execution_uncertain', updated_at: '2026-08-02T00:00:00.000Z' };
|
||||
tasks['TASK-6#1'] = { task_id: 'TASK-6#1', updated_at: '2026-08-06T00:00:01.000Z' };
|
||||
results['TASK-6#1'] = { status: 'completed', updated_at: '2026-08-06T00:00:01.000Z' };
|
||||
|
||||
const pruned = guard.pruneLocalTaskHistory(
|
||||
{ tasks, results, executions, timingStates: {} },
|
||||
{ currentTaskId: 'TASK-3', terminalRootLimit: 2 }
|
||||
);
|
||||
|
||||
assert.deepEqual(Object.keys(pruned.results).sort(), ['TASK-1', 'TASK-2', 'TASK-3', 'TASK-5', 'TASK-6', 'TASK-6#1']);
|
||||
assert.equal(pruned.counters.protected_root_count, 3);
|
||||
assert.equal(pruned.counters.removed_root_count, 1);
|
||||
assert.equal(pruned.counters.removed_result_count, 1);
|
||||
});
|
||||
Reference in new issue
Block a user