Skip to content

Commit 19b6141

Browse files
authored
Merge pull request #69 from nForma-AI/release/0.41.15
release: 0.41.15 — automatic test reuse in verify-work
2 parents ce2ece1 + 9c2c855 commit 19b6141

5 files changed

Lines changed: 61 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

77
## [Unreleased]
88

9+
## [0.41.15] - 2026-04-07 — Automatic test reuse in verify-work
10+
11+
### Added
12+
- `feat(verify-work)`: `present_test` step now auto-discovers and runs framework-native tests (Playwright first, Jest fallback) via `maintain-tests discover` + `maintain-tests run-batch` before presenting to user — UAT completes automatically when all discovered tests pass, falls back to manual checkpoint when tests fail or no tests are found
13+
914
## [0.41.14] - 2026-04-06 — Dist-tag alignment automation
1015

1116
### Fixed

core/workflows/verify-work.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,55 @@ Proceed to `present_test`.
214214

215215
Read Current Test section from UAT file.
216216

217-
Before presenting this test, attempt automated verification per the `<automation_first>` protocol.
218-
- If automated verification succeeds: update the test result to `pass` with method `auto:{type}`, skip user presentation, and proceed to the next test.
219-
- If automated verification fails or is insufficient: present to user as normal (existing checkpoint box flow).
217+
Before presenting this test, attempt automated verification per the `<automation_first>` protocol.
218+
219+
Automation attempt (concrete):
220+
221+
1. Discover project test runners and candidate test files using the repo's test discovery helper. Prefer framework-native discovery (Playwright first, then Jest, then pytest):
222+
223+
```bash
224+
# Discover tests (writes JSON with `runners`, `test_files`, `by_runner`)
225+
DISCOVER_JSON=$(mktemp)
226+
node ~/.claude/nf/bin/gsd-tools.cjs maintain-tests discover --dir "${phase_dir:-.}" --output-file "$DISCOVER_JSON" || true
227+
```
228+
229+
2. If Playwright tests were discovered, prefer running only those (e2e). Otherwise fall back to Jest single-file runs when available.
230+
231+
```bash
232+
BATCH_FILE=$(mktemp)
233+
OUTPUT_JSON=$(mktemp)
234+
235+
# Prefer playwright runner if present and has files
236+
if grep -q '"playwright"' "$DISCOVER_JSON" && grep -q '\.spec\.' "$DISCOVER_JSON"; then
237+
# Build a small batch manifest containing discovered Playwright spec files
238+
node -e "const fs=require('fs'); const d=JSON.parse(fs.readFileSync(process.argv[1])); const files=(d.by_runner&&d.by_runner.playwright)||d.test_files||[]; const m={batch_id:Date.now(), runner:'playwright', files:files}; fs.writeFileSync(process.argv[2], JSON.stringify(m));" "$DISCOVER_JSON" "$BATCH_FILE"
239+
else
240+
# Try jest files as fallback
241+
node -e "const fs=require('fs'); const d=JSON.parse(fs.readFileSync(process.argv[1])); const files=(d.by_runner&&d.by_runner.jest)||d.test_files||[]; const m={batch_id:Date.now(), runner:'jest', files:files}; fs.writeFileSync(process.argv[2], JSON.stringify(m));" "$DISCOVER_JSON" "$BATCH_FILE"
242+
fi
243+
244+
# If manifest has files, run a short batch (timeout short to keep verify-work responsive)
245+
if [ -s "$BATCH_FILE" ] && grep -q '"files"' "$BATCH_FILE"; then
246+
node ~/.claude/nf/bin/gsd-tools.cjs maintain-tests run-batch --batch-file "$BATCH_FILE" --output-file "$OUTPUT_JSON" --timeout 300 || true
247+
248+
# Inspect results: if no failures, mark automated verification passed
249+
if grep -q '"failed_count": 0' "$OUTPUT_JSON" >/dev/null 2>&1; then
250+
# Record automated pass for this test (auto:browser for playwright, auto:jest for jest)
251+
echo "Automated verification succeeded via discovered tests. Results: $OUTPUT_JSON"
252+
# The workflow engine should update the UAT file: set Tests.{N}.result = pass and method = auto:{type}
253+
# (Interpreter: update in-memory test state and skip user presentation)
254+
else
255+
# Automation ran but some tests failed or timed out — capture artifacts and fall back to manual presentation
256+
echo "Automated verification attempted but reported failures. See $OUTPUT_JSON for details."
257+
fi
258+
else
259+
# No candidate test files discovered; fall back to lighter CLI/file inspection or present to user
260+
echo "No framework-native test files discovered for automated verification in ${phase_dir:-.}."
261+
fi
262+
```
263+
264+
- If automated verification (the maintain-tests run) succeeds with no failing tests: update the test result to `pass` with method `auto:{type}` (auto:browser for Playwright, auto:jest for Jest), skip user presentation, and proceed to the next test.
265+
- If automated verification fails, times out, or no tests were discovered: present to the user as normal (existing checkpoint box flow). If the run failed due to environment constraints (missing install, playwright browser missing, timeout), include remediation guidance in the UAT frontmatter (e.g., "run npm ci && npx playwright install", required ENV vars).
220266

221267
Display using checkpoint box format:
222268

docs/assets/terminal.svg

Lines changed: 1 addition & 1 deletion
Loading

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nforma.ai/nforma",
3-
"version": "0.41.14",
3+
"version": "0.41.15",
44
"description": "nForma — Multi-agent coding orchestrator with quorum consensus and formal verification (TLA+, Alloy, PRISM). Consensus before code, proof before production.",
55
"bin": {
66
"nforma": "bin/nforma-cli.js",

0 commit comments

Comments
 (0)