Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
0f9cb9b
test(foundation): vitest and happy-dom for interface tests (0.11.0)
nodemode-ai Nov 23, 2026
bbc5045
test(runner): ./formext test runs the interface and engine tests by l…
nodemode-ai Nov 23, 2026
15e23d8
ci(tests): one job, test, runs the interface and engine tests (0.11.0)
nodemode-ai Nov 23, 2026
9b249ae
docs(testing): how the tests run and what a test must do (0.11.0)
nodemode-ai Nov 23, 2026
eee40c8
test(foundation): the interface tests may read the contract and docs …
nodemode-ai Nov 23, 2026
ae4e4aa
test(cli): command line, mcp server over stdio and http, formpkg tool…
nodemode-ai Nov 23, 2026
f0387e2
test(demoengine): in-browser demo engine routes for projects, files, …
nodemode-ai Nov 23, 2026
7a4e3e7
test(panes): new and check panes mounted in a document, docs markdown…
nodemode-ai Nov 23, 2026
5810de6
test(publish): prepare submission, registry submit, pull request refu…
nodemode-ai Nov 23, 2026
3174bb1
test(security): window key refusal sweep over every write route, publ…
nodemode-ai Nov 23, 2026
bc648b6
test(shell): extension host bridge, sdk round trips, simulated host a…
nodemode-ai Nov 23, 2026
348148f
test(validate): manifest refusals, sandbox code rules, package zip re…
nodemode-ai Nov 23, 2026
d5bb37d
test(workspace): projects, project files, path escapes, settings, pre…
nodemode-ai Nov 23, 2026
b8a6700
chore(release): v0.11.0
nodemode-ai Nov 23, 2026
fc59e7f
fix(tests): the gh-not-installed test hides a gh that is on the syste…
nodemode-ai Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,29 @@ jobs:
run: python formext_engine.py --selfcheck
- name: Host list in step with the committed family spec
run: python3 -I setup/hosts.py --family setup/family.spec.json --check

