quality-intelligence-engine 2.2.3 → 2.2.4
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.
- package/.github/workflows/playwright.yml +27 -0
- package/.github/workflows/quality-intelligence.yml +45 -0
- package/CHANGELOG.md +164 -0
- package/REFACTORING_SUMMARY.md +417 -0
- package/artifacts/failure-analysis/run-1769595909824-login_with_valid_user.md +25 -0
- package/artifacts/failure-analysis/run-1769596445203-login_with_valid_user.md +25 -0
- package/artifacts/failure-analysis/run-1769596573162-login_with_valid_user.md +34 -0
- package/artifacts/failure-analysis/run-1769596591727-login_with_valid_user.md +25 -0
- package/artifacts/failure-analysis/run-1769596600117-login_with_valid_user.md +34 -0
- package/artifacts/failure-analysis/run-1769596782107-login_with_valid_user.md +32 -0
- package/artifacts/failure-analysis/run-1769596940770-login_with_valid_user.md +28 -0
- package/artifacts/failure-analysis/run-1769596960417-login_with_valid_user.md +28 -0
- package/artifacts/failure-analysis/run-1769596981303-login_with_valid_user.md +28 -0
- package/artifacts/failure-analysis/run-1769597351831-login_with_valid_user.md +21 -0
- package/artifacts/failure-analysis/run-1769597486816-login_with_valid_user.md +21 -0
- package/artifacts/failure-analysis/run-1769599708378-login_with_valid_user.md +22 -0
- package/artifacts/failure-analysis/run-1769600327960-login_with_valid_user.md +22 -0
- package/artifacts/failure-analysis/run-1769600596201-saucedemo__login_fails_with_wrong_password_fail.md +22 -0
- package/artifacts/failure-analysis/run-1769600682675-saucedemo__login_fails_with_wrong_password_fail.md +22 -0
- package/artifacts/failure-analysis/run-1769602090701-saucedemo__add_to_cart_button_is_hidden_fail.md +30 -0
- package/artifacts/failure-analysis/run-1769602090701-saucedemo__cart_count_updates_to_2_after_adding_one_item_fail.md +30 -0
- package/artifacts/failure-analysis/run-1769602090701-saucedemo__checkout_navigates_to_payment_page_directly_fail.md +30 -0
- package/artifacts/failure-analysis/run-1769602090701-saucedemo__inventory_shows_10_products_fail.md +30 -0
- package/artifacts/failure-analysis/run-1769602090701-saucedemo__products_sorted_high_to_low_start_with_999_fail.md +30 -0
- package/artifacts/failure-history/1769696674298.json +9 -0
- package/artifacts/failure-history/1769697768622.json +10 -0
- package/artifacts/failure-history/1769697923557.json +10 -0
- package/artifacts/failure-history/1769698160213.json +11 -0
- package/artifacts/failure-history/1769698353440.json +11 -0
- package/artifacts/failure-history/1769698763306.json +11 -0
- package/artifacts/failure-history/1769698878947.json +11 -0
- package/artifacts/failure-history/1769699909817.json +11 -0
- package/artifacts/failure-history/1769703130913.json +11 -0
- package/artifacts/failure-history/1769703142113.json +11 -0
- package/artifacts/failure-history/1769703158978.json +11 -0
- package/artifacts/failure-history/1769703406025.json +11 -0
- package/artifacts/failure-history/1769703422720.json +11 -0
- package/artifacts/failure-history/1769703518837.json +11 -0
- package/artifacts/failure-history/1769703530419.json +11 -0
- package/artifacts/failure-history/1769703577078.json +11 -0
- package/artifacts/failure-history/1769704067098.json +11 -0
- package/artifacts/failure-history/1769704074618.json +11 -0
- package/artifacts/failure-history/1769704084948.json +11 -0
- package/artifacts/failure-history/1769704091950.json +11 -0
- package/artifacts/failure-history/1769704435355.json +11 -0
- package/artifacts/failure-history/1769704832871.json +11 -0
- package/artifacts/failure-history/1769707051830.json +11 -0
- package/artifacts/failure-history/1769739820395.json +11 -0
- package/artifacts/failure-history/1769739820400.json +11 -0
- package/artifacts/failure-history/1769742422254.json +11 -0
- package/artifacts/failure-history/1769743106016.json +11 -0
- package/artifacts/failure-history/1769743121857.json +11 -0
- package/artifacts/failure-history/1769750875212.json +11 -0
- package/artifacts/failure-history/1769750880790.json +11 -0
- package/artifacts/failure-history/1769761177923.json +11 -0
- package/artifacts/failure-history/1769761191176.json +11 -0
- package/bin/qi.ts +37 -0
- package/config/agent.config.json +18 -0
- package/data/failures/fingerprints/0ded7b45.json +10 -0
- package/data/failures/fingerprints/2437666a.json +8 -0
- package/data/failures/fingerprints/3746e3b4.json +42 -0
- package/data/failures/fingerprints/533e258f.json +10 -0
- package/data/failures/fingerprints/56b547d3.json +10 -0
- package/data/failures/fingerprints/693661fa.json +10 -0
- package/data/failures/fingerprints/789126b1.json +8 -0
- package/data/failures/fingerprints/936d995e.json +10 -0
- package/data/failures/fingerprints/ba5f6c0a.json +10 -0
- package/data/failures/fingerprints/f148a261.json +56 -0
- package/data/failures/fingerprints/fa14440f.json +14 -0
- package/data/failures/registry.json +57 -0
- package/data/flakiness/history.json +71 -0
- package/dist/bin/qi.js +0 -0
- package/dist/src/intelligence/failure-fingerprinting/failure.classifier.js +5 -1
- package/dist/src/intelligence/failure-fingerprinting/failure.tracker.js +5 -0
- package/dist/src/playwright/qi.reporter.js +17 -0
- package/final.sanity.test.ts +46 -0
- package/input/raw-failure.json +36 -0
- package/input/raw-pass.json +33 -0
- package/output/run-2026-01-28_02-48-38-420/BACKEND_API_FAILURE-AuthController.java-/users/{id}/analysis.md +50 -0
- package/output/run-2026-01-28_02-48-38-420/TEST_FAILURE-Unknown--/analysis.md +50 -0
- package/output/run-2026-01-28_02-48-52-140/BACKEND_API_FAILURE-AuthController.java-/users/{id}/analysis.md +50 -0
- package/output/run-2026-01-28_02-48-52-140/TEST_FAILURE-Unknown--/analysis.md +50 -0
- package/output/run-2026-01-28_03-13-16-302/BACKEND_API_FAILURE-AuthController.java-/users/{id}/analysis.md +50 -0
- package/output/run-2026-01-28_03-13-16-302/PASS-checkout.spec.ts-API_WARNING/analysis.md +49 -0
- package/output/run-2026-01-28_03-13-16-302/PASS-login.spec.ts-FLAKY_PASS/analysis.md +49 -0
- package/output/run-2026-01-28_03-13-16-302/TEST_FAILURE-Unknown--/analysis.md +50 -0
- package/output/run-2026-01-28_03-29-49-786/BACKEND_API_FAILURE-AuthController.java-/users/{id}/analysis.md +50 -0
- package/package.json +4 -10
- package/playwright-results/.last-run.json +17 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium/video.webm +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--chromium-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox/video.webm +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--firefox-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit/video.webm +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-email-like-valid-d5dc6-rname-format-rejected-FAIL--webkit-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--chromium-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--firefox-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-7c4f3-to-cart-button-hidden-FAIL--webkit-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--chromium-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--firefox-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit-retry1/error-context.md +112 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-cd423-entory-count-mismatch-FAIL--webkit-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--chromium-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--firefox-retry1/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit/video.webm +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit-retry1/error-context.md +31 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit-retry1/test-failed-1.png +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit-retry1/trace.zip +0 -0
- package/playwright-results/saucedemo-numeric-mismatch-f085e-E-unauthorized-access-FAIL--webkit-retry1/video.webm +0 -0
- package/playwright.config.ts +42 -0
- package/quality-intelligence-engine-2.2.0.tgz +0 -0
- package/quality-intelligence-engine-2.2.2.tgz +0 -0
- package/sanity.test.ts +33 -0
- package/src/adapters/playwright-folder.adapter.ts +85 -0
- package/src/adapters/playwright-json.adapter.ts +49 -0
- package/src/adapters/playwright.adapter.ts +44 -0
- package/src/cli/qi-test.ts +20 -0
- package/src/cli/qi.ts +67 -0
- package/src/cli/ui/divider.ts +9 -0
- package/src/cli/ui/failureLogger.ts +33 -0
- package/src/configLoader.ts +70 -0
- package/src/console/issue-view.ts +193 -0
- package/src/failure-analysis/failure-analyzer.ts +43 -0
- package/src/final-run.ts +174 -0
- package/src/final-runner.ts +31 -0
- package/src/fixtures/networkCollector.ts +27 -0
- package/src/history/failure-history.store.ts +23 -0
- package/src/history/failure-history.types.ts +12 -0
- package/src/history/failure-trend.analyzer.ts +49 -0
- package/src/index.ts +10 -0
- package/src/integrations/ci/ci-annotator.ts +42 -0
- package/src/intelligence/confidence-calibration.engine.ts +41 -0
- package/src/intelligence/decision-intelligence/confidence.engine.ts +18 -0
- package/src/intelligence/decision-intelligence/decision.config.ts +18 -0
- package/src/intelligence/decision-intelligence/decision.engine.ts +30 -0
- package/src/intelligence/decision-intelligence/decision.types.ts +15 -0
- package/src/intelligence/failure-fingerprinting/failure.classifier.ts +61 -0
- package/src/intelligence/failure-fingerprinting/failure.store.ts +42 -0
- package/src/intelligence/failure-fingerprinting/failure.tracker.ts +28 -0
- package/src/intelligence/failure-fingerprinting/fingerprint.generator.ts +28 -0
- package/src/intelligence/failure-fingerprinting/fingerprint.types.ts +14 -0
- package/src/intelligence/flakiness-intelligence/flakiness.analyzer.ts +23 -0
- package/src/intelligence/flakiness-intelligence/flakiness.fingerprint.ts +14 -0
- package/src/intelligence/flakiness-intelligence/flakiness.store.ts +24 -0
- package/src/intelligence/flakiness-intelligence/flakiness.tracker.ts +42 -0
- package/src/intelligence/flakiness-intelligence/flakiness.types.ts +8 -0
- package/src/intelligence/intelligence.pipeline.ts +20 -0
- package/src/intelligence/llm-explainer.ts +29 -0
- package/src/intelligence/root-cause/rootcause.engine.ts +46 -0
- package/src/intelligence/trend-intelligence/trend.engine.ts +42 -0
- package/src/markdownWriter.ts +68 -0
- package/src/normalizer.ts +31 -0
- package/src/passAnalyzer.ts +38 -0
- package/src/pipeline/ai.summarizer.ts +39 -0
- package/src/pipeline/failure-analysis.pipeline.ts +13 -0
- package/src/pipeline/failure-grouping.pipeline.ts +67 -0
- package/src/playwright/qi.reporter.ts +26 -0
- package/src/reporter.ts +88 -0
- package/src/reporters/qi-reporter.js +34 -0
- package/src/rules.ts +35 -0
- package/src/runManager.ts +21 -0
- package/src/runner.ts +12 -0
- package/src/runtime/networkCollector.ts +36 -0
- package/src/stackParser.ts +22 -0
- package/src/test-run.ts +59 -0
- package/src/types/analysis-result.ts +16 -0
- package/src/types/failure.types.ts +28 -0
- package/src/types/playwright-failure.ts +10 -0
- package/src/types.ts +102 -0
- package/src/utils/artifact.locator.ts +42 -0
- package/src/utils/confidence-constants.ts +111 -0
- package/src/utils/file-utils.ts +146 -0
- package/src/v2/llm/llm-advisor.ts +22 -0
- package/src/v2/pipeline/v2-intelligence.pipeline.ts +21 -0
- package/src/v2/self-healing/self-healer.ts +60 -0
- package/src/v2/trace-intelligence/trace-analyzer.ts +42 -0
- package/src/v2-test-run.ts +74 -0
- package/tests/fixtures.ts +40 -0
- package/tests/saucedemo-login-validation.spec.ts +74 -0
- package/tsconfig.json +16 -0
- package/tsconfig.playwright.json +13 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// src/console/issue-view.ts
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
|
|
6
|
+
export interface Issue {
|
|
7
|
+
type: string;
|
|
8
|
+
occurrences: number;
|
|
9
|
+
confidence: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IssueFilter {
|
|
13
|
+
topN?: number;
|
|
14
|
+
keyword?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface IssueDecision {
|
|
18
|
+
autoHeal: boolean;
|
|
19
|
+
reason: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface IssueOwner {
|
|
23
|
+
team: "Backend" | "Frontend" | "QA";
|
|
24
|
+
reason: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IssueEvidence {
|
|
28
|
+
screenshot?: string;
|
|
29
|
+
trace?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* ---------------- Issue Core ---------------- */
|
|
33
|
+
|
|
34
|
+
export function extractIssues(
|
|
35
|
+
groupedCounts: Record<string, number>,
|
|
36
|
+
confidence: number
|
|
37
|
+
): Issue[] {
|
|
38
|
+
return Object.entries(groupedCounts).map(([type, count]) => ({
|
|
39
|
+
type,
|
|
40
|
+
occurrences: count,
|
|
41
|
+
confidence
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* ---------------- Decision Logic ---------------- */
|
|
46
|
+
|
|
47
|
+
function computeIssueDecision(issue: Issue): IssueDecision {
|
|
48
|
+
switch (issue.type) {
|
|
49
|
+
case "FLAKY":
|
|
50
|
+
return {
|
|
51
|
+
autoHeal: true,
|
|
52
|
+
reason: "Retry-based flaky behavior detected; stabilization is safe"
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
case "NUMERIC_MISMATCH":
|
|
56
|
+
return {
|
|
57
|
+
autoHeal: false,
|
|
58
|
+
reason: "Numeric mismatch likely backend or data-related"
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
default:
|
|
62
|
+
return {
|
|
63
|
+
autoHeal: false,
|
|
64
|
+
reason: "Insufficient signal to safely auto-heal"
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* ---------------- Owner Suggestion ---------------- */
|
|
70
|
+
|
|
71
|
+
function computeIssueOwner(issue: Issue): IssueOwner {
|
|
72
|
+
switch (issue.type) {
|
|
73
|
+
case "NUMERIC_MISMATCH":
|
|
74
|
+
return {
|
|
75
|
+
team: "Backend",
|
|
76
|
+
reason: "Mismatch usually originates from API data or backend calculations"
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
case "FLAKY":
|
|
80
|
+
return {
|
|
81
|
+
team: "QA",
|
|
82
|
+
reason: "Flaky behavior typically caused by timing, waits, or test stability"
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
case "UNKNOWN":
|
|
86
|
+
default:
|
|
87
|
+
return {
|
|
88
|
+
team: "Frontend",
|
|
89
|
+
reason: "Failure source unclear; frontend investigation needed first"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ---------------- Evidence Picker ---------------- */
|
|
95
|
+
|
|
96
|
+
function pickIssueEvidence(failureFolder: string): IssueEvidence {
|
|
97
|
+
if (!fs.existsSync(failureFolder)) return {};
|
|
98
|
+
|
|
99
|
+
const files = fs.readdirSync(failureFolder);
|
|
100
|
+
|
|
101
|
+
const screenshot = files.find(
|
|
102
|
+
f => f.startsWith("test-failed") && f.endsWith(".png")
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const trace = files.includes("trace.zip") ? "trace.zip" : undefined;
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
screenshot: screenshot
|
|
109
|
+
? path.join(failureFolder, screenshot)
|
|
110
|
+
: undefined,
|
|
111
|
+
trace: trace
|
|
112
|
+
? path.join(failureFolder, trace)
|
|
113
|
+
: undefined
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---------------- Filtering ---------------- */
|
|
118
|
+
|
|
119
|
+
export function filterIssues(
|
|
120
|
+
issues: Issue[],
|
|
121
|
+
filter: IssueFilter
|
|
122
|
+
): Issue[] {
|
|
123
|
+
let result = [...issues];
|
|
124
|
+
|
|
125
|
+
if (filter.keyword) {
|
|
126
|
+
const k = filter.keyword.toLowerCase();
|
|
127
|
+
result = result.filter(i =>
|
|
128
|
+
i.type.toLowerCase().includes(k)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
result.sort(
|
|
133
|
+
(a, b) =>
|
|
134
|
+
b.occurrences * b.confidence -
|
|
135
|
+
a.occurrences * a.confidence
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
if (filter.topN !== undefined) {
|
|
139
|
+
result = result.slice(0, filter.topN);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ---------------- Console Output ---------------- */
|
|
146
|
+
|
|
147
|
+
export function printIssues(
|
|
148
|
+
issues: Issue[],
|
|
149
|
+
failureFolder: string
|
|
150
|
+
) {
|
|
151
|
+
if (issues.length === 0) {
|
|
152
|
+
console.log("No matching issues found.");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const evidence = pickIssueEvidence(failureFolder);
|
|
157
|
+
|
|
158
|
+
issues.forEach((issue, index) => {
|
|
159
|
+
const decision = computeIssueDecision(issue);
|
|
160
|
+
const owner = computeIssueOwner(issue);
|
|
161
|
+
|
|
162
|
+
console.log(
|
|
163
|
+
`================ ISSUE #${index + 1} =================`
|
|
164
|
+
);
|
|
165
|
+
console.log(`Type : ${issue.type}`);
|
|
166
|
+
console.log(`Occurrences : ${issue.occurrences}`);
|
|
167
|
+
console.log(`Confidence : ${issue.confidence}`);
|
|
168
|
+
|
|
169
|
+
console.log("Decision:");
|
|
170
|
+
console.log(` - Auto-heal: ${decision.autoHeal ? "YES" : "NO"}`);
|
|
171
|
+
console.log(` - Reason : ${decision.reason}`);
|
|
172
|
+
|
|
173
|
+
console.log("Owner:");
|
|
174
|
+
console.log(` - Team : ${owner.team}`);
|
|
175
|
+
console.log(` - Why : ${owner.reason}`);
|
|
176
|
+
|
|
177
|
+
if (evidence.screenshot || evidence.trace) {
|
|
178
|
+
console.log("\nEvidence:");
|
|
179
|
+
if (evidence.screenshot) {
|
|
180
|
+
console.log(` Screenshot : ${evidence.screenshot}`);
|
|
181
|
+
}
|
|
182
|
+
if (evidence.trace) {
|
|
183
|
+
console.log(
|
|
184
|
+
` Trace : npx playwright show-trace ${evidence.trace}`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
console.log(
|
|
190
|
+
"======================================================"
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/failure-analysis/failure-analyzer.ts
|
|
2
|
+
|
|
3
|
+
export interface FailureAnalysisResult {
|
|
4
|
+
classification: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* FailureAnalyzer
|
|
10
|
+
* ----------------
|
|
11
|
+
* Phase 1 core analyzer.
|
|
12
|
+
* This class is intentionally simple and stable.
|
|
13
|
+
* Do NOT add history, trends, or intelligence here.
|
|
14
|
+
*/
|
|
15
|
+
export class FailureAnalyzer {
|
|
16
|
+
analyze(input: any): FailureAnalysisResult[] {
|
|
17
|
+
if (!input || !Array.isArray(input)) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return input.map((item: any) => {
|
|
22
|
+
// Minimal safe classification logic
|
|
23
|
+
if (item?.type === "NUMERIC_MISMATCH") {
|
|
24
|
+
return {
|
|
25
|
+
classification: "NUMERIC_MISMATCH",
|
|
26
|
+
message: item.message
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (item?.type === "API_BUG") {
|
|
31
|
+
return {
|
|
32
|
+
classification: "API_BUG",
|
|
33
|
+
message: item.message
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
classification: "UNKNOWN",
|
|
39
|
+
message: item?.message
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
package/src/final-run.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// src/final-run.ts
|
|
2
|
+
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { runQualityIntelligence } from "./runner";
|
|
6
|
+
import { runV2Intelligence } from "./v2/pipeline/v2-intelligence.pipeline";
|
|
7
|
+
import {
|
|
8
|
+
extractIssues,
|
|
9
|
+
filterIssues,
|
|
10
|
+
printIssues
|
|
11
|
+
} from "./console/issue-view";
|
|
12
|
+
|
|
13
|
+
function pickOneFailureFolder(): string | null {
|
|
14
|
+
const base = "playwright-results";
|
|
15
|
+
if (!fs.existsSync(base)) return null;
|
|
16
|
+
|
|
17
|
+
const entries = fs.readdirSync(base, { withFileTypes: true });
|
|
18
|
+
const folder = entries.find(e => e.isDirectory());
|
|
19
|
+
return folder ? path.join(base, folder.name) : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function line(char = "=", count = 70) {
|
|
23
|
+
console.log(char.repeat(count));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Parse --issues / --issue flags
|
|
28
|
+
*
|
|
29
|
+
* Supported:
|
|
30
|
+
* --issues
|
|
31
|
+
* --issues=top3
|
|
32
|
+
* --issues=login
|
|
33
|
+
* --issue
|
|
34
|
+
* --issue=top3
|
|
35
|
+
* --issue=login
|
|
36
|
+
*/
|
|
37
|
+
function parseIssueFilter(): {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
topN?: number;
|
|
40
|
+
keyword?: string;
|
|
41
|
+
} {
|
|
42
|
+
const arg = process.argv.find(a =>
|
|
43
|
+
a === "--issues" ||
|
|
44
|
+
a === "--issue" ||
|
|
45
|
+
a.startsWith("--issues=") ||
|
|
46
|
+
a.startsWith("--issue=")
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (!arg) return { enabled: false };
|
|
50
|
+
|
|
51
|
+
if (arg === "--issues" || arg === "--issue") {
|
|
52
|
+
return { enabled: true };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const [, value] = arg.split("=");
|
|
56
|
+
|
|
57
|
+
if (value?.startsWith("top")) {
|
|
58
|
+
const n = Number(value.replace("top", ""));
|
|
59
|
+
return { enabled: true, topN: n };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { enabled: true, keyword: value };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ===================================================== */
|
|
66
|
+
/* ✅ EXPORTED FUNCTION – SAME LOGIC, NO BEHAVIOR CHANGE */
|
|
67
|
+
/* ===================================================== */
|
|
68
|
+
export async function runFinal() {
|
|
69
|
+
const playwrightResultsDir = "playwright-results";
|
|
70
|
+
const failureFolder = pickOneFailureFolder();
|
|
71
|
+
const issueFilter = parseIssueFilter();
|
|
72
|
+
|
|
73
|
+
if (!failureFolder) {
|
|
74
|
+
console.error("No Playwright failure folders found.");
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ---------------- V1 + Phase 3 ---------------- */
|
|
79
|
+
const v1 = await runQualityIntelligence(playwrightResultsDir);
|
|
80
|
+
|
|
81
|
+
line();
|
|
82
|
+
console.log("QUALITY INTELLIGENCE – FINAL PROJECT OUTPUT");
|
|
83
|
+
line();
|
|
84
|
+
|
|
85
|
+
console.log(`Primary Failure : ${v1.dominantCategory}`);
|
|
86
|
+
console.log(`Confidence Score : ${v1.confidence}`);
|
|
87
|
+
console.log(`Flaky Failures : ${v1.flakyCount}`);
|
|
88
|
+
console.log(`Trend Signal : ${v1.trend?.signal ?? "N/A"}`);
|
|
89
|
+
|
|
90
|
+
line("-");
|
|
91
|
+
console.log("Failure Breakdown:");
|
|
92
|
+
Object.entries(v1.groupedCounts).forEach(([k, v]) => {
|
|
93
|
+
console.log(` - ${k}: ${v}`);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
line("-");
|
|
97
|
+
console.log("Confidence Diagnosis:");
|
|
98
|
+
v1.intelligence.confidence.explanation.forEach(e =>
|
|
99
|
+
console.log(` • ${e}`)
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
line("-");
|
|
103
|
+
console.log("AI Explanation:");
|
|
104
|
+
console.log(` Summary: ${v1.intelligence.explanation.summary}`);
|
|
105
|
+
v1.intelligence.explanation.reasoning.forEach(r =>
|
|
106
|
+
console.log(` - ${r}`)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
/* ---------------- V2 ---------------- */
|
|
110
|
+
const v2 = await runV2Intelligence(
|
|
111
|
+
failureFolder,
|
|
112
|
+
v1.dominantCategory,
|
|
113
|
+
"Derived from Playwright failure artifacts"
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
line("-");
|
|
117
|
+
console.log("TRACE & SELF-HEALING INTELLIGENCE");
|
|
118
|
+
|
|
119
|
+
console.log("\nEvidence:");
|
|
120
|
+
if (v2.trace.screenshots.length) {
|
|
121
|
+
v2.trace.screenshots.forEach(s =>
|
|
122
|
+
console.log(` Screenshot: ${s}`)
|
|
123
|
+
);
|
|
124
|
+
} else {
|
|
125
|
+
console.log(" No screenshots found");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (v2.trace.traceFile) {
|
|
129
|
+
console.log(` Trace File : ${v2.trace.traceFile}`);
|
|
130
|
+
console.log(` Open Trace : npx playwright show-trace ${v2.trace.traceFile}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
line("-");
|
|
134
|
+
console.log("Self-Healing Decision:");
|
|
135
|
+
if (v2.healing) {
|
|
136
|
+
console.log(` Allowed : YES`);
|
|
137
|
+
console.log(` Reason : ${v2.healing.reason}`);
|
|
138
|
+
console.log(` Fix : ${v2.healing.suggestedFix}`);
|
|
139
|
+
console.log(` Confidence : ${v2.healing.confidence}`);
|
|
140
|
+
} else {
|
|
141
|
+
console.log(` Allowed : NO (manual fix required)`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
line("-");
|
|
145
|
+
console.log("LLM Advisory:");
|
|
146
|
+
console.log(` ${v2.llm.summary}`);
|
|
147
|
+
v2.llm.fixRecommendation.forEach(r =>
|
|
148
|
+
console.log(` - ${r}`)
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
/* ---------------- ISSUE VIEW (OPTIONAL) ---------------- */
|
|
152
|
+
if (issueFilter.enabled) {
|
|
153
|
+
line();
|
|
154
|
+
console.log("ISSUE ANALYSIS");
|
|
155
|
+
line();
|
|
156
|
+
|
|
157
|
+
const issues = extractIssues(
|
|
158
|
+
v1.groupedCounts,
|
|
159
|
+
v1.confidence
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
const filtered = filterIssues(issues, issueFilter);
|
|
163
|
+
printIssues(filtered, failureFolder);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
line();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* ===================================================== */
|
|
170
|
+
/* ✅ KEEP EXISTING BEHAVIOR WHEN RUN DIRECTLY */
|
|
171
|
+
/* ===================================================== */
|
|
172
|
+
if (require.main === module) {
|
|
173
|
+
runFinal();
|
|
174
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
export async function runFinalOutput(options: {
|
|
5
|
+
playwrightResultsDir: string;
|
|
6
|
+
showIssues?: boolean;
|
|
7
|
+
}) {
|
|
8
|
+
const args: string[] = [];
|
|
9
|
+
|
|
10
|
+
if (options.showIssues) {
|
|
11
|
+
args.push("--issue");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// run existing final-run.ts via ts-node / node
|
|
15
|
+
const scriptPath = path.join(__dirname, "final-run.ts");
|
|
16
|
+
|
|
17
|
+
return new Promise<void>((resolve, reject) => {
|
|
18
|
+
const proc = spawn(
|
|
19
|
+
"node",
|
|
20
|
+
["--loader", "ts-node/esm", scriptPath, ...args],
|
|
21
|
+
{
|
|
22
|
+
stdio: "inherit"
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
proc.on("close", code => {
|
|
27
|
+
if (code === 0) resolve();
|
|
28
|
+
else reject(new Error(`final-run exited with ${code}`));
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { test as base, Page } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
export type NetworkResponseRecord = {
|
|
4
|
+
url: string;
|
|
5
|
+
method: string;
|
|
6
|
+
status: number;
|
|
7
|
+
ok: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const test = base.extend<{
|
|
11
|
+
networkResponses: NetworkResponseRecord[];
|
|
12
|
+
}>({
|
|
13
|
+
networkResponses: async ({ page }, use) => {
|
|
14
|
+
const responses: NetworkResponseRecord[] = [];
|
|
15
|
+
|
|
16
|
+
page.on('response', async response => {
|
|
17
|
+
responses.push({
|
|
18
|
+
url: response.url(),
|
|
19
|
+
method: response.request().method(),
|
|
20
|
+
status: response.status(),
|
|
21
|
+
ok: response.ok()
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await use(responses);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { FailureHistoryEntry } from "./failure-history.types";
|
|
4
|
+
|
|
5
|
+
const HISTORY_DIR = path.join(process.cwd(), "artifacts/failure-history");
|
|
6
|
+
|
|
7
|
+
export function saveFailureHistory(entry: FailureHistoryEntry): void {
|
|
8
|
+
if (!fs.existsSync(HISTORY_DIR)) {
|
|
9
|
+
fs.mkdirSync(HISTORY_DIR, { recursive: true });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const filePath = path.join(HISTORY_DIR, `${entry.runId}.json`);
|
|
13
|
+
fs.writeFileSync(filePath, JSON.stringify(entry, null, 2));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function loadFailureHistory(): FailureHistoryEntry[] {
|
|
17
|
+
if (!fs.existsSync(HISTORY_DIR)) return [];
|
|
18
|
+
|
|
19
|
+
return fs.readdirSync(HISTORY_DIR).map(file => {
|
|
20
|
+
const fullPath = path.join(HISTORY_DIR, file);
|
|
21
|
+
return JSON.parse(fs.readFileSync(fullPath, "utf-8"));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// History layer is DECOUPLED from pipeline
|
|
2
|
+
// No dependency on FailureType to avoid path issues
|
|
3
|
+
|
|
4
|
+
export type FailureType = string;
|
|
5
|
+
|
|
6
|
+
export interface FailureHistoryEntry {
|
|
7
|
+
runId: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
dominantCategory: FailureType;
|
|
10
|
+
groupedCounts: Record<FailureType, number>;
|
|
11
|
+
confidence: number; // 0–1
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FailureHistoryEntry } from "./failure-history.types";
|
|
2
|
+
|
|
3
|
+
export interface FailureTrendResult {
|
|
4
|
+
recurring: boolean;
|
|
5
|
+
dominantCategory: string;
|
|
6
|
+
occurrences: number;
|
|
7
|
+
confidenceTrend: "increasing" | "decreasing" | "stable";
|
|
8
|
+
signal: "ESCALATING" | "STABLE" | "NOISY";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function analyzeFailureTrends(
|
|
12
|
+
history: FailureHistoryEntry[]
|
|
13
|
+
): FailureTrendResult | null {
|
|
14
|
+
if (history.length < 2) return null;
|
|
15
|
+
|
|
16
|
+
const recent = history.slice(-5);
|
|
17
|
+
const categoryCount: Record<string, number> = {};
|
|
18
|
+
|
|
19
|
+
for (const h of recent) {
|
|
20
|
+
categoryCount[h.dominantCategory] =
|
|
21
|
+
(categoryCount[h.dominantCategory] || 0) + 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const [dominantCategory, occurrences] =
|
|
25
|
+
Object.entries(categoryCount).sort((a, b) => b[1] - a[1])[0];
|
|
26
|
+
|
|
27
|
+
const first = recent[0].confidence;
|
|
28
|
+
const last = recent[recent.length - 1].confidence;
|
|
29
|
+
|
|
30
|
+
const confidenceTrend =
|
|
31
|
+
last > first ? "increasing" :
|
|
32
|
+
last < first ? "decreasing" :
|
|
33
|
+
"stable";
|
|
34
|
+
|
|
35
|
+
const signal =
|
|
36
|
+
occurrences >= 3 && confidenceTrend === "increasing"
|
|
37
|
+
? "ESCALATING"
|
|
38
|
+
: occurrences >= 3
|
|
39
|
+
? "STABLE"
|
|
40
|
+
: "NOISY";
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
recurring: occurrences >= 2,
|
|
44
|
+
dominantCategory,
|
|
45
|
+
occurrences,
|
|
46
|
+
confidenceTrend,
|
|
47
|
+
signal
|
|
48
|
+
};
|
|
49
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { groupFailures } from "./pipeline/failure-grouping.pipeline";
|
|
2
|
+
|
|
3
|
+
const fakeRun = [
|
|
4
|
+
{ classification: "NUMERIC_MISMATCH", message: "price mismatch" },
|
|
5
|
+
{ classification: "NUMERIC_MISMATCH", message: "tax mismatch" },
|
|
6
|
+
{ classification: "API_BUG", message: "500 error" }
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const result = groupFailures(fakeRun);
|
|
10
|
+
console.log(JSON.stringify(result, null, 2));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type AnnotationInput = {
|
|
2
|
+
testName: string
|
|
3
|
+
file: string
|
|
4
|
+
line: number
|
|
5
|
+
message: string
|
|
6
|
+
confidence: number
|
|
7
|
+
rootCause: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function emitCIAnnotation(input: AnnotationInput) {
|
|
11
|
+
// -----------------------------
|
|
12
|
+
// GitHub Actions annotation
|
|
13
|
+
// -----------------------------
|
|
14
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
15
|
+
console.log(
|
|
16
|
+
`::error file=${input.file},line=${input.line},title=${sanitize(
|
|
17
|
+
input.testName
|
|
18
|
+
)}::${sanitize(
|
|
19
|
+
`${input.rootCause} (confidence ${(input.confidence / 100).toFixed(
|
|
20
|
+
2
|
|
21
|
+
)})`
|
|
22
|
+
)}`
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// -----------------------------
|
|
27
|
+
// GitLab CI annotation (job log)
|
|
28
|
+
// -----------------------------
|
|
29
|
+
if (process.env.GITLAB_CI) {
|
|
30
|
+
console.log(`
|
|
31
|
+
❌ CI Failure Annotation
|
|
32
|
+
Test : ${input.testName}
|
|
33
|
+
File : ${input.file}:${input.line}
|
|
34
|
+
Root Cause : ${input.rootCause}
|
|
35
|
+
Confidence : ${(input.confidence / 100).toFixed(2)}
|
|
36
|
+
`)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function sanitize(value: string): string {
|
|
41
|
+
return value.replace(/[\n\r]/g, ' ')
|
|
42
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/intelligence/confidence-calibration.engine.ts
|
|
2
|
+
|
|
3
|
+
import { FailureGroupSummary } from "../pipeline/failure-grouping.pipeline";
|
|
4
|
+
|
|
5
|
+
export interface ConfidenceExplanation {
|
|
6
|
+
score: number;
|
|
7
|
+
explanation: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function explainConfidence(
|
|
11
|
+
summary: FailureGroupSummary
|
|
12
|
+
): ConfidenceExplanation {
|
|
13
|
+
const explanation: string[] = [];
|
|
14
|
+
|
|
15
|
+
explanation.push(
|
|
16
|
+
"Base confidence calculated from dominant failure frequency"
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
if (summary.flakyCount > 0) {
|
|
20
|
+
explanation.push(
|
|
21
|
+
`${summary.flakyCount} flaky (retry-based) failures detected, reducing confidence`
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (summary.trend?.signal === "NOISY") {
|
|
26
|
+
explanation.push(
|
|
27
|
+
"Multiple failure categories reduce certainty"
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (summary.trend?.signal === "STABLE") {
|
|
32
|
+
explanation.push(
|
|
33
|
+
"Failure pattern is consistent but not escalating"
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
score: summary.confidence,
|
|
39
|
+
explanation
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DecisionContext } from './decision.types'
|
|
2
|
+
import { DECISION_CONFIG } from './decision.config'
|
|
3
|
+
|
|
4
|
+
export function computeConfidence(ctx: DecisionContext): number {
|
|
5
|
+
let confidence = ctx.baseConfidence
|
|
6
|
+
|
|
7
|
+
for (const f of ctx.failures) {
|
|
8
|
+
confidence -= DECISION_CONFIG.impacts.failure[f.type]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
for (const fl of ctx.flakiness) {
|
|
12
|
+
if (fl.severity) {
|
|
13
|
+
confidence -= DECISION_CONFIG.impacts.flakiness[fl.severity]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return Math.max(0, Math.min(100, confidence))
|
|
18
|
+
}
|