Repository navigation
FormDesign 0.90.0: the desktop engine starts and stops cleanly (engine side only) - #10
Merged
Merged
Conversation
…a folder, leaves when its app has gone, and serves nothing when started alone The family's pattern for starting and stopping cleanly on Windows, as FormTools 0.10.0 has it, in the entry the desktop app freezes. backend/app/core/startup.py is FormTools's file (git show of its origin/main), changed only in the names at its top. backend/app/core/ runtime.py is new and FormDesign's own: the log file and the lock. formdesign_engine.py now, in this order: starts Logs/formdesign-engine.log under the data folder (a folder that cannot be made is one sentence and exit code 5); keeps an absent standard error in a file beside it; when it is frozen and no app started it, opens the app beside it and stops, or says it serves nothing on its own (exit code 4); takes engine.lock, and refuses with a sentence and exit code 2 while another engine and that engine's app are alive, or ends an engine whose app has gone; watches the process named in FORMDESIGN_SHELL_PID and leaves when it ends; then serves as before. An error that ends the engine is written to the log. An engine ended with SIGTERM gives its lock up and exits 0. An engine started with uvicorn app.main:app is untouched. Released engines wrote no lock, so one left behind by 0.89.0 or older is not known to a new engine and is not ended by it. Seen on Linux with stand-ins for the shell and the app: the refusal of a second engine, the engine leaving about a second after its shell ended, a leftover replaced (SIGTERM, and SIGKILL after five seconds for one that was stopped), four damaged locks replaced, an unrelated process left alone, the started-alone branch in four places and with no app near, three closed streams, the data folder that cannot be made, and an unchanged output for a normal start. tests/test_startup.py (14 tests, written after that) with the window key and boot tests: 53 passed. Not run: Windows, macOS, a frozen engine, the desktop shell.
…tart shows its message before the last window closes The engine is started with FORMDESIGN_SHELL_PID set to the shell's own process id, which the engine records in its lock and watches. Both failure paths now show their dialog first and only then close the loading window, stop the engine and end the app; a main window that fails to build takes the same path with its own sentence. The exit code of an engine that stopped before it gave its address is kept: code 2 says another copy of its engine holds its data folder, any other code is named, and the message says where the engine's log is. src/main.rs only. Not compiled here (the system WebKit libraries are missing) and not run on any system: read against tauri-plugin-shell 2.4 (Command::env, TerminatedPayload.code) and tauri-plugin-dialog 2 (message, blocking_show). Held: the job object, engine_start.rs, a limit on the wait for the address, single-instance handling.
Ships the engine side of the family's Windows start and stop pattern: the desktop engine keeps a log, holds a lock on its data folder, leaves when its app has gone, ends an engine that was left running, and serves nothing when started alone; the shell tells the engine its process id and shows a failed start's message before the last window closes. Version sites moved, the same fourteen files as 0.89.0: CHANGELOG, README badge, frontend package.json and both fields of its lock, frontend/src/version.ts, backend/app/__init__.py, native/Cargo.toml and the seven crates in its lock, src-tauri Cargo.toml, tauri.conf.json and the two crates in its lock, and the "Current build version" and "Last updated" lines of the backend, frontend and native HASHOUT logs. Lock files were edited by hand, this project's own version fields only. Checked on a scratch copy of the commit before this one, with the layout core built and the fonts installed: backend pytest, whole suite, 312 passed; compileall, --selfcheck, the template lint (71 templates, 0 with problems), agents sync --check, the uvicorn boot and probe, ./formdesign make for a newsletter and a flyer, bash -n over the scripts, mcpb check, the em dash and emoji check, npm audit (0 vulnerabilities). The browser window check, 3 passed, ran on the engine commit. After the bump the version sites were read: all fourteen say 0.90.0 and none says 0.89.0 outside history. Not run: the version tests, agents sync --check and cargo metadata --locked after the bump (the shared build lane was blocked); cargo test for the layout core; a desktop build; the PyInstaller freeze; Windows and macOS; any real agent program. Left as they are: the recorded demo pages' version; the wiki Home page's "Version 0.19.0"; log entries of 0.89.0 that read "after v0.88.0, no version yet".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FormDesign 0.90.0: the desktop engine starts and stops cleanly (engine side only)
Three commits on top of 0.89.0. The engine side of the family's Windows start and stop pattern, as FormTools 0.10.0 has it, and the one part of the shell side the engine cannot do without. The rest of the shell side is held and listed below.
What changes for people
Logs/formdesign-engine.login the FormDesign data folder. An error that stops the engine is written there. When the engine has no standard error, tracebacks go toLogs/formdesign-engine-errors.log.engine.lockin the data folder; exit code 2 when another engine holds it, 4 when it was started alone and found no app, 5 when it cannot use its data folder, 0 when ended with SIGTERM. An engine started from source with uvicorn is unchanged and takes no lock.Commits
How it was checked
All on Linux, with stand-ins (a
sleepas the shell, a script as the app).backend/tests/test_startup.py, 14 new tests, written after each behaviour was seen.python -m compileall -q app formdesign_engine.pypython formdesign_engine.py --selfcheckpython ../setup/agents.py sync --check./formdesign makea newsletter (PDF and .fdes) and a flyer (PNG), with a layout core built from this treepython -m pytest tests -q, whole suite, layout core and fonts presentpython -m pytest frontend/tests/window -q -p no:cacheproviderafternpm ciandnpm run build, Playwright 1.63.0src-tauriand version strings changed after it)npm ci,npm run build,npm audit --audit-level=lowbash -nover the launcher and setup scripts./formdesign mcpb checkagents sync --checkin step;cargo metadata --lockedpassed fornative/and forsrc-tauri/; no version site left at 0.89.0 outside history. (The release commit's own message says these were not run: they were queued when it was written and finished a minute later.)Not run
src-tauri/src/main.rswas read against tauri-plugin-shell 2.4 and tauri-plugin-dialog 2; the first compile is the release build.sys.frozenset.cargo test --release --locked -p formdesign-engine(the layout core's own tests; nothing undernative/changed but its version).Held
win_job.rs, withwindows-sysinCargo.tomlandCargo.lock). Until it is in, the engine's own watch on the shell covers it.engine_start.rs: the engine's last lines and the log's full path in the failure message, and a limit on the wait for the engine's address, which is still unlimited.Merge
Merge with a merge commit. Do not squash and do not rebase-merge.