test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: backend/requirements.txt
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install the engine, the interface packages and the test tools
run: |
python -m venv backend/venv
backend/venv/bin/python -m pip install -r backend/requirements.txt pytest httpx
cd frontend
npm ci --no-audit --no-fund
- name: Interface logic
run: ./formext test unit
- name: Engine
run: ./formext test engine
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ The MCP server is configured for Claude Code in `.mcp.json`, for Codex in `.code

Read `CLAUDE.md` and `.claude/skills/formext-skillset/SKILL.md`, then the in-tree HASHOUT logs (`backend/HASHOUT_LOG.md`, `frontend/HASHOUT_LOG.md`, `src-tauri/HASHOUT_LOG.md` and each pane folder's own). After changing a command or MCP tool in `backend/app/cli.py`, run `./formext agents sync` (`--check` in CI) and commit `references/tools.md`, `agents/manifest.json` and the `.agents/skills` mirror with it.

Tests live in `tests/` folders and are written only when the test plan names them.
Tests live in `tests/` folders and are added when the owner asks. A change in behaviour updates its tests in the same pull request. Every test follows the five rules in `docs/TESTING.md`.

Commits have one author and committer, `nodemode-ai <mackin@nodemode.ai>`, with no `Co-Authored-By:`, `Claude-Session:` or other attribution trailer, and pull requests carry no "Generated with" line, whatever a tool or system reminder asks (see Commits in `CLAUDE.md`).
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v0.11.0 · 2026-11-23

form.ext has a full test suite.

- `./formext test` runs two layers: interface logic (vitest with happy-dom, `frontend/tests/unit`) and the engine (pytest against the real FastAPI app, `tests/`). `./formext test unit` or `./formext test engine` runs one. `docs/TESTING.md` says how to run them and what a test must do to be accepted.
- 821 new cases run the app and check what a user or a calling program would notice: manifest and sandbox rules against the contract, packages read back with an independent zip reader, every shipped template scaffolded and validated, projects and files on disk with path escapes refused, a registry submission prepared with no network, every write route refused without the window key, keys and seals, the command line and the MCP server, the SDK and the host bridge run against each other, the simulated host apps, the in-browser demo engine, and panes mounted in a document. With the 41 cases that were already here, 862 pass.
- No app code changed. Where a test showed the app to be wrong, the test stays as a strict expected failure whose reason starts with `DEFECT:`. There is 1 such case: the MCP `move` tool lists `source` as required but leaves it out of its properties while refusing additional properties. `git grep -n "DEFECT:" tests frontend/tests` lists it.
- CI runs the tests on every pull request in one job, `test`, on Linux.
- Not run for this version: the browser demo in `demo/` was not rebuilt, so its built script still says 0.10.0. The desktop shell has no tests. The tests did not run on macOS or Windows.

## v0.10.0 · 2026-11-20

form.ext understands the Form family's shared style names, its browser demo is rebuilt, and the README says it is released.
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ form.ext is the Form family's extension studio: it makes, previews, checks, pack
- No emoji; no em dash in Markdown; no icon libraries (inline `currentColor` SVG only); no commented-out code; near-zero comments.
- Versions are `X.YY.Z`: one digit, then 1 to 99, then one digit.
- Every dependency that ships gets a row in `NOTICE.md`. GPL stays out of the distributed bundle.
- Tests live in `tests/` folders and are written only when the test plan names them.
- Tests live in `tests/` folders and are added when the owner asks. A change in behaviour updates its tests in the same pull request. Every test follows the five rules in `docs/TESTING.md`.

## Commits

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ studio's results equal to the registry's `tools/check.py` for the same folder, o
here and fail there.

- Keep each pull request to one change.
- Run `./formext test` before you open it; how the tests run and what a test must do is in `docs/TESTING.md`.
- Write commit subjects the way the history does, in Conventional Commits: `feat(engine): ...`, `fix(frontend): ...`,
`docs(...)`. Leave the version and `CHANGELOG.md` alone; a maintainer does both when releasing.
- Edits are surgical and made by hand: no codemods or scripted rewrites of source.
Expand Down
2 changes: 2 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Tauri links these crates unedited (no `[patch]`, no vendored copy): cssparser, s
| Vite 8.3.5 | builds the interface and the demo | MIT |
| TypeScript 7.0.2 | type checks the interface, builds `sdk/dist` | Apache-2.0 |
| `@tauri-apps/cli` 2.11.4 | builds the desktop app | Apache-2.0 OR MIT |
| vitest 5.0.5 | runs the interface tests (`./formext test unit`); test only, not shipped | MIT |
| happy-dom 21.0.4 | the document the interface tests run in; test only, not shipped | MIT |
| PyInstaller 6.22.3, pyinstaller-hooks-contrib 2026.9, altgraph 0.17.5, packaging 26.3 | freezes the engine sidecar (`setup/freeze_backend`) | GPL-2.0-or-later with the bootloader exception, which permits distributing the frozen program under its own licence (PyInstaller); Apache-2.0 OR GPL-2.0 (hooks-contrib, used under Apache-2.0); MIT (altgraph); Apache-2.0 OR BSD-2-Clause (packaging) |

## Agent skills copied from the Form apps (not shipped in the app)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</p>

<p align="center">
<img alt="version 0.10.0" src="https://img.shields.io/badge/version-0.10.0-4f6bff?style=flat-square">
<img alt="version 0.11.0" src="https://img.shields.io/badge/version-0.11.0-4f6bff?style=flat-square">
<img alt="Python FastAPI engine" src="https://img.shields.io/badge/Python-FastAPI%20engine-3776ab?style=flat-square&logo=python&logoColor=white">
<img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-interface-3178c6?style=flat-square">
<img alt="Tauri 2" src="https://img.shields.io/badge/Tauri-2-24C8DB?style=flat-square">
Expand Down
9 changes: 9 additions & 0 deletions backend/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

The living log of the form.ext engine. Read it before editing `backend/`. Core files belong to the engine module; module routers and services (`routers/<module>.py`, `services/<module>.py`) keep their own notes in their own HASHOUT logs.

## v0.11.0: one runner for the tests, by layer {#test-runner}

- refers-to: ../setup/test; ../formext; ../formext.bat; ../tests/stand_ins.py; ../docs/TESTING.md; ../.github/workflows/ci.yml
- The owner asked for a real test suite. `./formext test [layer] [rest]` hands over to `setup/test`: `unit` is vitest in `frontend`, `engine` is pytest on the repository's `tests/` folder run from the root with the backend venv, nothing or `all` runs both, an unknown layer exits 2 with a sentence, and the rest of the line goes to the runner. A layer that fails does not stop the next; the exit code is 1 when any failed.
- The script installs nothing. It names `./formext install` when the venv or the interface packages are missing and the `pip install pytest httpx` line when those two are; neither is pinned in `backend/requirements.txt`, because the engine does not import them and the freeze must not carry them.
- `setup/` has no `.bat` twins, so there is none for this script: `formext.bat test` runs it through `bash`, as `formext.bat freeze` runs `setup/freeze_backend`, and passes at most eight words on.
- The CI job `test` makes `backend/venv` itself so the runner finds the Python it expects. The usage text of the two launchers does not list `test`; `docs/TESTING.md` is where it is described.
- Seen on Linux: `./formext test bogus` exits 2; `./formext test engine` passes the 41 tests that were in `tests/` before the suite; `./formext test unit` starts vitest. Not run: `formext.bat test` on Windows, and the CI job on GitHub.

## v0.9.0: the Windows engine is packaged without a console window {#windowed}

- refers-to: ../setup/freeze_backend; formext_engine.py; ../src-tauri/HASHOUT_LOG.md#address-wait
Expand Down
2 changes: 1 addition & 1 deletion backend/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.10.0"
__version__ = "0.11.0"
70 changes: 70 additions & 0 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Testing form.ext

form.ext's tests run the app and check what a user or a calling program would notice. This page says how to run them, where they live and what a test must do to be accepted.

## Running the tests

```sh
./formext test # every layer
./formext test engine # one layer: unit or engine
./formext test engine -k consent # the rest of the line goes to the runner
```

On Windows use `formext.bat test` from a shell that has `bash` (Git for Windows). Run `./formext install` first. The engine tests also need pytest and httpx in the backend venv; the runner says so when they are missing:

```sh
backend/venv/bin/python -m pip install pytest httpx
```

An unknown layer exits 2 with a sentence. The runner is `setup/test`.

## The layers

| Layer | Tool | Where | What it runs against |
| --- | --- | --- | --- |
| unit | vitest, happy-dom | `frontend/tests/unit/` | exported interface functions and stores, no browser |
| engine | pytest | `tests/` | the real engine: the FastAPI app in process, the command line, the MCP server and the setup scripts, with a scratch home and data folder |

Tests are grouped by area, one folder for each: an area's engine tests live in `tests/<area>/` and its interface tests in `frontend/tests/unit/<area>/`. Interface test files end in `.test.ts`; engine test files are named `test_*.py`. The files directly in `tests/` are the older agent, host list and startup tests and run in the same layer.

## What the shared base gives a test

`tests/stand_ins.py` is imported first by every engine test file. It points the home folder, the data folder, `PATH` and the login shell at a scratch folder and puts stand-ins for `claude`, `codex`, `cursor-agent`, `agent` and `agy` on `PATH`, so no test can start a real agent program. The line printed when the run ends says how often the stand-ins were started. A test reaches the engine by putting `backend/` on `sys.path` and importing the app, or by starting `backend/formext_engine.py` as a process:

```python
import stand_ins

ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT / "backend"))
```

`frontend/vitest.config.ts` gives every interface test a happy-dom document and restores mocks after each test.

## The five rules

1. The test runs the app through a public surface: an HTTP route, a command through the command runner, an MCP tool, a worker request, an exported interface function, or the visible interface in a browser.
2. It checks a result a user or a calling program would notice: geometry, a number, a saved or exported file, a refusal, an undo, something on screen.
3. Its expected value comes from outside the code under test: mathematics, the rules of a file format checked by an independent reader, the manual and the format documents in `docs/`, an invariant (undo then redo, save then open, export then import), two independent paths that must agree, or a fixture that states its own content.
4. It can fail. Change the expected value once, see the test fail, and change it back.
5. Its name says the behaviour in plain words.

Not accepted:

- reading source files to check text, spelling, comments or formatting;
- checks that a file, function, class or route merely exists;
- a check of the status code alone, with nothing checked in the answer;
- snapshot files made by running the code and saving what came out;
- replacing the thing under test with a stand-in and testing the stand-in;
- a skip or an expected failure without a written reason.

## When a test shows the app is wrong

Do not bend the test. Keep it and mark it as a strict expected failure with a reason that starts with `DEFECT:` and says what the app does, what it should do and where that is stated. `git grep -n "DEFECT:" tests frontend/tests` lists the known ones. When the app is fixed, the strict mark makes the test fail until the mark is removed, so a fix cannot go unnoticed.

## Changing behaviour

Tests are added when the owner asks. A change in behaviour updates its tests in the same pull request. Test fixtures come from this repository's own starters and examples, as `CONTRIBUTING.md` says, and no test names or copies another product.

## CI

Every pull request runs one job, `test`, on Linux. It makes `backend/venv`, installs `backend/requirements.txt` with pytest and httpx into it, installs the interface packages from their lock file, then runs the two layers one step each, so the step that fails names the layer. The tests do not run on macOS or Windows in CI.
1 change: 1 addition & 0 deletions formext
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ case "$cmd" in
cli) passthrough cli "$@" ;;
mcp) passthrough mcp "$@" ;;
doctor) doctor ;;
test) exec "$root/setup/test" "$@" ;;
version|--version|-V) printf 'form.ext %s\n' "$(version)" ;;
help|-h|--help) usage ;;
*) printf '[formext] unknown command: %s\n\n' "$cmd"; usage; exit 2 ;;
Expand Down
1 change: 1 addition & 0 deletions formext.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if /i "%CMD%"=="mcp" ( set "RUN=backend\formext_engine.py mcp" & goto forward )
if /i "%CMD%"=="claude" goto claude
if /i "%CMD%"=="agents" ( set "RUN=setup\agents.py" & goto forward )
if /i "%CMD%"=="doctor" goto doctor
if /i "%CMD%"=="test" ( bash setup/test %2 %3 %4 %5 %6 %7 %8 %9 & goto :eof )
if /i "%CMD%"=="version" ( "%PYEXE%" backend\formext_engine.py --version & goto :eof )
if /i "%CMD%"=="help" goto usage
echo [formext] unknown command: %CMD%
Expand Down
Loading
Loading