@healflow/classification 0.1.0 → 0.1.1
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/README.md +78 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @healflow/classification
|
|
2
|
+
|
|
3
|
+
Rule-based failure classification engine for Playwright and CI test failures.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Classifies failures into 14 categories (selector, timing, overlay, iframe, product bug, etc.), computes confidence scores, fingerprints root causes, and clusters duplicate failures.
|
|
8
|
+
|
|
9
|
+
**Published to npm** as a transitive dependency. Used by `@healflow/playwright` at runtime and `@healflow/ingestion` during report parsing.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @healflow/classification
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { classifyFailure, fingerprintFailure, clusterFailures } from '@healflow/classification';
|
|
21
|
+
import { FailureSource } from '@healflow/shared';
|
|
22
|
+
|
|
23
|
+
const result = classifyFailure({
|
|
24
|
+
errorMessage: 'locator.click: Timeout 30000ms exceeded',
|
|
25
|
+
errorStack: '...',
|
|
26
|
+
testFile: 'tests/login.spec.ts',
|
|
27
|
+
testTitle: 'user can log in',
|
|
28
|
+
source: FailureSource.REPORT,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log(result.category); // e.g. SELECTOR
|
|
32
|
+
console.log(result.confidence); // 0–1
|
|
33
|
+
console.log(result.isAutomationFixable);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Deduplication
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { fingerprintFailure, clusterFailures } from '@healflow/classification';
|
|
40
|
+
|
|
41
|
+
const fingerprint = fingerprintFailure(errorMessage, errorStack);
|
|
42
|
+
const clusters = clusterFailures(failures);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Flakiness scoring
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { computeFlakinessScore } from '@healflow/classification';
|
|
49
|
+
|
|
50
|
+
const score = computeFlakinessScore(history);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API
|
|
54
|
+
|
|
55
|
+
| Export | Description |
|
|
56
|
+
| ------ | ----------- |
|
|
57
|
+
| `classifyFailure` | Classify a single failure event |
|
|
58
|
+
| `FailureClassifier` | Stateful classifier with custom rules |
|
|
59
|
+
| `CLASSIFICATION_RULES` | Built-in rule definitions |
|
|
60
|
+
| `fingerprintFailure` | Stable hash for root-cause grouping |
|
|
61
|
+
| `clusterFailures` | Group failures by fingerprint |
|
|
62
|
+
| `computeFlakinessScore` | Score flaky test history |
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pnpm --filter @healflow/classification build
|
|
68
|
+
pnpm --filter @healflow/classification test
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Related packages
|
|
72
|
+
|
|
73
|
+
- [`@healflow/shared`](../shared) — domain types and enums
|
|
74
|
+
- [`@healflow/ingestion`](../ingestion) — parses reports then classifies
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@healflow/classification",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "HealFlow failure classification engine",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@healflow/shared": "^0.1.
|
|
8
|
+
"@healflow/shared": "^0.1.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"tsx": "^4.19.2",
|