Skip to content

test(suite): a real test suite, ./formfabric test and CI for it (0.31.0) - #15

Merged
nodemode-ai merged 13 commits into
mainfrom
test/suite-0.31.0
Nov 24, 2026
Merged

nodemode-ai merged 13 commits into
mainfrom
test/suite-0.31.0

Conversation

@nodemode-ai

Copy link
Copy Markdown
Contributor

test(suite): a real test suite, ./formfabric test and CI for it (0.31.0)

Summary

  • formfabric gets 1,006 new test cases: 369 for the interface (vitest with happy-dom, frontend/tests/unit) and 637 for the service (pytest against the real FastAPI app, backend/tests). With the 53 cases that were already here, 1,059 pass.
  • ./formfabric test runs both layers, ./formfabric test unit or ./formfabric test engine runs one. CI runs them in one job, test; the pytest step moved there from the backend job.
  • docs/TESTING.md holds the five rules a test must meet; CLAUDE.md and AGENTS.md no longer say that no tests are kept in the repo.
  • No app code changed. Five cases stay as strict expected failures whose reason starts with DEFECT:: the MCP endpoint answers a message without a method, or with a method that is not a string, with -32601 where JSON-RPC 2.0 says -32600 (HTTP and stdio); the stdio server answers array params with -32603 where -32602 is meant; the Python package sends a nan width to the engine although its README says arguments are checked.
  • vitest 5.0.5 and happy-dom 21.0.4 are new development dependencies with a row in NOTICE.md; neither ships.

Commits

  • test(foundation): vitest and happy-dom for interface tests (0.31.0)
  • test(runner): ./formfabric test runs the interface and service tests by layer (0.31.0)
  • ci(tests): one test job runs the interface and service tests, a step for each layer (0.31.0)
  • docs(testing): how to run the tests and what a test must do to be accepted (0.31.0)
  • test(commands): command routes, terminal commands, plugin runs, events, engine refusal and the mcp http and stdio surfaces (0.31.0)
  • test(core): configuration from the environment, local guard and window guard on every write route, saved preferences, health and system answers, engine-not-built refusal, quiet and engine logs (0.31.0)
  • test(garment): unit conversions, panel placement and hit maths, export format and option parsing, uv and job state, sewing lines, fabric colours, joint angles, trim records (0.31.0)
  • test(library): garment library, trash, previews, imports, recent list, crash recovery journal and autosave path (0.31.0)
  • test(pattern): seam chain lengths, line picking, span runs, drag constraints, edge normals, grid steps, style line hits, seam check list and port picker (0.31.0)
  • test(sdk): python package formfabric, its generated command functions, hand api, backends, gof hand-off and the version tool (0.31.0)
  • test(shell): i18n lookup, themes, toasts, prefs, command registry, shortcuts dialog, command search, engine client, window key, agent markdown and dock state (0.31.0)
  • test(view3d): camera and matrix maths, projection and picking round trips, colour ramps, scalar frames, png resolution tag, animation state parsing (0.31.0)
  • chore(release): 0.31.0, a test suite and ./formfabric test

The short hashes are left out because signing changes them.

Version

v0.31.0 (the release commit is last). The version moves to 0.31.0 at every site setup/version.py reads, in both lock files, in SECURITY.md, and by hand in the generated skill reference and python/formfabric/catalogue.json, which ./formfabric agents sync would write the same way once the engine is built. CHANGELOG.md describes 0.31.0. Ran: python3 setup/version.py check (in step), python3 setup/i18n.py check, ./formfabric test unit (369 passed) and ./formfabric test engine (690 passed, 1 skipped, 5 expected failures). Not run: ./formfabric agents sync and agents check (they need the built engine), the native engine, the desktop shell, macOS and Windows.

Checks

Ran: python3 setup/version.py check (in step), python3 setup/i18n.py check, ./formfabric test unit (369 passed) and ./formfabric test engine (690 passed, 1 skipped, 5 expected failures).
From a clean clone of this branch: npm ci in frontend with the stock npm of Node 22, then npx vitest run: npm ci ok
Tests 369 passed (369).
Sampled expected values were flipped in every lane to see the tests fail, then restored.

