Skip to content

Commit 4242b34

Browse files
committed
fix: restore CI clean install and canonical registration
1 parent d76b444 commit 4242b34

9 files changed

Lines changed: 194 additions & 7 deletions

File tree

docs/operator-testing.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Operator Testing Guide
2+
3+
Use this guide to verify PromptImprover from a clean Windows operator session.
4+
5+
## 1. Enter The Active Package
6+
7+
```powershell
8+
cd C:\PersonalRepo\portfolio\Promptimprover\universal-refiner
9+
```
10+
11+
## 2. Run The Full Release Gate
12+
13+
```powershell
14+
npm.cmd run release:verify
15+
```
16+
17+
Expected result:
18+
19+
- TypeScript build passes.
20+
- Vitest coverage reports 100% statements, branches, functions, and lines.
21+
- MCP tool acceptance passes.
22+
- Semantic fallback acceptance passes.
23+
- Tracked-turn acceptance links a `prm_...` prompt ID in SQLite.
24+
- EventStore stress, abrupt recovery, and soak pass.
25+
- Production and full dependency audits report zero high-or-higher vulnerabilities.
26+
- Secret scan passes.
27+
- Package dry-run passes.
28+
- `acceptance:package-runtime` installs the packed tarball into a temporary global prefix and serves `/api/health`.
29+
30+
## 3. Check Global MCP Registration
31+
32+
```powershell
33+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Check -ProfileRoot C:\Users\KimHarjamaki -CodexHome C:\codex-home
34+
```
35+
36+
Expected result:
37+
38+
```text
39+
OK Codex
40+
OK Claude Code MCP
41+
OK Claude Code hooks
42+
OK Gemini
43+
```
44+
45+
If any row reports `DRIFT`, run `-Apply` only after confirming the drift is expected:
46+
47+
```powershell
48+
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\register-global.ps1 -Apply -ProfileRoot C:\Users\KimHarjamaki -CodexHome C:\codex-home
49+
```
50+
51+
## 4. List MCP Servers In Each CLI
52+
53+
```powershell
54+
codex.cmd mcp list | Select-String -Pattern 'prompt-refiner|obsidian|Connected|enabled'
55+
claude.cmd mcp list | Select-String -Pattern 'prompt-refiner|obsidian|Connected|Configured'
56+
gemini.cmd mcp list | Select-String -Pattern 'prompt-refiner|obsidian|Connected|Configured'
57+
```
58+
59+
Expected result:
60+
61+
- Codex lists `prompt-refiner` and `obsidian` as enabled.
62+
- Claude lists `prompt-refiner` and `obsidian` as connected.
63+
- Gemini lists `prompt-refiner` and `obsidian` as connected.
64+
65+
Codex may show `Unsupported` in the status column for stdio MCP entries. Treat the registration doctor as the authoritative config drift check.
66+
67+
## 5. Verify Dashboard Runtime Health
68+
69+
Start or restart the local background runtime:
70+
71+
```powershell
72+
$repo = 'C:\PersonalRepo\portfolio\Promptimprover\universal-refiner'
73+
Get-CimInstance Win32_Process |
74+
Where-Object { $_.Name -eq 'node.exe' -and ($_.CommandLine -match 'universal-refiner.*dist/src/index.js' -or $_.CommandLine -match 'universal-refiner.*dist\\src\\index.js') } |
75+
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
76+
77+
$env:PROMPT_REFINER_BACKGROUND = 'true'
78+
Start-Process -WindowStyle Hidden -FilePath node -ArgumentList (Join-Path $repo 'dist\src\index.js') -WorkingDirectory $repo
79+
```
80+
81+
Check health:
82+
83+
```powershell
84+
Invoke-RestMethod http://127.0.0.1:3000/api/health | ConvertTo-Json -Depth 6
85+
```
86+
87+
Expected result:
88+
89+
- `runtime.status` is `online`.
90+
- `semantic.local.enabled` is `true`.
91+
- `semantic.local.models` includes `gemma3:12b` and `gemma3:1b`.
92+
93+
## 6. Verify Live Gemma Integration
94+
95+
```powershell
96+
$env:PROMPT_REFINER_ACCEPTANCE_BASE_URL = 'http://localhost:9000/v1'
97+
npm.cmd run acceptance:gemma:live
98+
```
99+
100+
Expected result:
101+
102+
```text
103+
Live semantic acceptance passed for gemma3:12b and gemma3:1b at http://localhost:9000/v1.
104+
Semantic acceptance passed: gemma3:12b -> gemma3:1b and outage provider fallback.
105+
```
106+
107+
Warnings such as `HTTP 503` for `gemma3:12b` and `fetch failed` during the outage section are expected. They prove fallback and outage paths are being exercised. The command must still exit successfully.
108+
109+
## 7. Verify Packaged Runtime Directly
110+
111+
```powershell
112+
npm.cmd run acceptance:package-runtime
113+
```
114+
115+
Expected result:
116+
117+
```text
118+
Package runtime smoke passed: installed gemini-prompt-refiner-8.0.0 and served /api/health on <port>.
119+
```
120+
121+
This catches missing production dependencies that are hidden by the local workspace.
122+
123+
## 8. Confirm GitHub CI
124+
125+
After pushing a branch and opening a pull request:
126+
127+
```powershell
128+
gh pr checks <PR_NUMBER> --repo Coding-Autopilot-System/Promptimprover
129+
gh run list --repo Coding-Autopilot-System/Promptimprover --branch <BRANCH_NAME> --limit 10
130+
```
131+
132+
Expected result:
133+
134+
- `build-and-test` passes.
135+
- Both acceptance matrix jobs pass.
136+
- `stress` passes.
137+
- `windows` passes.
138+
- `supply-chain` passes.
139+
- `release-gate` passes.
140+
141+
Remote CI is the authoritative proof for Linux and Windows clean-checkout behavior.

