fix: deduplicate synthetic quality exclusions
Build and publish Eldorado documentation / build (pull_request) Successful in 32s
Build and publish Eldorado documentation / build (pull_request) Successful in 32s
This commit is contained in:
1 parent
f1743156b6
commit
237c6767ab
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -117,7 +117,7 @@ export function calculate(f) {
|
||||
kpis['deployment-rework-rate']=result(effects.filter(r=>r.planned===false && Boolean(r.incident_id)).length,effects.length,as_of,{unknown:effects.filter(r=>typeof r.planned!=='boolean' || (r.planned===false && !Object.hasOwn(r,'incident_id'))).length});
|
||||
const [affected,accepted]=matureDefects(f.changes,f.defects,as_of,start,end);
|
||||
const matureChanges=unique(f.changes).filter(r=>visible(r,as_of) && within(r.accepted_at,start,end) && time(r.accepted_at)+horizon(r)<=time(as_of));
|
||||
kpis['escaped-quality-rate']=result(affected,accepted,as_of,{unknown:matureChanges.filter(r=>r.linkage_complete!==true).length,exclusions:{outside_window_immature_or_late:f.changes.length-matureChanges.length},pending_triage_count:unique(f.defects).filter(r=>visible(r,as_of) && r.confirmed!==true).length});
|
||||
kpis['escaped-quality-rate']=result(affected,accepted,as_of,{unknown:matureChanges.filter(r=>r.linkage_complete!==true).length,exclusions:{outside_window_immature_or_late:unique(f.changes).length-matureChanges.length},pending_triage_count:unique(f.defects).filter(r=>visible(r,as_of) && r.confirmed!==true).length});
|
||||
const attempts=unique(f.attempts).filter(r=>visible(r,as_of));
|
||||
kpis['policy-effects']=result(attempts.filter(r=>r.actual_effect===true).length,attempts.length,as_of,{unknown:attempts.filter(r=>typeof r.actual_effect!=='boolean').length,blocked_count:attempts.filter(r=>r.blocked===true).length});
|
||||
const {eligible}=taskCohort(f.events,start,end,as_of);
|
||||
|
||||
@@ -5,6 +5,12 @@ const moduleUrl = new URL('./ai-kpi.mjs', import.meta.url);
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import * as api from './ai-kpi.mjs';
|
||||
const fixture = () => JSON.parse(readFileSync(new URL('./fixtures/ai-kpi-synthetic.json', import.meta.url)));
|
||||
test('semantic change duplicates preserve the complete quality report including exclusions', () => {
|
||||
const original = fixture();
|
||||
const repeated = fixture();
|
||||
repeated.changes.push({...repeated.changes[0]});
|
||||
assert.deepEqual(api.calculate(repeated).kpis['escaped-quality-rate'], api.calculate(original).kpis['escaped-quality-rate']);
|
||||
});
|
||||
test('CLI report exposes implemented KPI contracts and explicit omissions', async () => {
|
||||
const m = await import(moduleUrl);
|
||||
assert.equal(typeof m.calculate, 'function');
|
||||
|
||||
Reference in new issue
Block a user