Skip to content

Commit 0a3b610

Browse files
committed
test: add enterprise release verification gates
1 parent f979480 commit 0a3b610

26 files changed

Lines changed: 1231 additions & 89 deletions

.github/workflows/ci.yml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: CI
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [ master, main ]
67
pull_request:
78

9+
permissions:
10+
contents: read
11+
812
jobs:
913
build-and-test:
1014
runs-on: ubuntu-latest
15+
timeout-minutes: 15
1116
defaults:
1217
run:
1318
working-directory: universal-refiner
@@ -29,10 +34,11 @@ jobs:
2934
run: npm run build
3035

3136
- name: Run tests
32-
run: npm test
37+
run: npm run test:coverage
3338

3439
acceptance:
3540
runs-on: ubuntu-latest
41+
timeout-minutes: 15
3642
defaults:
3743
run:
3844
working-directory: universal-refiner
@@ -62,6 +68,7 @@ jobs:
6268

6369
stress:
6470
runs-on: ubuntu-latest
71+
timeout-minutes: 15
6572
defaults:
6673
run:
6774
working-directory: universal-refiner
@@ -82,3 +89,61 @@ jobs:
8289
PROMPT_REFINER_STRESS_WORKERS: '4'
8390
PROMPT_REFINER_STRESS_WRITES: '100'
8491
run: npm run stress:event-store
92+
93+
windows:
94+
runs-on: windows-latest
95+
timeout-minutes: 20
96+
defaults:
97+
run:
98+
working-directory: universal-refiner
99+
steps:
100+
- uses: actions/checkout@v5
101+
- uses: actions/setup-node@v5
102+
with:
103+
node-version: '22'
104+
cache: npm
105+
cache-dependency-path: universal-refiner/package-lock.json
106+
- run: npm ci --no-fund
107+
- run: npm rebuild better-sqlite3
108+
- run: npm run build
109+
- run: npm run test:coverage
110+
- run: npm run test:acceptance
111+
- run: npm run test:stress
112+
113+
supply-chain:
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 15
116+
defaults:
117+
run:
118+
working-directory: universal-refiner
119+
steps:
120+
- uses: actions/checkout@v5
121+
- uses: actions/setup-node@v5
122+
with:
123+
node-version: '22'
124+
cache: npm
125+
cache-dependency-path: universal-refiner/package-lock.json
126+
- run: npm ci --no-fund
127+
- run: npm run security:audit
128+
- run: npm run security:secrets
129+
- run: npm run build
130+
- run: npm run package:check
131+
132+
release-gate:
133+
if: always()
134+
needs: [build-and-test, acceptance, stress, windows, supply-chain]
135+
runs-on: ubuntu-latest
136+
steps:
137+
- name: Require every enterprise gate
138+
env:
139+
BUILD: ${{ needs['build-and-test'].result }}
140+
ACCEPTANCE: ${{ needs.acceptance.result }}
141+
STRESS: ${{ needs.stress.result }}
142+
WINDOWS: ${{ needs.windows.result }}
143+
SUPPLY_CHAIN: ${{ needs['supply-chain'].result }}
144+
run: |
145+
test "$BUILD" = "success"
146+
test "$ACCEPTANCE" = "success"
147+
test "$STRESS" = "success"
148+
test "$WINDOWS" = "success"
149+
test "$SUPPLY_CHAIN" = "success"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Dependencies and generated outputs
22
**/node_modules/
33
**/dist/
4+
**/coverage/
45
*.tgz
56

67
# Runtime state and local databases
@@ -23,4 +24,4 @@
2324
.vscode/
2425
.idea/
2526
.DS_Store
26-
Thumbs.db
27+
Thumbs.db

docs/enterprise-release-gates.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Enterprise Release Gates
2+
3+
Passing unit tests alone does not prove that PromptImprover is operationally ready. A release is eligible only when every required gate below passes.
4+
5+
## Quality Target
6+
7+
- All owned deterministic production logic reaches 100% statements, branches, functions, and lines.
8+
- Coverage exclusions are limited to generated artifacts. Bootstrap and integration behavior must be validated through acceptance or end-to-end tests.
9+
- The coverage threshold is ratcheted upward as gaps close. It must never decrease without an approved, documented exception.
10+
- Every reproduced defect receives a regression test at the owning boundary.
11+
12+
## Required Gates
13+
14+
1. `npm ci` succeeds from a clean workspace.
15+
2. TypeScript build succeeds with strict type checking.
16+
3. Unit and integration tests pass with the enforced coverage threshold.
17+
4. Every advertised MCP tool schema and dispatcher path passes acceptance tests.
18+
5. Local semantic-provider primary, fallback, malformed-response, timeout, and outage paths pass.
19+
6. SQLite restart, migration, backup/restore, contention, and multi-process tests pass.
20+
7. Claude and Gemini hook pre/post flows pass; Codex MCP-first flow passes.
21+
8. Dashboard API security, review mutation, health telemetry, and browser smoke flows pass.
22+
9. Dependency audit reports no known production vulnerabilities.
23+
10. Package dry-run, global installation, runtime startup, and post-restart smoke tests pass.
24+
11. Secret scanning finds no committed credentials.
25+
12. Linux and Windows CI jobs pass before merge.
26+
27+
## Current Coverage Baseline
28+
29+
The first measured baseline on June 14, 2026 exposed substantial untested production behavior:
30+
31+
| Metric | Baseline | Target |
32+
|---|---:|---:|
33+
| Statements | 66.33% | 100% |
34+
| Branches | 61.95% | 100% |
35+
| Functions | 79.92% | 100% |
36+
| Lines | 68.09% | 100% |
37+
38+
Initial high-risk gaps include MCP dispatcher behavior, background autonomy, template generation, prompt optimization, configuration failure paths, and operational dashboard branches.
39+
40+
The enforced ratchet is currently 86% statements, 76% branches, 93% functions, and 88% lines. It cannot be lowered without an approved exception.
41+
42+
## Operator Recovery
43+
44+
Build before invoking the recovery commands. Both operations run SQLite integrity checks and fail closed:
45+
46+
```powershell
47+
npm.cmd run db:backup -- C:\backups\promptimprover-events.db
48+
npm.cmd run db:restore -- C:\backups\promptimprover-events.db
49+
```
50+
51+
Stop the PromptImprover runtime before restoring a backup.
52+
53+
## Meaning Of Green
54+
55+
A green release pipeline means all declared gates passed in the tested environments. It substantially increases confidence but does not claim that unknown failures are impossible. Production incidents must become new automated regression gates.

0 commit comments

Comments
 (0)