@yasserkhanorg/e2e-agents 0.3.5 → 0.3.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAkR7C,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,OAAO,CAAC;CAClB;AAYD,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoSzF;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAiTtF"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/agent/runner.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AA+R7C,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,OAAO,CAAC;CAClB;AAYD,wBAAsB,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA6SzF;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA0TtF"}
@@ -160,6 +160,9 @@ function mergeCoverageWithHeuristicFallback(traceability, heuristic) {
160
160
  }
161
161
  return Array.from(byFlow.values());
162
162
  }
163
+ function buildMattermostFailClosedWarning(reason) {
164
+ return `${reason} Mattermost strict mode will emit uncovered flows as must-add-tests without heuristic fallback.`;
165
+ }
163
166
  function applyMattermostEvidencePolicy(config, state) {
164
167
  if (config.profile !== 'mattermost') {
165
168
  return {
@@ -171,6 +174,13 @@ function applyMattermostEvidencePolicy(config, state) {
171
174
  if (state.testMappingSource === 'heuristic') {
172
175
  throw new Error('Mattermost profile requires AI or catalog evidence for test selection. Heuristic-only mapping is not allowed.');
173
176
  }
177
+ if (state.failClosedTargeting) {
178
+ return {
179
+ coverage: state.coverage,
180
+ recommendedTests: state.recommendedTests,
181
+ testMappingSource: state.testMappingSource,
182
+ };
183
+ }
174
184
  if (state.testMappingSource !== 'catalog' && !state.traceabilityStats?.manifestFound) {
175
185
  throw new Error('Mattermost profile requires traceability evidence. Generate or refresh traceability manifest before impact run.');
176
186
  }
@@ -304,6 +314,7 @@ async function runImpact(_config, _options) {
304
314
  let flowMappingSource = catalog ? 'catalog' : 'heuristic';
305
315
  let testMappingSource = 'heuristic';
306
316
  let traceabilityStats;
317
+ let mattermostFailClosedTargeting = false;
307
318
  if (catalog) {
308
319
  flowCatalogSource = catalog.source;
309
320
  const mapping = (0, flow_mapping_js_1.mapChangesToCatalogFlows)(catalog, analysisTargets, 'impact', _config);
@@ -363,7 +374,9 @@ async function runImpact(_config, _options) {
363
374
  testMappingSource = 'ai';
364
375
  }
365
376
  else if (_config.profile === 'mattermost') {
366
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Refresh AI mapping inputs or provider configuration.');
377
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping did not produce target tests.'));
378
+ testMappingSource = 'ai';
379
+ mattermostFailClosedTargeting = true;
367
380
  }
368
381
  else {
369
382
  const heuristicCoverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
@@ -372,7 +385,8 @@ async function runImpact(_config, _options) {
372
385
  }
373
386
  }
374
387
  else if (_config.profile === 'mattermost') {
375
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Enable AI mapping for targeted selection.');
388
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping is disabled.'));
389
+ mattermostFailClosedTargeting = true;
376
390
  }
377
391
  else {
378
392
  const tests = (0, tests_js_1.discoverTests)(testsRoot, testPatterns.patterns);
@@ -392,14 +406,18 @@ async function runImpact(_config, _options) {
392
406
  testMappingSource = 'ai';
393
407
  }
394
408
  else if (_config.profile === 'mattermost') {
395
- throw new Error('Mattermost profile requires AI mapping because traceability evidence did not produce target tests.');
409
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping because traceability evidence did not produce target tests, but AI mapping returned no valid matches.'));
410
+ testMappingSource = 'ai';
411
+ mattermostFailClosedTargeting = true;
396
412
  }
397
413
  else {
398
414
  coverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
399
415
  }
400
416
  }
401
417
  else if (_config.profile === 'mattermost') {
402
- throw new Error('Mattermost profile requires traceability evidence or AI mapping to produce target tests.');
418
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires traceability evidence or AI mapping to produce target tests, but AI mapping is disabled.'));
419
+ testMappingSource = 'traceability';
420
+ mattermostFailClosedTargeting = true;
403
421
  }
404
422
  else {
405
423
  coverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
@@ -420,6 +438,7 @@ async function runImpact(_config, _options) {
420
438
  recommendedTests,
421
439
  testMappingSource,
422
440
  traceabilityStats,
441
+ failClosedTargeting: mattermostFailClosedTargeting,
423
442
  });
424
443
  coverage = mattermostAdjusted.coverage;
425
444
  recommendedTests = mattermostAdjusted.recommendedTests;
@@ -560,6 +579,7 @@ async function runGap(_config, _options) {
560
579
  let flowMappingSource = catalog ? 'catalog' : 'heuristic';
561
580
  let testMappingSource = 'heuristic';
562
581
  let traceabilityStats;
582
+ let mattermostFailClosedTargeting = false;
563
583
  if (catalog) {
564
584
  flowCatalogSource = catalog.source;
565
585
  const catalogMode = changedAppFiles.length > 0 ? 'impact' : 'gap';
@@ -632,7 +652,9 @@ async function runGap(_config, _options) {
632
652
  testMappingSource = 'ai';
633
653
  }
634
654
  else if (_config.profile === 'mattermost') {
635
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Refresh AI mapping inputs or provider configuration.');
655
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping did not produce target tests.'));
656
+ testMappingSource = 'ai';
657
+ mattermostFailClosedTargeting = true;
636
658
  }
637
659
  else {
638
660
  const heuristicCoverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
@@ -641,7 +663,8 @@ async function runGap(_config, _options) {
641
663
  }
642
664
  }
643
665
  else if (_config.profile === 'mattermost') {
644
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Enable AI mapping for targeted selection.');
666
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping is disabled.'));
667
+ mattermostFailClosedTargeting = true;
645
668
  }
646
669
  else {
647
670
  const tests = (0, tests_js_1.discoverTests)(testsRoot, testPatterns.patterns);
@@ -661,14 +684,18 @@ async function runGap(_config, _options) {
661
684
  testMappingSource = 'ai';
662
685
  }
663
686
  else if (_config.profile === 'mattermost') {
664
- throw new Error('Mattermost profile requires AI mapping because traceability evidence did not produce target tests.');
687
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping because traceability evidence did not produce target tests, but AI mapping returned no valid matches.'));
688
+ testMappingSource = 'ai';
689
+ mattermostFailClosedTargeting = true;
665
690
  }
666
691
  else {
667
692
  coverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
668
693
  }
669
694
  }
670
695
  else if (_config.profile === 'mattermost') {
671
- throw new Error('Mattermost profile requires traceability evidence or AI mapping to produce target tests.');
696
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires traceability evidence or AI mapping to produce target tests, but AI mapping is disabled.'));
697
+ testMappingSource = 'traceability';
698
+ mattermostFailClosedTargeting = true;
672
699
  }
673
700
  else {
674
701
  coverage = (0, tests_js_1.mapTestsToFlows)(flows, tests);
@@ -689,6 +716,7 @@ async function runGap(_config, _options) {
689
716
  recommendedTests,
690
717
  testMappingSource,
691
718
  traceabilityStats,
719
+ failClosedTargeting: mattermostFailClosedTargeting,
692
720
  });
693
721
  coverage = mattermostAdjusted.coverage;
694
722
  recommendedTests = mattermostAdjusted.recommendedTests;
@@ -156,6 +156,9 @@ function mergeCoverageWithHeuristicFallback(traceability, heuristic) {
156
156
  }
157
157
  return Array.from(byFlow.values());
158
158
  }
159
+ function buildMattermostFailClosedWarning(reason) {
160
+ return `${reason} Mattermost strict mode will emit uncovered flows as must-add-tests without heuristic fallback.`;
161
+ }
159
162
  function applyMattermostEvidencePolicy(config, state) {
160
163
  if (config.profile !== 'mattermost') {
161
164
  return {
@@ -167,6 +170,13 @@ function applyMattermostEvidencePolicy(config, state) {
167
170
  if (state.testMappingSource === 'heuristic') {
168
171
  throw new Error('Mattermost profile requires AI or catalog evidence for test selection. Heuristic-only mapping is not allowed.');
169
172
  }
173
+ if (state.failClosedTargeting) {
174
+ return {
175
+ coverage: state.coverage,
176
+ recommendedTests: state.recommendedTests,
177
+ testMappingSource: state.testMappingSource,
178
+ };
179
+ }
170
180
  if (state.testMappingSource !== 'catalog' && !state.traceabilityStats?.manifestFound) {
171
181
  throw new Error('Mattermost profile requires traceability evidence. Generate or refresh traceability manifest before impact run.');
172
182
  }
@@ -300,6 +310,7 @@ export async function runImpact(_config, _options) {
300
310
  let flowMappingSource = catalog ? 'catalog' : 'heuristic';
301
311
  let testMappingSource = 'heuristic';
302
312
  let traceabilityStats;
313
+ let mattermostFailClosedTargeting = false;
303
314
  if (catalog) {
304
315
  flowCatalogSource = catalog.source;
305
316
  const mapping = mapChangesToCatalogFlows(catalog, analysisTargets, 'impact', _config);
@@ -359,7 +370,9 @@ export async function runImpact(_config, _options) {
359
370
  testMappingSource = 'ai';
360
371
  }
361
372
  else if (_config.profile === 'mattermost') {
362
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Refresh AI mapping inputs or provider configuration.');
373
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping did not produce target tests.'));
374
+ testMappingSource = 'ai';
375
+ mattermostFailClosedTargeting = true;
363
376
  }
364
377
  else {
365
378
  const heuristicCoverage = mapTestsToFlows(flows, tests);
@@ -368,7 +381,8 @@ export async function runImpact(_config, _options) {
368
381
  }
369
382
  }
370
383
  else if (_config.profile === 'mattermost') {
371
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Enable AI mapping for targeted selection.');
384
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping is disabled.'));
385
+ mattermostFailClosedTargeting = true;
372
386
  }
373
387
  else {
374
388
  const tests = discoverTests(testsRoot, testPatterns.patterns);
@@ -388,14 +402,18 @@ export async function runImpact(_config, _options) {
388
402
  testMappingSource = 'ai';
389
403
  }
390
404
  else if (_config.profile === 'mattermost') {
391
- throw new Error('Mattermost profile requires AI mapping because traceability evidence did not produce target tests.');
405
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping because traceability evidence did not produce target tests, but AI mapping returned no valid matches.'));
406
+ testMappingSource = 'ai';
407
+ mattermostFailClosedTargeting = true;
392
408
  }
393
409
  else {
394
410
  coverage = mapTestsToFlows(flows, tests);
395
411
  }
396
412
  }
397
413
  else if (_config.profile === 'mattermost') {
398
- throw new Error('Mattermost profile requires traceability evidence or AI mapping to produce target tests.');
414
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires traceability evidence or AI mapping to produce target tests, but AI mapping is disabled.'));
415
+ testMappingSource = 'traceability';
416
+ mattermostFailClosedTargeting = true;
399
417
  }
400
418
  else {
401
419
  coverage = mapTestsToFlows(flows, tests);
@@ -416,6 +434,7 @@ export async function runImpact(_config, _options) {
416
434
  recommendedTests,
417
435
  testMappingSource,
418
436
  traceabilityStats,
437
+ failClosedTargeting: mattermostFailClosedTargeting,
419
438
  });
420
439
  coverage = mattermostAdjusted.coverage;
421
440
  recommendedTests = mattermostAdjusted.recommendedTests;
@@ -556,6 +575,7 @@ export async function runGap(_config, _options) {
556
575
  let flowMappingSource = catalog ? 'catalog' : 'heuristic';
557
576
  let testMappingSource = 'heuristic';
558
577
  let traceabilityStats;
578
+ let mattermostFailClosedTargeting = false;
559
579
  if (catalog) {
560
580
  flowCatalogSource = catalog.source;
561
581
  const catalogMode = changedAppFiles.length > 0 ? 'impact' : 'gap';
@@ -628,7 +648,9 @@ export async function runGap(_config, _options) {
628
648
  testMappingSource = 'ai';
629
649
  }
630
650
  else if (_config.profile === 'mattermost') {
631
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Refresh AI mapping inputs or provider configuration.');
651
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping did not produce target tests.'));
652
+ testMappingSource = 'ai';
653
+ mattermostFailClosedTargeting = true;
632
654
  }
633
655
  else {
634
656
  const heuristicCoverage = mapTestsToFlows(flows, tests);
@@ -637,7 +659,8 @@ export async function runGap(_config, _options) {
637
659
  }
638
660
  }
639
661
  else if (_config.profile === 'mattermost') {
640
- throw new Error('Mattermost profile requires AI mapping when traceability coverage is incomplete. Enable AI mapping for targeted selection.');
662
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping when traceability coverage is incomplete, but AI mapping is disabled.'));
663
+ mattermostFailClosedTargeting = true;
641
664
  }
642
665
  else {
643
666
  const tests = discoverTests(testsRoot, testPatterns.patterns);
@@ -657,14 +680,18 @@ export async function runGap(_config, _options) {
657
680
  testMappingSource = 'ai';
658
681
  }
659
682
  else if (_config.profile === 'mattermost') {
660
- throw new Error('Mattermost profile requires AI mapping because traceability evidence did not produce target tests.');
683
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires AI mapping because traceability evidence did not produce target tests, but AI mapping returned no valid matches.'));
684
+ testMappingSource = 'ai';
685
+ mattermostFailClosedTargeting = true;
661
686
  }
662
687
  else {
663
688
  coverage = mapTestsToFlows(flows, tests);
664
689
  }
665
690
  }
666
691
  else if (_config.profile === 'mattermost') {
667
- throw new Error('Mattermost profile requires traceability evidence or AI mapping to produce target tests.');
692
+ warnings.push(buildMattermostFailClosedWarning('Mattermost profile requires traceability evidence or AI mapping to produce target tests, but AI mapping is disabled.'));
693
+ testMappingSource = 'traceability';
694
+ mattermostFailClosedTargeting = true;
668
695
  }
669
696
  else {
670
697
  coverage = mapTestsToFlows(flows, tests);
@@ -685,6 +712,7 @@ export async function runGap(_config, _options) {
685
712
  recommendedTests,
686
713
  testMappingSource,
687
714
  traceabilityStats,
715
+ failClosedTargeting: mattermostFailClosedTargeting,
688
716
  });
689
717
  coverage = mattermostAdjusted.coverage;
690
718
  recommendedTests = mattermostAdjusted.recommendedTests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasserkhanorg/e2e-agents",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Pluggable LLM provider library for AI-powered test automation. Use Claude, Ollama, or your own LLM. Integrate with Playwright, Jest, or any test framework. MCP server for test agents, cost tracking, and hybrid provider mode.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",