universal-refiner/package-lock.json

Lines changed: 37 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

universal-refiner/register-global.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
param(
33
[switch]$Check,
44
[switch]$Apply,
5-
[string]$ProfileRoot = ("C:\Users\KimHarjam{0}ki" -f [char]0x00E4),
5+
[string]$ProfileRoot = "C:\Users\KimHarjamaki",
66
[string]$CodexHome,
77
[string]$ObsidianVaultPath = "C:\repo\global.obsidian"
88
)

universal-refiner/scripts/operations/register-global.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
param(
33
[switch]$Check,
44
[switch]$Apply,
5-
[string]$ProfileRoot = ("C:\Users\KimHarjam{0}ki" -f [char]0x00E4),
5+
[string]$ProfileRoot = "C:\Users\KimHarjamaki",
66
[string]$CodexHome,
77
[string]$ObsidianVaultPath = "C:\repo\global.obsidian"
88
)

universal-refiner/scripts/security/scan-secrets.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ const PATTERNS = [
66
{ name: "OpenAI API key", expression: /\bsk-[A-Za-z0-9_-]{20,}\b/g },
77
{ name: "Azure storage connection string", expression: /\bDefaultEndpointsProtocol=https?;AccountName=[^;\s]+;AccountKey=[^;\s]+/gi },
88
{ name: "Private key", expression: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/g },
9+
{
10+
name: "Credential assignment",
11+
expression: /\b(?:authorization|password|passwd|pwd|secret|client[_-]?secret|access[_-]?token|refresh[_-]?token|api[_-]?key|x-api-key|private[_-]?key|connection[_-]?string|accountkey|sig|token|aws[_-]?(?:access[_-]?key[_-]?id|secret[_-]?access[_-]?key)|azure[_-]?client[_-]?secret|openai[_-]?api[_-]?key|github[_-]?token|gitlab[_-]?token|database[_-]?url|redis[_-]?url)\b\s*[:=]\s*(?:(["'])[^"'\r\n]{8,}\1|[A-Za-z0-9._~+/=-]{16,})/gi,
12+
},
13+
{
14+
name: "URL embedded credential",
15+
expression: /\b[a-z][a-z0-9+.-]*:\/\/(?:[^/\s:@]+:[^@\s]+@|[^\s?#]+[?&](?:password|secret|client[_-]?secret|access[_-]?token|refresh[_-]?token|api[_-]?key|x-api-key|accountkey|sig|token)=)/gi,
16+
},
917
];
1018

1119
const ALLOWED_FIXTURE_MARKER = "secret-scan: allow-fixture";
12-
const files = execFileSync("git", ["ls-files", "-z"], { encoding: "utf8" })
20+
const files = execFileSync("git", ["ls-files", "-z", "--cached", "--others", "--exclude-standard"], { encoding: "utf8" })
1321
.split("\0")
1422
.filter(Boolean);
1523
const findings = [];
@@ -34,4 +42,4 @@ if (findings.length > 0) {
3442
process.exit(1);
3543
}
3644

37-
console.log(`Secret scan passed for ${files.length} tracked files.`);
45+
console.log(`Secret scan passed for ${files.length} tracked and untracked non-ignored files.`);

universal-refiner/tests/dashboard-api.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// secret-scan: allow-fixture
12
import { afterEach, beforeEach, describe, expect, it } from "vitest";
23
import * as fs from "fs";
34
import * as os from "os";

universal-refiner/tests/dashboard-events.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// secret-scan: allow-fixture
12
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
23
import * as fs from "node:fs";
34
import * as os from "node:os";

universal-refiner/tests/register-global.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// secret-scan: allow-fixture
12
import { afterEach, describe, expect, it } from "vitest";
23
import { spawnSync } from "node:child_process";
34
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";

universal-refiner/tests/snippets.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// secret-scan: allow-fixture
12
import { describe, it, expect, beforeEach, afterEach } from "vitest";
23
import * as fs from "fs";
34
import * as path from "path";

0 commit comments

Comments
 (0)