@sun-asterisk/sungen 3.2.21-beta.2 → 3.2.21
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/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +0 -8
- package/dist/cli/commands/audit.js.map +1 -1
- package/dist/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +0 -13
- package/dist/cli/commands/delivery.js.map +1 -1
- package/dist/cli/commands/trace.d.ts.map +1 -1
- package/dist/cli/commands/trace.js +0 -9
- package/dist/cli/commands/trace.js.map +1 -1
- package/dist/exporters/matrix/build.d.ts +0 -10
- package/dist/exporters/matrix/build.d.ts.map +1 -1
- package/dist/exporters/matrix/build.js +0 -37
- package/dist/exporters/matrix/build.js.map +1 -1
- package/dist/exporters/matrix/export.d.ts.map +1 -1
- package/dist/exporters/matrix/export.js +0 -11
- package/dist/exporters/matrix/export.js.map +1 -1
- package/dist/exporters/matrix/render-xlsx.d.ts.map +1 -1
- package/dist/exporters/matrix/render-xlsx.js +1 -44
- package/dist/exporters/matrix/render-xlsx.js.map +1 -1
- package/dist/exporters/matrix/types.d.ts +0 -8
- package/dist/exporters/matrix/types.d.ts.map +1 -1
- package/dist/exporters/matrix/types.js.map +1 -1
- package/dist/exporters/playwright-report-parser.d.ts.map +1 -1
- package/dist/exporters/playwright-report-parser.js +0 -1
- package/dist/exporters/playwright-report-parser.js.map +1 -1
- package/dist/exporters/types.d.ts +0 -2
- package/dist/exporters/types.d.ts.map +1 -1
- package/dist/generators/test-generator/diagnostics.d.ts +1 -6
- package/dist/generators/test-generator/diagnostics.d.ts.map +1 -1
- package/dist/generators/test-generator/diagnostics.js +0 -5
- package/dist/generators/test-generator/diagnostics.js.map +1 -1
- package/dist/generators/test-generator/patterns/index.d.ts.map +1 -1
- package/dist/generators/test-generator/patterns/index.js +19 -27
- package/dist/generators/test-generator/patterns/index.js.map +1 -1
- package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
- package/dist/generators/test-generator/step-mapper.js +0 -22
- package/dist/generators/test-generator/step-mapper.js.map +1 -1
- package/dist/harness/audit.d.ts +0 -2
- package/dist/harness/audit.d.ts.map +1 -1
- package/dist/harness/audit.js +9 -91
- package/dist/harness/audit.js.map +1 -1
- package/dist/harness/flow-plan.d.ts +0 -3
- package/dist/harness/flow-plan.d.ts.map +1 -1
- package/dist/harness/flow-plan.js +2 -6
- package/dist/harness/flow-plan.js.map +1 -1
- package/dist/harness/parse.d.ts +0 -5
- package/dist/harness/parse.d.ts.map +1 -1
- package/dist/harness/parse.js +1 -29
- package/dist/harness/parse.js.map +1 -1
- package/dist/harness/sensors.d.ts.map +1 -1
- package/dist/harness/sensors.js +1 -13
- package/dist/harness/sensors.js.map +1 -1
- package/dist/harness/spec-coverage.d.ts.map +1 -1
- package/dist/harness/spec-coverage.js +5 -29
- package/dist/harness/spec-coverage.js.map +1 -1
- package/dist/orchestrator/templates/ai-src/commands/add-flow.md +3 -46
- package/dist/orchestrator/templates/ai-src/commands/create-test.md +0 -10
- package/dist/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +16 -52
- package/dist/orchestrator/templates/qa-context.md +1 -14
- package/package.json +3 -3
- package/src/cli/commands/audit.ts +0 -8
- package/src/cli/commands/delivery.ts +0 -12
- package/src/cli/commands/trace.ts +0 -9
- package/src/exporters/matrix/build.ts +0 -39
- package/src/exporters/matrix/export.ts +0 -11
- package/src/exporters/matrix/render-xlsx.ts +1 -45
- package/src/exporters/matrix/types.ts +0 -8
- package/src/exporters/playwright-report-parser.ts +0 -2
- package/src/exporters/types.ts +0 -2
- package/src/generators/test-generator/diagnostics.ts +1 -6
- package/src/generators/test-generator/patterns/index.ts +24 -30
- package/src/generators/test-generator/step-mapper.ts +0 -22
- package/src/harness/audit.ts +10 -94
- package/src/harness/flow-plan.ts +3 -10
- package/src/harness/parse.ts +1 -31
- package/src/harness/sensors.ts +1 -13
- package/src/harness/spec-coverage.ts +4 -26
- package/src/orchestrator/templates/ai-src/commands/add-flow.md +3 -46
- package/src/orchestrator/templates/ai-src/commands/create-test.md +0 -10
- package/src/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +16 -52
- package/src/orchestrator/templates/qa-context.md +1 -14
- package/dist/harness/flow-contract.d.ts +0 -71
- package/dist/harness/flow-contract.d.ts.map +0 -1
- package/dist/harness/flow-contract.js +0 -235
- package/dist/harness/flow-contract.js.map +0 -1
- package/dist/harness/perf.d.ts +0 -40
- package/dist/harness/perf.d.ts.map +0 -1
- package/dist/harness/perf.js +0 -136
- package/dist/harness/perf.js.map +0 -1
- package/src/harness/flow-contract.ts +0 -229
- package/src/harness/perf.ts +0 -112
|
@@ -86,57 +86,15 @@ qa/flows/${input:flow}/
|
|
|
86
86
|
└── ui/ # Screenshots, mockups
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
### 1a.
|
|
89
|
+
### 1a. Identify the screens in the flow
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
> journey verified against the spec. Use whichever name the team knows; the boundary rules
|
|
93
|
-
> below are the ISTQB system-test design rules.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
A flow is the **smallest complete business action chain**: one clear trigger ending in ONE
|
|
97
|
-
observable, valuable outcome. Before asking for screens, walk this checklist with the user —
|
|
98
|
-
if 1, 3 or 8 fails, propose SPLITTING into separate flows:
|
|
99
|
-
|
|
100
|
-
1. Exactly **one business goal**? (cart correctness + category filtering = two flows)
|
|
101
|
-
2. A clear **trigger** and precondition?
|
|
102
|
-
3. **One observable final outcome**? (a final assertion you can write in one sentence)
|
|
103
|
-
4. Is that outcome **valuable to the actor**? (an order placed, a password reset — not "a page rendered")
|
|
104
|
-
5. Is **every step necessary** for that outcome?
|
|
105
|
-
6. Are all steps at the **same business abstraction**?
|
|
106
|
-
7. Are optional/error branches **phases of this goal** (ER/EH), not new goals?
|
|
107
|
-
8. Does **no segment** form an independently valuable flow on its own?
|
|
108
|
-
9. Can you write **a single clear final assertion**?
|
|
109
|
-
10. Can you name it "**Verb + outcome**"? (`place-order`, `reset-password` — not `cart-and-filter`)
|
|
110
|
-
|
|
111
|
-
Then ask: "Which screens does this flow visit, in order? (e.g., login → dashboard → award-form → confirmation)"
|
|
91
|
+
Ask the user: "Which screens does this flow visit, in order? (e.g., login → dashboard → award-form → confirmation)"
|
|
112
92
|
|
|
113
93
|
Record the screen list — you will need it for:
|
|
114
94
|
- Filling `spec.md` (Step 3)
|
|
115
95
|
- Suggesting `[Screen:Element]` namespace prefixes
|
|
116
96
|
- Capturing visuals per screen (Step 2)
|
|
117
97
|
|
|
118
|
-
### 1b. Author the Flow Contract (`requirements/flow-contract.yaml`)
|
|
119
|
-
|
|
120
|
-
Write the answers down as the flow's contract — `sungen audit` scores the flow **against it**
|
|
121
|
-
(the `flowCoverage` axis: HP/ER/EH journey phases; `FLOW-OUTCOME-UNPROVEN` when no automated
|
|
122
|
-
scenario asserts data on the outcome screen; `FLOW-SCOPE-CREEP` when scenarios never touch it):
|
|
123
|
-
|
|
124
|
-
```yaml
|
|
125
|
-
goal: "Place an order for a product added from home" # Verb + outcome
|
|
126
|
-
actor: user
|
|
127
|
-
trigger: "Add a product to the cart from the home featured list"
|
|
128
|
-
precondition: "A registered account; an empty cart"
|
|
129
|
-
outcome:
|
|
130
|
-
screen: checkout # the [Screen:...] namespace carrying the final proof
|
|
131
|
-
assertion: "The confirmation shows the order number and the paid total"
|
|
132
|
-
value: "The customer has paid; the shop has a new order"
|
|
133
|
-
phases: [HP, ER, EH] # journey phases (default); add UI only if the flow owns UI states
|
|
134
|
-
stateful: cart # the mutated collection, if any — enables regression-depth dims
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**A filled contract is an INPUT to generation — never an output.** Like `test-viewpoint.md`,
|
|
138
|
-
generation must not rewrite it to match what was generated; disagree → propose the diff and ask.
|
|
139
|
-
|
|
140
98
|
### 2. Capture visual source
|
|
141
99
|
|
|
142
100
|
**Mobile path** (`platform: mobile`):
|
|
@@ -229,8 +187,7 @@ If user picks `/sungen:create-test`, **you MUST use the Skill tool** to invoke i
|
|
|
229
187
|
- Test data namespaced by phase: `login.email`, `submission.nominee`
|
|
230
188
|
- `@flow` tag required at feature level
|
|
231
189
|
- `Background:` should only contain the starting navigation — the URL path (web) or the `--reach` nav recipe (mobile)
|
|
232
|
-
- Each scenario = one phase of the journey
|
|
233
|
-
- One flow = ONE business goal with ONE observable outcome (`requirements/flow-contract.yaml`) — a segment with its own value is its own flow
|
|
190
|
+
- Each scenario = one phase of the journey
|
|
234
191
|
{{#cap parallel-subagents}}
|
|
235
192
|
- Mobile flows are tagged `@platform:mobile` and run via `/sungen:run-test <flow>` (WebdriverIO, not Playwright)
|
|
236
193
|
{{/cap}}
|
|
@@ -6,16 +6,6 @@ order: 20
|
|
|
6
6
|
claude-tools: "Read, Grep, Bash, Glob, Write, AskUserQuestion, Skill, mcp__playwright__browser_navigate, mcp__playwright__browser_snapshot, mcp__playwright__browser_take_screenshot"
|
|
7
7
|
copilot-tools: "[vscode, execute, read, agent, edit, search, web, browser, todo, 'playwright/*']"
|
|
8
8
|
codex-trigger: "Run when the user asks to CREATE, generate, write, or author test cases / a .feature file for a screen or flow. Step 2 (after add-screen/add-flow, before run-test). Do NOT use for executing, running, or compiling existing tests."
|
|
9
|
-
---
|
|
10
|
-
## ⛔ HARD RULE — the run's LAST action is the next-step hand-back
|
|
11
|
-
|
|
12
|
-
A create-test run is NOT finished when the files are written or the audit prints. The final
|
|
13
|
-
action of EVERY run — success, partial, or aborted — is the next-step hand-back
|
|
14
|
-
({{#cap parallel-subagents}}an `AskUserQuestion` offering the next actions{{/cap}}{{^cap parallel-subagents}}a numbered list of next-action choices{{/cap}};
|
|
15
|
-
see "Finish — always hand the next step back" at the end of this file). Ending with a prose
|
|
16
|
-
summary and no choices is a broken run: the operator is left guessing. This holds no matter
|
|
17
|
-
how long the generation/repair loop ran.
|
|
18
|
-
|
|
19
9
|
---
|
|
20
10
|
{{#cap parallel-subagents}}
|
|
21
11
|
## ⛔ HARD RULE — No Figma MCP when PAT data exists
|
|
@@ -603,59 +603,24 @@ error:
|
|
|
603
603
|
|
|
604
604
|
## Flow Test Generation
|
|
605
605
|
|
|
606
|
-
> **Terminology**: many QA teams call this level **System Test** (ISTQB: verify the fully
|
|
607
|
-
> integrated system against its specified requirements, designed around business
|
|
608
|
-
> processes/use cases). In sungen a *flow* is that system-test suite run through the real UI;
|
|
609
|
-
> its automation then serves as the regression suite on later runs. The names are
|
|
610
|
-
> interchangeable in conversation; the artifacts stay `qa/flows/<name>/`.
|
|
611
|
-
|
|
612
|
-
**Representative, not exhaustive (ISTQB system-test design rule).** A flow case takes ONE
|
|
613
|
-
representative input per branch — one valid value for the main flow, one error value that
|
|
614
|
-
triggers the exception branch and proves the journey recovers. The full equivalence/boundary
|
|
615
|
-
matrix belongs to the OWNING SCREEN (as `@cases` there), never re-run inside the flow: if the
|
|
616
|
-
screen already proved "the field rejects negatives", the flow only proves "the journey survives
|
|
617
|
-
one rejected input". `sungen audit` reports `FLOW-EXHAUSTIVE-INPUTS` when ≥3 same-shape flow
|
|
618
|
-
scenarios differ only in data. **Mocked dependencies**: a flow scenario using `@mock` is
|
|
619
|
-
delivered as *Pass (Mocked)* — verified handling logic, not the real dependency; the delivery's
|
|
620
|
-
External Dependency Tracking table lists it until re-verified real.
|
|
621
|
-
|
|
622
|
-
|
|
623
606
|
> **Auto-detect**: if path is `qa/flows/<name>/` → use this section. Skip Steps 1–4 above.
|
|
624
607
|
|
|
625
|
-
**Read `requirements/flow-contract.yaml` FIRST — it is the flow's boundary and the yardstick
|
|
626
|
-
`sungen audit` scores the flow against** (`flowCoverage` axis = journey phases HP/ER/EH automated;
|
|
627
|
-
`FLOW-OUTCOME-UNPROVEN`; `FLOW-SCOPE-CREEP`). No contract yet → author it with the user via the
|
|
628
|
-
boundary checklist in `add-flow` (one business goal · clear trigger · ONE observable outcome
|
|
629
|
-
valuable to the actor · name = "Verb + outcome"), THEN generate. **A filled contract is an INPUT —
|
|
630
|
-
never rewrite it to match your output** (same rule as `test-viewpoint.md`).
|
|
631
|
-
|
|
632
608
|
| Aspect | Screen | Flow |
|
|
633
609
|
|---|---|---|
|
|
634
|
-
| Section focus | UI patterns per section | Journey phases
|
|
610
|
+
| Section focus | UI patterns per section | Journey phases across screens |
|
|
635
611
|
| Selector format | `[Element]` | `[Screen:Element]` (namespaced) |
|
|
636
612
|
| Test data keys | `{{variable}}` | `{{phase.variable}}` |
|
|
637
613
|
| Feature tag | `@auto` / `@smoke` etc. | `@flow` (required) |
|
|
638
|
-
|
|
|
614
|
+
| Viewpoints | VP-UI/VAL/LOGIC/SEC per section | VP-LOGIC (transitions), VP-SEC (auth persistence), VP-VAL (cross-screen data) |
|
|
639
615
|
|
|
640
|
-
**Scenarios to generate
|
|
616
|
+
**Scenarios to generate:**
|
|
641
617
|
|
|
642
|
-
|
|
|
643
|
-
|
|
644
|
-
|
|
|
645
|
-
|
|
|
646
|
-
|
|
|
647
|
-
| Cross-screen
|
|
648
|
-
| Stateful regression (when `stateful:` declared) | Count/quantity proof · teardown (remove → empty) · multi-source add. | missing dims cap `businessDepth` (`FLOW-DEPTH`) |
|
|
649
|
-
|
|
650
|
-
**Boundary discipline while generating:** every scenario must serve the contract's goal. A scenario
|
|
651
|
-
that never touches `outcome.screen` and is not a guard (`EH`) or error-recovery (`ER`) belongs in a
|
|
652
|
-
DIFFERENT flow — propose the split instead of writing it here (`FLOW-SCOPE-CREEP` will flag it).
|
|
653
|
-
Auth persistence across transitions is part of `EH` unless the project declares it its own phase.
|
|
654
|
-
|
|
655
|
-
**Manual in flows**: always `@manual:Mx` with the reason code — bare `@manual` is flagged
|
|
656
|
-
(`MANUAL-CODE-MISSING`) because the capability planner cannot route it. Typical flow deferrals:
|
|
657
|
-
inbox/mail oracle → `M5`, network-request count → `M3`, context expiry control → `M7`. A
|
|
658
|
-
cross-screen scenario inside the flow's own goal is NOT manual — automate it here.
|
|
618
|
+
| Category | What to test |
|
|
619
|
+
|---|---|
|
|
620
|
+
| Happy path | Complete flow end-to-end with valid data |
|
|
621
|
+
| Auth persistence | Auth state maintained across screen transitions |
|
|
622
|
+
| Error recovery | Invalid input mid-flow → fix → continue |
|
|
623
|
+
| Cross-screen data | Data entered on screen A visible on screen B |
|
|
659
624
|
|
|
660
625
|
```gherkin
|
|
661
626
|
@flow @auth:user
|
|
@@ -665,20 +630,19 @@ Feature: Award Submission Flow
|
|
|
665
630
|
Given User is on [Login] page
|
|
666
631
|
|
|
667
632
|
@high
|
|
668
|
-
Scenario:
|
|
633
|
+
Scenario: User logs in successfully
|
|
669
634
|
When User fill [Login:Email] field with {{login.email}}
|
|
670
635
|
And User fill [Login:Password] field with {{login.password}}
|
|
671
636
|
And User click [Login:Submit] button
|
|
672
637
|
Then User see [Dashboard] page
|
|
673
|
-
When User click [Dashboard:Awards] link
|
|
674
|
-
And User fill [Awards:Nominee] field with {{submission.nominee}}
|
|
675
|
-
And User click [Awards:Submit] button
|
|
676
|
-
Then User see [Awards:Success Message] text with {{success_message}}
|
|
677
638
|
|
|
678
639
|
@high
|
|
679
|
-
Scenario:
|
|
680
|
-
When User
|
|
681
|
-
Then User see [
|
|
640
|
+
Scenario: User submits nomination
|
|
641
|
+
When User click [Dashboard:Awards] link
|
|
642
|
+
Then User see [Awards] page
|
|
643
|
+
When User fill [Awards:Nominee] field with {{submission.nominee}}
|
|
644
|
+
And User click [Awards:Submit] button
|
|
645
|
+
Then User see {{success_message}} message
|
|
682
646
|
```
|
|
683
647
|
|
|
684
648
|
```yaml
|
|
@@ -45,21 +45,8 @@ Example:
|
|
|
45
45
|
|
|
46
46
|
## Testing Strategy
|
|
47
47
|
|
|
48
|
-
Machine-readable intent — `sungen audit` reads these keys (Intent Profile). Values here are
|
|
49
|
-
live even when the surrounding text changes; an invalid value silently falls back to the default.
|
|
50
|
-
|
|
51
|
-
focus: functional
|
|
52
|
-
<!-- focus: functional | e-commerce | security | smoke — drives the audit's depth threshold -->
|
|
53
|
-
|
|
54
|
-
risk_tier: normal
|
|
55
|
-
<!-- risk_tier: high | normal | low -->
|
|
56
|
-
|
|
57
|
-
To silence driver suggestions in audit findings, add a line: capability_suggestions with value off.
|
|
58
|
-
|
|
59
48
|
**Focus areas** — what to cover thoroughly:
|
|
60
|
-
<!--
|
|
61
|
-
Response-time budgets are NOT a focus value — declare them in qa/perf.yaml
|
|
62
|
-
(percentile + scenario_ms budgets; reported by `sungen delivery`). -->
|
|
49
|
+
<!-- List from: functional, security, ui, accessibility, performance -->
|
|
63
50
|
<!-- Example: functional, security -->
|
|
64
51
|
|
|
65
52
|
**Mandatory coverage:**
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { ScenarioInfo } from './parse';
|
|
2
|
-
export interface FlowContract {
|
|
3
|
-
goal: string;
|
|
4
|
-
actor?: string;
|
|
5
|
-
trigger?: string;
|
|
6
|
-
precondition?: string;
|
|
7
|
-
outcome: {
|
|
8
|
-
screen: string;
|
|
9
|
-
assertion?: string;
|
|
10
|
-
};
|
|
11
|
-
value?: string;
|
|
12
|
-
/** Journey phases this flow declares. Default [HP, ER, EH]; UI is allowed but
|
|
13
|
-
* never demanded (presentation is the balance axis's business, not coverage's). */
|
|
14
|
-
phases: string[];
|
|
15
|
-
/** The mutated collection (cart, order, application …) — enables regression dims. */
|
|
16
|
-
stateful?: string;
|
|
17
|
-
budgets?: Record<string, number>;
|
|
18
|
-
}
|
|
19
|
-
export interface FlowQualityResult {
|
|
20
|
-
hasContract: boolean;
|
|
21
|
-
contract?: FlowContract;
|
|
22
|
-
/** Parse/shape errors — a broken contract is reported, never silently ignored. */
|
|
23
|
-
errors: string[];
|
|
24
|
-
outcomeProven: boolean;
|
|
25
|
-
/** Manual-only proof: the goal is covered but not by automation. */
|
|
26
|
-
outcomeManualOnly: boolean;
|
|
27
|
-
/** Scenario names that never touch the outcome screen (guard/error phases excluded). */
|
|
28
|
-
offGoal: string[];
|
|
29
|
-
offGoalRatio: number;
|
|
30
|
-
/** Off-goal categories, for the split suggestion ("VP-FILTER-* looks like its own flow"). */
|
|
31
|
-
offGoalCategories: string[];
|
|
32
|
-
phases: {
|
|
33
|
-
phase: string;
|
|
34
|
-
covered: boolean;
|
|
35
|
-
automated: boolean;
|
|
36
|
-
}[];
|
|
37
|
-
/** Covered-and-automated phases / declared phases (UI excluded) — the flow coverage axis. */
|
|
38
|
-
phaseRatio: number;
|
|
39
|
-
/** Cross-namespace transitions followed by an assertion / all transitions. */
|
|
40
|
-
handoffs: {
|
|
41
|
-
total: number;
|
|
42
|
-
asserted: number;
|
|
43
|
-
ratio: number;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export declare function flowContractPath(unitDir: string): string;
|
|
47
|
-
/** Load + validate. Returns null when absent; a present-but-broken file returns errors. */
|
|
48
|
-
export declare function loadFlowContract(unitDir: string): {
|
|
49
|
-
contract: FlowContract | null;
|
|
50
|
-
errors: string[];
|
|
51
|
-
};
|
|
52
|
-
/** Phase of a scenario: its declared phase token (FL-HP-001 / VP-FLOW-ER-02 / MS-EH-005)
|
|
53
|
-
* when present, else vocabulary detection. */
|
|
54
|
-
export declare function phaseOf(s: ScenarioInfo, declared: string[]): string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Verify the suite against the contract. Deterministic; a flow without a contract
|
|
57
|
-
* returns hasContract:false and neutral values (the audit reports the checklist).
|
|
58
|
-
*/
|
|
59
|
-
export declare function flowQuality(unitDir: string, scenarios: ScenarioInfo[]): FlowQualityResult;
|
|
60
|
-
/**
|
|
61
|
-
* Generalized stateful regression depth: the contract names the mutated collection,
|
|
62
|
-
* so the three dims (count-proof · teardown · multi-source) stop being cart-only.
|
|
63
|
-
*/
|
|
64
|
-
export declare function statefulDepthFor(collection: string, scenarios: ScenarioInfo[]): {
|
|
65
|
-
countProof: boolean;
|
|
66
|
-
teardown: boolean;
|
|
67
|
-
multiSource: boolean;
|
|
68
|
-
missing: string[];
|
|
69
|
-
ratio: number;
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=flow-contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flow-contract.d.ts","sourceRoot":"","sources":["../../src/harness/flow-contract.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;wFACoF;IACpF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,kFAAkF;IAClF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,wFAAwF;IACxF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAClE,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D;AAID,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAkCrG;AAaD;+CAC+C;AAC/C,wBAAgB,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAU1E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,iBAAiB,CA2EzF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAWlL"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.flowContractPath = flowContractPath;
|
|
37
|
-
exports.loadFlowContract = loadFlowContract;
|
|
38
|
-
exports.phaseOf = phaseOf;
|
|
39
|
-
exports.flowQuality = flowQuality;
|
|
40
|
-
exports.statefulDepthFor = statefulDepthFor;
|
|
41
|
-
/**
|
|
42
|
-
* Flow Contract — the declared boundary of a flow, and the sensors that verify
|
|
43
|
-
* the suite against it. (#569, docs/spec/sungen-flow-quality-spec.md)
|
|
44
|
-
*
|
|
45
|
-
* A flow is the SMALLEST complete business action chain: one clear trigger ending
|
|
46
|
-
* in ONE observable, valuable outcome. Nothing enforced that: `add-flow` asked only
|
|
47
|
-
* "which screens, in order?", so a real example mixed three business goals (cart,
|
|
48
|
-
* filter, product-detail) in one "flow", and the harness scored flows with screen
|
|
49
|
-
* machinery — a registration flow was judged against the `form` page-type checklist
|
|
50
|
-
* (coverage 0%), and every flow audit showed taxonomy=0% because flow phase ids
|
|
51
|
-
* (FL-HP-001) don't even parse as categories.
|
|
52
|
-
*
|
|
53
|
-
* The contract is a declaration the QA owns (AI proposes at add-flow; a filled
|
|
54
|
-
* contract is an INPUT to generation, never an output — same rule as
|
|
55
|
-
* test-viewpoint.md). These sensors are deterministic checks against it:
|
|
56
|
-
*
|
|
57
|
-
* - outcome proof — the flow proves its own goal with an automated data assertion
|
|
58
|
-
* - scope creep — scenarios that never touch the outcome are a second goal
|
|
59
|
-
* - phase coverage — HP / ER / EH journey phases, the flow's coverage axis
|
|
60
|
-
* - handoff — a cross-screen transition is followed by an assertion
|
|
61
|
-
* - stateful depth — generalizes the cart-hardcoded regression dims to any
|
|
62
|
-
* declared collection (order, application, submission …)
|
|
63
|
-
*/
|
|
64
|
-
const fs = __importStar(require("fs"));
|
|
65
|
-
const path = __importStar(require("path"));
|
|
66
|
-
const yaml_1 = require("yaml");
|
|
67
|
-
const read_text_1 = require("./read-text");
|
|
68
|
-
const DEFAULT_PHASES = ['HP', 'ER', 'EH'];
|
|
69
|
-
function flowContractPath(unitDir) {
|
|
70
|
-
return path.join(unitDir, 'requirements', 'flow-contract.yaml');
|
|
71
|
-
}
|
|
72
|
-
/** Load + validate. Returns null when absent; a present-but-broken file returns errors. */
|
|
73
|
-
function loadFlowContract(unitDir) {
|
|
74
|
-
const p = flowContractPath(unitDir);
|
|
75
|
-
if (!fs.existsSync(p))
|
|
76
|
-
return { contract: null, errors: [] };
|
|
77
|
-
let raw;
|
|
78
|
-
try {
|
|
79
|
-
raw = (0, yaml_1.parse)((0, read_text_1.readTextFile)(p));
|
|
80
|
-
}
|
|
81
|
-
catch (e) {
|
|
82
|
-
return { contract: null, errors: [`flow-contract.yaml does not parse: ${e.message}`] };
|
|
83
|
-
}
|
|
84
|
-
if (!raw || typeof raw !== 'object')
|
|
85
|
-
return { contract: null, errors: ['flow-contract.yaml is empty'] };
|
|
86
|
-
const errors = [];
|
|
87
|
-
if (!raw.goal || typeof raw.goal !== 'string')
|
|
88
|
-
errors.push('missing `goal:` (Verb + outcome, e.g. "Place an order for a product added from home")');
|
|
89
|
-
const outcome = raw.outcome;
|
|
90
|
-
if (!outcome || typeof outcome.screen !== 'string' || !outcome.screen.trim()) {
|
|
91
|
-
errors.push('missing `outcome.screen:` — the screen namespace that carries the final proof');
|
|
92
|
-
}
|
|
93
|
-
if (errors.length > 0)
|
|
94
|
-
return { contract: null, errors };
|
|
95
|
-
const phases = Array.isArray(raw.phases) && raw.phases.length > 0
|
|
96
|
-
? raw.phases.map((x) => String(x).toUpperCase())
|
|
97
|
-
: DEFAULT_PHASES;
|
|
98
|
-
return {
|
|
99
|
-
contract: {
|
|
100
|
-
goal: String(raw.goal),
|
|
101
|
-
actor: raw.actor !== undefined ? String(raw.actor) : undefined,
|
|
102
|
-
trigger: raw.trigger !== undefined ? String(raw.trigger) : undefined,
|
|
103
|
-
precondition: raw.precondition !== undefined ? String(raw.precondition) : undefined,
|
|
104
|
-
outcome: { screen: String(outcome.screen).toLowerCase(), assertion: outcome.assertion !== undefined ? String(outcome.assertion) : undefined },
|
|
105
|
-
value: raw.value !== undefined ? String(raw.value) : undefined,
|
|
106
|
-
phases,
|
|
107
|
-
stateful: raw.stateful !== undefined ? String(raw.stateful).toLowerCase() : undefined,
|
|
108
|
-
budgets: (raw.budgets && typeof raw.budgets === 'object') ? raw.budgets : undefined,
|
|
109
|
-
},
|
|
110
|
-
errors: [],
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/** `[screen:element]` namespaces referenced by a scenario's steps, in step order. */
|
|
114
|
-
function namespacesInOrder(s) {
|
|
115
|
-
const out = [];
|
|
116
|
-
for (const m of s.stepsText.matchAll(/\[([a-z0-9_.-]+):/g))
|
|
117
|
-
out.push(m[1]);
|
|
118
|
-
return out;
|
|
119
|
-
}
|
|
120
|
-
function touchesOutcome(s, outcomeScreen) {
|
|
121
|
-
return namespacesInOrder(s).includes(outcomeScreen);
|
|
122
|
-
}
|
|
123
|
-
/** Phase of a scenario: its declared phase token (FL-HP-001 / VP-FLOW-ER-02 / MS-EH-005)
|
|
124
|
-
* when present, else vocabulary detection. */
|
|
125
|
-
function phaseOf(s, declared) {
|
|
126
|
-
const id = (s.vpId ?? '').toUpperCase();
|
|
127
|
-
for (const ph of declared) {
|
|
128
|
-
if (new RegExp(`(^|-)${ph}(-|$)`).test(id))
|
|
129
|
-
return ph;
|
|
130
|
-
}
|
|
131
|
-
const hay = s.haystack;
|
|
132
|
-
if (declared.includes('EH') && /\b(direct access|without (a |the )?(submit|login)|browser back|refresh|expired|tamper|unauthoriz|redirect(ed)? (back )?to|guard)\b/.test(hay))
|
|
133
|
-
return 'EH';
|
|
134
|
-
if (declared.includes('ER') && /\b(invalid|error|required|validation|malformed|blocked|then correct|recover)\b/.test(hay))
|
|
135
|
-
return 'ER';
|
|
136
|
-
if (declared.includes('HP') && s.hasDataAssertion)
|
|
137
|
-
return 'HP';
|
|
138
|
-
return null;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Verify the suite against the contract. Deterministic; a flow without a contract
|
|
142
|
-
* returns hasContract:false and neutral values (the audit reports the checklist).
|
|
143
|
-
*/
|
|
144
|
-
function flowQuality(unitDir, scenarios) {
|
|
145
|
-
const { contract, errors } = loadFlowContract(unitDir);
|
|
146
|
-
const neutral = {
|
|
147
|
-
hasContract: false, errors, outcomeProven: false, outcomeManualOnly: false,
|
|
148
|
-
offGoal: [], offGoalRatio: 0, offGoalCategories: [],
|
|
149
|
-
phases: [], phaseRatio: 1, handoffs: { total: 0, asserted: 0, ratio: 1 },
|
|
150
|
-
};
|
|
151
|
-
if (!contract)
|
|
152
|
-
return neutral;
|
|
153
|
-
const outcomeScreen = contract.outcome.screen;
|
|
154
|
-
// --- Outcome proof: the flow proves its own goal, by automation -------------
|
|
155
|
-
const proofs = scenarios.filter((s) => touchesOutcome(s, outcomeScreen) && s.hasDataAssertion);
|
|
156
|
-
const outcomeProven = proofs.some((s) => !s.manual);
|
|
157
|
-
const outcomeManualOnly = !outcomeProven && proofs.length > 0;
|
|
158
|
-
// --- Scope creep: a scenario that never touches the outcome and is not a ----
|
|
159
|
-
// guard/error phase is evidence of a SECOND business goal in this flow.
|
|
160
|
-
const declaredPhases = contract.phases;
|
|
161
|
-
const offGoalScenarios = scenarios.filter((s) => {
|
|
162
|
-
if (touchesOutcome(s, outcomeScreen))
|
|
163
|
-
return false;
|
|
164
|
-
const ph = phaseOf(s, declaredPhases);
|
|
165
|
-
return ph !== 'EH' && ph !== 'ER'; // guards/error-recovery legitimately stop early
|
|
166
|
-
});
|
|
167
|
-
const offGoalRatio = scenarios.length ? offGoalScenarios.length / scenarios.length : 0;
|
|
168
|
-
const offGoalCategories = Array.from(new Set(offGoalScenarios.map((s) => s.category ?? s.vpId?.replace(/-\d+.*$/, '') ?? '?')));
|
|
169
|
-
// --- Phase coverage: the flow's coverage axis (UI never demanded) -----------
|
|
170
|
-
const demanded = declaredPhases.filter((p) => p !== 'UI');
|
|
171
|
-
const phases = demanded.map((phase) => {
|
|
172
|
-
const inPhase = scenarios.filter((s) => phaseOf(s, declaredPhases) === phase);
|
|
173
|
-
// HP must additionally prove the outcome — a data assertion elsewhere is not the goal.
|
|
174
|
-
const relevant = phase === 'HP' ? inPhase.filter((s) => touchesOutcome(s, outcomeScreen)) : inPhase;
|
|
175
|
-
return {
|
|
176
|
-
phase,
|
|
177
|
-
covered: relevant.length > 0,
|
|
178
|
-
automated: relevant.some((s) => !s.manual),
|
|
179
|
-
};
|
|
180
|
-
});
|
|
181
|
-
const phaseRatio = demanded.length
|
|
182
|
-
? phases.filter((p) => p.covered && p.automated).length / demanded.length
|
|
183
|
-
: 1;
|
|
184
|
-
// --- Handoff integrity: no blind tail after a cross-namespace transition. ---
|
|
185
|
-
// A transition counts as asserted when ANY assertion follows it — in the entered
|
|
186
|
-
// namespace or later. Demanding the assertion in the entered namespace itself
|
|
187
|
-
// flagged two legitimate shapes: a guard that asserts the REDIRECT target
|
|
188
|
-
// ("go to [Checkout] → see [Home] page"), and a passthrough click en route
|
|
189
|
-
// ("click [Cart:Checkout]" asserting on the next screen). What the sensor
|
|
190
|
-
// actually guards against is a flow that clicks through screens and ends blind.
|
|
191
|
-
let total = 0;
|
|
192
|
-
let asserted = 0;
|
|
193
|
-
for (const s of scenarios) {
|
|
194
|
-
if (s.manual)
|
|
195
|
-
continue;
|
|
196
|
-
const steps = s.steps ?? [];
|
|
197
|
-
let current = null;
|
|
198
|
-
for (let i = 0; i < steps.length; i++) {
|
|
199
|
-
const ns = (steps[i].text.match(/\[([A-Za-z0-9_.-]+):/) || [])[1]?.toLowerCase() ?? null;
|
|
200
|
-
if (!ns)
|
|
201
|
-
continue;
|
|
202
|
-
if (current !== null && ns !== current) {
|
|
203
|
-
total++;
|
|
204
|
-
if (steps.slice(i).some((st) => st.bucket === 'then'))
|
|
205
|
-
asserted++;
|
|
206
|
-
}
|
|
207
|
-
current = ns;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
const handoffs = { total, asserted, ratio: total ? asserted / total : 1 };
|
|
211
|
-
return {
|
|
212
|
-
hasContract: true, contract, errors: [],
|
|
213
|
-
outcomeProven, outcomeManualOnly,
|
|
214
|
-
offGoal: offGoalScenarios.map((s) => s.name.slice(0, 80)),
|
|
215
|
-
offGoalRatio, offGoalCategories,
|
|
216
|
-
phases, phaseRatio, handoffs,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Generalized stateful regression depth: the contract names the mutated collection,
|
|
221
|
-
* so the three dims (count-proof · teardown · multi-source) stop being cart-only.
|
|
222
|
-
*/
|
|
223
|
-
function statefulDepthFor(collection, scenarios) {
|
|
224
|
-
const hay = scenarios.map((s) => s.haystack);
|
|
225
|
-
const any = (re) => hay.some((h) => re.test(h));
|
|
226
|
-
const noun = collection.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
227
|
-
const countProof = any(new RegExp(`\\b(quantity|qty|row count|count|number of|two (rows|lines|items)|\\d+ (rows|lines|items))\\b`));
|
|
228
|
-
const teardown = any(/\b(remove|delete|clear|cancel|withdraw)(?:s|d|ed|ing|n)?\b/) && any(new RegExp(`\\b(empty|emptied|no items|zero|removed|cleared|cancelled|withdrawn|0 items)\\b|empty[- ]${noun}`));
|
|
229
|
-
const adds = hay.filter((h) => new RegExp(`\\b(add|submit|create|place).{0,40}${noun}|${noun}.{0,40}\\b(add|submit|create|place)`).test(h));
|
|
230
|
-
const multiSource = any(/\b(recommended|related|you may also|another source|both sources|second (list|source))\b/) && adds.length > 0;
|
|
231
|
-
const dims = [['count-proof', countProof], ['teardown', teardown], ['multi-source', multiSource]];
|
|
232
|
-
const missing = dims.filter(([, v]) => !v).map(([k]) => k);
|
|
233
|
-
return { countProof, teardown, multiSource, missing, ratio: (dims.length - missing.length) / dims.length };
|
|
234
|
-
}
|
|
235
|
-
//# sourceMappingURL=flow-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flow-contract.js","sourceRoot":"","sources":["../../src/harness/flow-contract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,4CAEC;AAGD,4CAkCC;AAeD,0BAUC;AAMD,kCA2EC;AAMD,4CAWC;AApOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,+BAA0C;AAE1C,2CAA2C;AAqC3C,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE1C,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC;AAClE,CAAC;AAED,2FAA2F;AAC3F,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,CAAC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CAAC,sCAAsC,IAAI,IAAI,IAAI,qCAAqC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5I,MAAM,WAAW,GAAG,GAAG,CAAC,yFAAyF,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACtI,MAAM,IAAI,GAA6B,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5H,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;AAC7G,CAAC"}
|
package/dist/harness/perf.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface PerfConfig {
|
|
2
|
-
/** 0..100 — e.g. 75 for p75. */
|
|
3
|
-
percentile: number;
|
|
4
|
-
defaults: Record<string, number>;
|
|
5
|
-
units: Record<string, Record<string, number>>;
|
|
6
|
-
}
|
|
7
|
-
export interface PerfVerdict {
|
|
8
|
-
unit: string;
|
|
9
|
-
metric: string;
|
|
10
|
-
percentile: number;
|
|
11
|
-
budgetMs: number;
|
|
12
|
-
measuredMs: number;
|
|
13
|
-
samples: number;
|
|
14
|
-
pass: boolean;
|
|
15
|
-
/** Titles of the slowest offenders (only when failing), for the report. */
|
|
16
|
-
slowest: Array<{
|
|
17
|
-
title: string;
|
|
18
|
-
ms: number;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
21
|
-
export declare function perfConfigPath(projectRoot: string): string;
|
|
22
|
-
/** Absent file → null (perf reporting is opt-in; nothing changes until configured). */
|
|
23
|
-
export declare function loadPerfConfig(projectRoot: string): PerfConfig | null;
|
|
24
|
-
/**
|
|
25
|
-
* Nearest-rank percentile (ceil), the standard "≥pXX of samples meet the budget"
|
|
26
|
-
* reading: p75 of [a…] is the value at ceil(0.75·n) in the sorted list. One
|
|
27
|
-
* sample → that sample. Deterministic, no interpolation.
|
|
28
|
-
*/
|
|
29
|
-
export declare function percentileOf(p: number, values: number[]): number;
|
|
30
|
-
/** Budget for a metric on a unit: per-unit override, else defaults, else none. */
|
|
31
|
-
export declare function budgetFor(config: PerfConfig, unit: string, metric: string): number | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* The scenario_ms verdict for one unit's run. `durations` = per-test wall-clock ms
|
|
34
|
-
* (a @cases scenario contributes one sample per row-test — each is a real run).
|
|
35
|
-
*/
|
|
36
|
-
export declare function perfVerdict(config: PerfConfig, unit: string, samples: Array<{
|
|
37
|
-
title: string;
|
|
38
|
-
ms: number;
|
|
39
|
-
}>): PerfVerdict | null;
|
|
40
|
-
//# sourceMappingURL=perf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"perf.d.ts","sourceRoot":"","sources":["../../src/harness/perf.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,UAAU;IACzB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAA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