Skip to content

Commit a81dc22

Browse files
committed
feat(mcp): run, track, file and compare the AI panel model tests
Four phoenix-builder tools so a running Claude session can be asked "run the AI test suite" and do the rest. The session is the runner and the judge; the tools do the deterministic parts. - run_ai_test_suite: installs the fixture, records git revs / CLI version / connected instance, opens a run record, and returns the runner briefing plus the documents for exactly the tests in scope — quick (default), all, a suite name, explicit test ids, or resumeRunId for a stopped run. - ai_test_progress: called after every test; answers "how far along is it", lists runs, and stops a run on request. Progress lives in reports/runs/. - save_ai_test_report: writes reports/latest.md, overwriting the previous run — git history is the archive, baseline.md is never touched. A stopped run is saved with a Partial section; a completed run's progress record is removed. - compare_ai_test_reports: diffs latest.md against baseline.md by default, or against the last committed latest.md ("previous"), flagging REGRESSION / quality drop / slower per the suite's thresholds. Reads the merged "PASS · poor" Result column and the older two-column form. The suite itself lives in phoenix-pro under unit-tests/ai_model_tests/. CLAUDE.md tells any session what to do when asked; the MCP README lists the tools. .eslintignore excludes the suite's fixture pages — they are deliberately broken and are test data, not code.
1 parent 7163b10 commit a81dc22

4 files changed

Lines changed: 471 additions & 0 deletions

File tree

‎.eslintignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ test/**/node_modules/**/*.js
2525
test/virtual-server-test.js
2626
test/spec/ESLintExtensionTest-files
2727

28+
29+
# AI panel model-test fixtures: deliberately broken pages the tests operate on, not code
30+
src/extensionsIntegrated/phoenix-pro/unit-tests/ai_model_tests/fixtures/**

‎CLAUDE.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ Use `exec_js` to run JS in the Phoenix browser runtime. jQuery `$()` is global.
4848

4949
**Check logs:** `get_browser_console_logs` with `filter` regex (e.g. `"AI UI"`, `"error"`) and `tail` — includes both browser console and Node.js (PhNode) logs. Use `get_terminal_logs` for Electron process output (only available if Phoenix was launched via `start_phoenix`).
5050

51+
## AI model tests (behavioural tests of the AI panel)
52+
When asked to "run the AI test suite" / "run the model tests" / "run EC-1 and UB-2": call `run_ai_test_suite` (phoenix-builder MCP) with `suite` (`quick` | `all` | a suite name), or `tests` for specific IDs, or `resumeRunId` to continue. It installs the fixture, opens a run record, and returns the briefing plus the test documents from `src/extensionsIntegrated/phoenix-pro/unit-tests/ai_model_tests/`. You are the runner and the judge — follow them exactly, deterministic checks first. After **every** test call `ai_test_progress` and tell the user one progress line. If the user says stop: `ai_test_progress({ runId, stop: true })`, then save. Finish with `save_ai_test_report`, then `compare_ai_test_reports({})`, and tell the user the report path, PASS/FAIL counts, any regressions, and the Observations section.
53+
5154
## Writing Tests
5255
- **Never use `awaits(number)`** (fixed-time waits) in tests — they cause flaky failures. Always use `awaitsFor(condition)` to wait for a specific condition to become true.
5356
- Use `editor.*` APIs (e.g. `editor.document.getText()`, `editor.getCursorPos()`, `editor.setSelection()`) instead of accessing `editor._codeMirror` directly.

‎phoenix-builder-mcp/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ Reloads the Phoenix app. Prompts to save unsaved files before reloading.
9797
### `force_reload_phoenix`
9898
Force-reloads the Phoenix app without saving unsaved changes.
9999

100+
### `run_ai_test_suite`
101+
Starts (or resumes) the AI panel model tests and hands the session everything it needs: installs the fixture project, gathers git revisions / CLI version / connected instance, opens a run record, and returns the runner briefing plus the test documents from `src/extensionsIntegrated/phoenix-pro/unit-tests/ai_model_tests/`. The session is the runner and the judge. `suite`: `quick` (default), `all`, or a suite name; or `tests: ["EC-1","UB-2"]` for specific tests; or `resumeRunId` to continue a stopped run. Ask Claude: *"run the AI test suite"*, *"run just the plan-mode tests"*, *"run EC-1 and UB-2"*.
102+
103+
### `ai_test_progress`
104+
Called by the runner after every test to record the result; also answers *"how far along is it?"* (`{ runId }`), lists runs (`{}`), and stops a run (`{ runId, stop: true }`). Progress lives in `reports/runs/<runId>.json`, which you can open at any time.
105+
106+
### `save_ai_test_report`
107+
Writes the finished report to `reports/latest.md` inside the suite folder, overwriting the previous run (git history keeps earlier runs; `baseline.md` is never touched). A stopped run is saved with a Partial section listing the unrun tests.
108+
109+
### `compare_ai_test_reports`
110+
Diffs two reports test by test — by default `latest.md` against `baseline.md`, or `against: "previous"` for the last committed run — and flags regressions, quality drops, and slower runs using the thresholds in `model_tests.md`.
111+
100112
## Typical Claude Code workflow
101113

102114
```

0 commit comments

Comments
 (0)