Not run: ./formfabric agents sync and agents check (they need the built engine), the native engine, the desktop shell, macOS and Windows. The workflow itself has not run on GitHub; the .bat runner has not run on Windows.

Merging

Merge with a merge commit so each commit and its signature stays. Do not squash.

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.
…by layer (0.31.0)

A new setup/test and its setup/test.bat twin run the test layers: unit is vitest in frontend, engine is pytest on backend/tests with the backend venv. No layer or all runs both, an unknown layer exits 2 with a sentence, and anything after the layer goes to the runner. The script says what to install when node_modules, the venv, or pytest and httpx are missing. The launcher and formfabric.bat each gain the one test line. Run: ./formfabric test bogus (exit 2), ./formfabric test unit (vitest starts and finds no test files yet), ./formfabric test engine (53 passed), ./formfabric test (both layers).
…for each layer (0.31.0)

A new job named test on Linux makes the backend venv from backend/requirements.txt, adds pytest and httpx, runs npm ci in frontend, then runs ./formfabric test unit and ./formfabric test engine as two steps, so the step that fails names the layer. The Backend tests step is removed from the backend job, because the new job runs the same pytest folder. The test job does not build the Rust engine module; the tests in backend/tests run without it. Run: the workflow file parses as YAML and lists the jobs checks, frontend, engine, backend, test, scripts, desktop-shell.
…epted (0.31.0)

A new docs/TESTING.md says how to run ./formfabric test, lists the unit and engine layers, says where a lane's tests live, states the five rules, the not-accepted list and the DEFECT: rule, describes the CI job, and says the native Rust workspace is not covered yet. CLAUDE.md (three places) and AGENTS.md no longer say that no tests are kept in the repo: 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 setup/HASHOUT_LOG.md records the runner. Run: a search of the changed files for the em dash found none.
…s, engine refusal and the mcp http and stdio surfaces (0.31.0)

Runs the real app in process through /api/commands, /api/plugins, /api/engine, /api/events, /api/chat/image and /api/mcp plus the stdio MCP program, checking refusals with their messages, a typed-text terminal round trip, plugin results and argument bounds, and the engine-not-built refusal; expected values come from the JSON-RPC 2.0 error codes and reply rules, the MCP tool-listing shape, arithmetic, command descriptions, byte-for-byte round trips and two paths that must agree (catalogue vs describe, stdio vs HTTP initialize). Ran: cd backend && venv/bin/python -m pytest tests/commands -q -p no:cacheprovider, 88 passed, 4 expected failures.
…w guard on every write route, saved preferences, health and system answers, engine-not-built refusal, quiet and engine logs (0.31.0)

Runs the real app in process: sweeps every non-GET route the app registers against foreign origins, foreign hosts, cross-site requests and loopback hosts the window does not use (with and without the window key), checks websocket closes, preflight, preferences saved and read back through the module and the agents.prefs route, environment settings, health, version, capabilities, the 503 refusal of the missing native engine, the image and recent-file routes, isolation headers, access-log filtering and engine log files. Expected values come from the README (ports 8280 and 5280, data folder), the app's own stated refusal messages, web standards (COOP and COEP values, Origin and Sec-Fetch-Site rules) and save-then-read invariants. Ran: cd backend && venv/bin/python -m pytest tests/test_*.py tests/core -q -p no:cacheprovider, 249 passed (196 in this lane), 0 expected failures.
…t format and option parsing, uv and job state, sewing lines, fabric colours, joint angles, trim records (0.31.0)

Exported workspace functions are checked against arithmetic (25.4 mm per inch, circle arc length, quaternion composition written in the test, inclusive frame counts), JSON Schema keyword meanings for export options, and round trips (place then unplace, hex to colour to hex, remember then recall). Ran: cd frontend && npx vitest run tests/unit/garment, 79 passed, 0 expected failures.
…, crash recovery journal and autosave path (0.31.0)

