Repository navigation
test(suite): a real test suite, ./formext test and CI for it (0.11.0) - #14
Conversation
frontend/vitest.config.ts runs tests/unit/**/*.test.ts in happy-dom. vitest 5.0.5 and happy-dom 21.0.4 are development dependencies, the versions FormCAD uses; neither ships. Ran: one probe test under npx vitest run, passed.
…ayer (0.11.0) A new script, setup/test, runs the tests one layer at a time: unit is vitest in frontend, engine is pytest on the tests folder from the repository root with the backend venv. No layer or all runs both, an unknown layer exits 2 with a sentence, and the rest of the line goes to the runner. It says what to install when the interface packages, the venv, pytest or httpx are missing. The launcher and formext.bat each gain the one test line; the usage text is not changed. Run: ./formext test bogus exits 2; ./formext test engine passes 41 tests; ./formext test unit starts vitest, which finds no test files yet.
The workflow gains a job named test on Linux with Python 3.12 and Node 22. It makes backend/venv the way the launcher expects, installs backend/requirements.txt with pytest and httpx into it, runs npm ci in frontend, and then runs ./formext test unit and ./formext test engine one step each, so the step that fails names the layer. No existing job ran these tests, so nothing was removed. Run: the workflow file was read back as YAML and lists the jobs frontend, engine and test. The job itself has not run on GitHub.
A new page, docs/TESTING.md, says how to run the tests, what the two layers are, where an area's tests live, what tests/stand_ins.py gives an engine test, the five rules and the list of what is not accepted, the DEFECT: rule for a test that shows the app is wrong, and what CI runs. The tests line in CLAUDE.md and AGENTS.md now says tests are added when the owner asks, a change in behaviour updates its tests in the same pull request, and every test follows the five rules. CONTRIBUTING.md points to the page, NOTICE.md lists vitest and happy-dom as test only and not shipped, and backend/HASHOUT_LOG.md records the runner. Run: a search of the changed files for an em dash found none. No code changed in this commit.
…folders beside frontend (0.11.0) frontend/vitest.config.ts allows the folders beside frontend, as vite.config.ts does, so the shell and the docs pane, which load raw files from ../contract and ../docs, import in a test as they do in the app. Ran: npx vitest run, 265 passed.
… and engine selfcheck run as programs (0.11.0) Runs the formext command line, the MCP server (stdio and the engine's /mcp route), contract/tools/formpkg.py and formext_engine.py as programs against temp data folders and checks output, exit codes, files made and refusals; expected values come from the README and docs/MANUAL.md (commands, 33/19/14 tool counts, Ask/Allowed/Blocked), JSON-RPC 2.0 and MCP shapes, an independent zip and SHA-256 reader, round trips, and two routes that must agree. Ran: backend/venv/bin/python -m pytest tests/cli -q -p no:cacheprovider, 65 passed, 1 expected failures. The folder is a package (an empty __init__.py) and its helpers are imported relatively, so its conftest does not take the module name the other test folders import.
…validation, settings and refusals, plus its zip, hash and diff helpers (0.11.0) Drives the demo engine through its exported dispatch router: projects made, listed, opened, linked, imported and removed, files written, read back, moved and deleted, validation answers, settings, and refusals for unknown routes and bad input. Expected values come from the manual (package/ layout, trash, folders opened in place), the real engine's stated messages and status codes in backend/app, round trips, and published vectors (CRC-32 check value, SHA-256 of abc, RFC 4648 base64, zip record layout read by an independent reader in the test). Ran: cd frontend && npx vitest run tests/unit/demoengine, 64 passed, 0 expected failures.
…, studio manifest and editor helpers, preview message text (0.11.0) The New and Check panes are mounted into a happy-dom document with only the engine client stubbed, then checked for what a user sees and can do: lists filled from engine answers, refusals shown as sentences, no request for an empty name, the exact request a button sends, and the same nodes kept when data arrives again. Expected values come from the stubbed engine answers, the pane's own on-screen wording rules, Markdown rules, and round trips (manifest text parsed back by JSON.parse, an editor change applied by hand must give the new text). Ran: cd frontend && npx vitest run tests/unit/panes, 70 passed, 0 expected failures.
…sals and prepared request, host sources (0.11.0) Drives the publish and sources routes on the real app in process: the submission folder and its index entry, the registry folder layout, the refusals before a pull request and the branch and request prepared against local bare repositories, and sources listed, pulled, read, searched, refused and removed. Expected values come from docs/MANUAL.md, contract/schema/extensions.schema.json, hashlib over the files on disk, git reading the pushed branch, and files the tests wrote themselves. Ran: backend/venv/bin/python -m pytest tests/publish -q -p no:cacheprovider, 65 passed, 0 expected failures. The folder is a package (an empty __init__.py) and its helpers are imported relatively, so its conftest does not take the module name the other test folders import.
…isher keys kept private, settings seal tamper detection, local family and portal catalogue reads, ordered event bus and agent feed (0.11.0) Checks through the real app's HTTP routes, live and agent sockets and public service functions that every non-GET route answers 403 "Only the form.ext window can do this" without the key (the sweep walks the app's own route tree and is checked against its API schema, never calling the two forbidden publish routes), that private key halves stay on disk (0600) and out of every answer, that hand-edited or forged sealed settings are reported broken and dropped, that the family list and FormPortal catalogue come from local files, and that bus and agent-feed events arrive in order without argument values; expected values come from the stated refusal sentences, an independent Ed25519 and HMAC-SHA256 computation, the dev.json contract and files written by the tests. Ran: backend/venv/bin/python -m pytest tests/security -q -p no:cacheprovider, 170 passed, 0 expected failures.
…pps and the shell with docs, home and library panes (0.11.0) Checks the host bridge sandbox, handshake, permission refusals, consent memory, storage cap and timeouts, the SDK and the host wired to each other through postMessage, every simulated host app plus form.md apply, undo and reads, the sample wav and pdf through independent header and xref readers, and the real shell booted on index.html with docs, home and library mounted; expected values come from contract/CONTRACT.md (error codes, permission words, 30 s and 300 s timeouts, 256 KB storage, sandbox attributes), the docs markdown files, RIFF and PDF rules, and undo and round-trip invariants. Ran: cd frontend && npx vitest run tests/unit/shell, 131 passed, 0 expected failures.
…ad back, every shipped template scaffolds and validates (0.11.0) Checks what makes an extension manifest valid or refused and with which message, which code the sandbox blocks and at which line, that a package built over HTTP reads back with Python's zipfile exactly as the contract states (sorted names, 1980 dates, mode 0644, deflate, no path escapes, manifest inside, SHA-256 and size), and that all 36 shipped templates scaffold a project that validates; expected values come from contract/CONTRACT.md, contract/schema/package.schema.json, the files on disk and an independent zip and sha256 reader. Ran: backend/venv/bin/python -m pytest tests/validate -q -p no:cacheprovider, 160 passed, 0 expected failures.
…view serving and library refusals through the real app (0.11.0) Projects are created, listed, opened, renamed, imported, linked and deleted over HTTP and read back from disk; files are written, read, moved and deleted with climbing, absolute and symlinked paths refused; settings are saved and read back; the preview route is checked for bytes and content type per file kind. Expected values come from round trips (write then read, route against disk), the standard media types of the file formats, the README rule that only the window can change anything, and the invariant that nothing lands outside the project. Ran: backend/venv/bin/python -m pytest tests/workspace -q -p no:cacheprovider, 96 passed, 0 expected failures.
The version moves to 0.11.0 in backend/app/__init__.py, frontend/package.json, frontend/package-lock.json, frontend/src/shell/version.ts, the demo engine's health answer, src-tauri (Cargo.toml, Cargo.lock, tauri.conf.json) and the README badge, each by hand. CHANGELOG.md describes v0.11.0. Ran: ./formext test unit (265 passed) and ./formext test engine (597 passed, 1 expected failure). Not run: the browser demo was not rebuilt, the desktop shell, macOS and Windows.
…m path (0.11.0) The test removed FORMEXT_GH_BIN and emptied the fixed system folders, but the app also looks for gh on PATH, and the CI runner has one in /usr/bin, so readiness answered that gh is there. For the request the test now points PATH at a folder that holds only git. Ran: ./formext test engine with a gh program in /usr/bin and without one, 597 passed and 1 expected failure both times.
test(suite): a real test suite, ./formext test and CI for it (0.11.0)Summary
Commits
The short hashes are left out because signing changes them. The Versionv0.11.0 (the release commit is last). The version moves to 0.11.0 in backend/app/init.py, frontend/package.json, frontend/package-lock.json, frontend/src/shell/version.ts, the demo engine's health answer, src-tauri (Cargo.toml, Cargo.lock, tauri.conf.json) and the README badge, each by hand. CHANGELOG.md describes v0.11.0. Ran: ./formext test unit (265 passed) and ./formext test engine (597 passed, 1 expected failure). Not run: the browser demo was not rebuilt, the desktop shell, macOS and Windows. ChecksRan: ./formext test unit (265 passed) and ./formext test engine (597 passed, 1 expected failure). Not run: the browser demo was not rebuilt, the desktop shell, macOS and Windows. The workflow itself has not run on GitHub; the After the first push the MergingMerge with a merge commit so each commit and its signature stays. Do not squash. |
test(suite): a real test suite, ./formext test and CI for it (0.11.0)
Summary
frontend/tests/unit) and 556 for the engine (pytest against the real FastAPI app,tests/). With the 41 cases that were already here, 862 pass../formext testruns both layers,./formext test unitor./formext test engineruns one. CI runs them in one new job,test; no job ran tests before.docs/TESTING.mdholds the five rules a test must meet;CLAUDE.mdandAGENTS.mdnow say tests are added when the owner asks and follow those rules.DEFECT:: the MCPmovetool listssourceas required but leaves it out of its properties while refusing additional properties.FORMEXT_GH_BINat a stand-in and use local bare repositories, because the app finds a realgheven when PATH is replaced.NOTICE.md; neither ships.Commits
The short hashes are left out because signing changes them.
Version
v0.11.0 (the release commit is last). The version moves to 0.11.0 in backend/app/init.py, frontend/package.json, frontend/package-lock.json, frontend/src/shell/version.ts, the demo engine's health answer, src-tauri (Cargo.toml, Cargo.lock, tauri.conf.json) and the README badge, each by hand. CHANGELOG.md describes v0.11.0. Ran: ./formext test unit (265 passed) and ./formext test engine (597 passed, 1 expected failure). Not run: the browser demo was not rebuilt, the desktop shell, macOS and Windows.
Checks
Ran: ./formext test unit (265 passed) and ./formext test engine (597 passed, 1 expected failure).
From a clean clone of this branch:
npm ciinfrontendwith the stock npm of Node 22, thennpx vitest run: npm ci okTests 265 passed (265).
Sampled expected values were flipped in every lane to see the tests fail, then restored.
Not run: the browser demo was not rebuilt, the desktop shell, macOS and Windows. The workflow itself has not run on GitHub; the
.batrunner has not run on Windows.Merging
Merge with a merge commit so each commit and its signature stays. Do not squash.