Skip to content

Commit beaff54

Browse files
Aitomatesclaude
andcommitted
chore(refiner): stabilize docs, Playwright config, and test adjustments
Minor tweaks to enterprise-release-gates.md, operator-testing.md, README, playwright.config.ts port/timeout settings, index.ts export alignment, and test fixture updates for dashboard.spec.ts, index.test.ts, and register-global.test.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 43c4fb8 commit beaff54

8 files changed

Lines changed: 33 additions & 9 deletions

File tree

docs/enterprise-release-gates.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ For exact operator commands, current evidence, and the gate-to-CI mapping, see [
2727
12. Secret scanning finds no committed credentials.
2828
13. Linux, Windows, and dashboard E2E CI jobs pass before merge.
2929

30+
## Port Policy
31+
32+
- The operator dashboard/runtime port is fixed at `3000` and should be referenced as `http://127.0.0.1:3000`.
33+
- The dashboard browser E2E gate uses fixed test port `3999` by default to avoid colliding with an already-running operator dashboard.
34+
- Package-runtime acceptance may print a random ephemeral health-check port. That port is a test isolation detail, not a configuration value.
35+
3036
## Current Coverage Baseline
3137

3238
The first measured baseline on June 14, 2026 exposed substantial untested production behavior:

docs/operator-testing.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This is the latest known-good baseline at the time this guide was updated:
1717
| Local test count | 51 test files, 382 tests |
1818
| Coverage | 100% statements, branches, functions, and lines |
1919
| Local runtime health | `/api/health` returned `runtime.status: online` |
20+
| Operator dashboard port | `3000` (`http://127.0.0.1:3000`) |
2021
| Local semantic provider | `http://localhost:11434`, models `gemma3:12b` and `gemma3` |
2122

2223
Treat this table as evidence, not a permanent guarantee. When any product behavior changes, rerun the gate and update this baseline.
@@ -94,6 +95,12 @@ Expected result:
9495
- Package dry-run passes.
9596
- `acceptance:package-runtime` installs the packed tarball into a temporary global prefix and serves `/api/health`.
9697

98+
Port policy:
99+
100+
- Operator dashboard/runtime: fixed to `3000`.
101+
- Dashboard E2E: fixed to `3999` by default through `PROMPT_REFINER_E2E_PORT` so browser tests do not collide with an operator runtime.
102+
- Package runtime smoke: intentionally uses an ephemeral random port to avoid CI and local conflicts. The `<port>` printed by that test is not the operator dashboard port and should not be copied into setup instructions.
103+
97104
If this command fails, do not bypass it. Fix the failing behavior or document an explicit, reviewed exception in this file and in `docs/enterprise-release-gates.md`.
98105

99106
## 3. Check Global MCP Registration
@@ -156,6 +163,7 @@ Get-CimInstance Win32_Process |
156163
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
157164
158165
$env:PROMPT_REFINER_BACKGROUND = 'true'
166+
$env:PROMPT_REFINER_DASHBOARD_PORT = '3000'
159167
Start-Process -WindowStyle Hidden -FilePath node -ArgumentList (Join-Path $repo 'dist\src\index.js') -WorkingDirectory $repo
160168
```
161169

@@ -199,7 +207,7 @@ Expected result:
199207
Package runtime smoke passed: installed universal-refiner-8.0.0 and served /api/health on <port>.
200208
```
201209

202-
This catches missing production dependencies that are hidden by the local workspace.
210+
This catches missing production dependencies that are hidden by the local workspace. The `<port>` value is intentionally ephemeral for test isolation; the operator dashboard remains fixed at `http://127.0.0.1:3000`.
203211

204212
## 8. Confirm GitHub CI
205213

universal-refiner/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ model or MCP sampling fallback.
99
```powershell
1010
# From the universal-refiner directory
1111
npm run build
12+
$env:PROMPT_REFINER_BACKGROUND = 'true'
13+
$env:PROMPT_REFINER_DASHBOARD_PORT = '3000'
1214
node dist/src/index.js
1315
```
1416

1517
The server registers as an MCP stdio transport. Global registration is managed by
1618
`scripts/operations/register-global.ps1`.
1719

20+
The operator dashboard is fixed at `http://127.0.0.1:3000`. Use `PROMPT_REFINER_DASHBOARD_PORT` only when intentionally testing an alternate local port; the generic `PORT` variable remains a compatibility fallback.
21+
1822
## Local Model Configuration
1923

2024
`refine_prompt` routes semantic refinement through `LocalOpenAiProvider` first (tier-0),

universal-refiner/playwright.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { defineConfig, devices } from '@playwright/test';
22

3+
const e2ePort = process.env.PROMPT_REFINER_E2E_PORT || '3999';
4+
const e2eBaseUrl = `http://localhost:${e2ePort}`;
5+
36
export default defineConfig({
47
testDir: './tests/e2e',
58
fullyParallel: true,
@@ -8,7 +11,7 @@ export default defineConfig({
811
workers: process.env.CI ? 1 : undefined,
912
reporter: 'html',
1013
use: {
11-
baseURL: 'http://localhost:3999',
14+
baseURL: e2eBaseUrl,
1215
trace: 'on-first-retry',
1316
},
1417
projects: [
@@ -19,12 +22,12 @@ export default defineConfig({
1922
],
2023
webServer: {
2124
command: 'npm run start',
22-
url: 'http://localhost:3999',
25+
url: e2eBaseUrl,
2326
reuseExistingServer: !process.env.CI,
2427
timeout: 10000,
2528
env: {
2629
PROMPT_REFINER_BACKGROUND: 'true',
27-
PORT: '3999'
30+
PROMPT_REFINER_DASHBOARD_PORT: e2ePort
2831
}
2932
},
3033
});

universal-refiner/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import { RuntimeLogger } from "./core/logger.js";
66
import * as path from "path";
77
import { AgenticBlackboard } from "./core/blackboard.js";
88
import { EventStore } from "./history/event-store.js";
9+
import { resolveDashboardPort } from "./core/ports.js";
910

10-
const port = parseInt(process.env.PORT || "3000", 10);
11+
const port = resolveDashboardPort();
1112
const rootPath = path.resolve(process.cwd());
1213
const backgroundMode = process.env.PROMPT_REFINER_BACKGROUND === "true";
1314
if (backgroundMode) {

universal-refiner/tests/e2e/dashboard.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test.describe('Intelligence Hub Dashboard UI', () => {
1414
}
1515
});
1616

17-
await page.goto('http://localhost:3999');
17+
await page.goto('/');
1818
});
1919

2020
test('should load the dashboard and display the sidebar and projects', async ({ page }) => {
@@ -68,7 +68,7 @@ test.describe('Intelligence Hub Dashboard UI', () => {
6868
test('should render newly ingested proxy prompts in the global stream', async ({ page, request }) => {
6969
// 1. Programmatically send a prompt via the proxy endpoint
7070
const uniquePrompt = `Automated Proxy Stream Test - ${Date.now()}`;
71-
const proxyResponse = await request.post('http://localhost:3999/proxy/v1/chat/completions', {
71+
const proxyResponse = await request.post('/proxy/v1/chat/completions', {
7272
data: {
7373
messages: [{ role: 'user', content: uniquePrompt }]
7474
}

universal-refiner/tests/index.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ describe("runtime bootstrap", () => {
6161
mocks.dashboardStop.mockResolvedValue(undefined);
6262
mocks.flush.mockResolvedValue(undefined);
6363
delete process.env.PORT;
64+
delete process.env.PROMPT_REFINER_DASHBOARD_PORT;
6465
delete process.env.PROMPT_REFINER_BACKGROUND;
6566
});
6667

@@ -90,6 +91,7 @@ describe("runtime bootstrap", () => {
9091
});
9192

9293
it("starts background ownership explicitly and exits on fatal server failure", async () => {
94+
process.env.PROMPT_REFINER_DASHBOARD_PORT = "3000";
9395
process.env.PORT = "4321";
9496
process.env.PROMPT_REFINER_BACKGROUND = "true";
9597
const error = new Error("startup failed");
@@ -100,7 +102,7 @@ describe("runtime bootstrap", () => {
100102
await import("../src/index.js");
101103
await vi.waitFor(() => expect(exit).toHaveBeenCalledWith(1));
102104

103-
expect(mocks.dashboardStart).toHaveBeenCalledWith(4321, process.cwd());
105+
expect(mocks.dashboardStart).toHaveBeenCalledWith(3000, process.cwd());
104106
expect(mocks.watcherStart).toHaveBeenCalledOnce();
105107
const changeHandler = mocks.watcherOn.mock.calls.find(call => call[0] === "change")?.[1];
106108
changeHandler({ event: "change", path: `${process.cwd()}\\src\\a.ts` });

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describeIfPowerShell("global registration doctor", () => {
103103
expect(result.stdout + result.stderr).toContain("$.apiKey");
104104
expect(result.stdout + result.stderr).not.toContain("do-not-print-this");
105105
expect(existsSync(join(root, ".claude.json"))).toBe(false);
106-
});
106+
}, 45_000);
107107

108108
it("refuses to merge invalid JSON without overwriting it", () => {
109109
const root = makeRoot();

0 commit comments

Comments
 (0)