Garments are added, listed, duplicated, removed, restored and purged through the HTTP routes of the real app and read back from disk, with path escapes refused; the crash journal is written, offered again after a simulated crash, replayed and discarded, and the recent list keeps its order and limit. Expected values come from the bundled sample files read with a plain zip and JSON reader, README statements (four sample templates, files outside the Garments folder are never moved or deleted, FORMFABRIC_DATA_DIR moves the folders), UTC arithmetic on file times and save-then-read-back invariants. Ran: cd backend && venv/bin/python -m pytest tests/library -q -p no:cacheprovider, 109 passed, 0 expected failures.
…traints, edge normals, grid steps, style line hits, seam check list and port picker (0.31.0)

Exported 2D pattern functions and the DOM built by the seam check list and the component port picker are driven with squares and a quarter disc whose lengths, distances, angles and normals are known in closed form (perimeter 400, pi times 50, 3-4-5 triangles, 45 degree snaps, golden angle), plus round trips between parameter ranges, runs and seam ends. Ran: cd frontend && npx vitest run tests/unit/pattern, 74 passed, 0 expected failures.
…, hand api, backends, gof hand-off and the version tool (0.31.0)

Checks the python package through its public functions and command line against its README and pyproject (argument refusals with messages, keyword-only generated functions, Garment/Panel/Sim/Link call sequences, http token and url rules, gof manifest units from mm to m and cm, `python -m formfabric` exit codes) and runs setup/version.py against synthetic temp copies with planted version disagreements; only the transport (a stand-in ffb_engine module and a stand-in url opener) is replaced, expected values come from the catalogue schema, README, gof-handoff document and metric unit arithmetic. Ran: backend/venv/bin/python -m pytest tests/sdk -q -p no:cacheprovider, 244 passed, 1 expected failures.
…ortcuts dialog, command search, engine client, window key, agent markdown and dock state (0.31.0)

Checks the language tables and lookup fallback, theme and preference storage, toast DOM, in-place list patching, the command registry and key combos, the mounted shortcuts dialog and command search palette, the engine client requests and refusals with only fetch stubbed, the window key header and claim flow, streamed agent markdown rendered to DOM, and terminal dock state and wording; expected values come from invariants (save then load, stream equals whole render, round trips), markdown and HTTP conventions, and the strings the user sees. Ran: cd frontend && npx vitest run tests/unit/shell, 119 passed, 0 expected failures.
…rips, colour ramps, scalar frames, png resolution tag, animation state parsing (0.31.0)

Exercises the exported vector and matrix functions, OrbitCamera, Frame, Picker, ramp and legend builders, the scalar frame decoder, the PNG resolution tagger and the animation state parsers; expected values come from linear algebra and closed forms, the documented scalar frame layout, the PNG chunk and CRC rules checked by an independent reader in the test file, and round trips or two independent paths that must agree. Ran: cd frontend && npx vitest run tests/unit/view3d, 97 passed, 0 expected failures.
The version moves to 0.31.0 at every site setup/version.py reads, in both lock files, in SECURITY.md, and by hand in the generated skill reference and python/formfabric/catalogue.json, which ./formfabric agents sync would write the same way once the engine is built. CHANGELOG.md describes 0.31.0. Ran: python3 setup/version.py check (in step), python3 setup/i18n.py check, ./formfabric test unit (369 passed) and ./formfabric test engine (690 passed, 1 skipped, 5 expected failures). Not run: ./formfabric agents sync and agents check (they need the built engine), the native engine, the desktop shell, macOS and Windows.
@nodemode-ai
nodemode-ai requested a review from gbarnai as a code owner November 24, 2026 21:54
@nodemode-ai
nodemode-ai merged commit 535cb41 into main Nov 24, 2026
7 checks passed
@nodemode-ai
nodemode-ai deleted the test/suite-0.31.0 branch November 29, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant