forked from geomind_code/zinit_archive2
clean up zinit #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
see
https://forge.ourworld.tf/lhumina_code/hero_proc/src/branch/development_kristof_ttyd
branch development_kristof_ttyd
check that branch and do proper testing if it works use browser mcp to do so
report back all we can find
Branch Review:
development_kristof_ttydFeatures Added
This branch introduces interactive PTY (pseudo-terminal) support across the entire zinit stack:
Execinterpreter variant — runs binaries directly without-cwrapping, needed for PTY shellstty: boolfield onActionSpec— when true, spawns job inside a pseudo-terminalexecutor.rs) — usesportable-ptyto create PTY pair, broadcasts output viatokio::broadcastweb.rs) —GET /api/services/{name}/ptyfor terminal I/Oroutes.rs) — proxies browser WebSocket to server WebSocket via Unix socketzinit attach <name>— connects to PTY via Unix socket WebSocket, raw terminal mode, Ctrl+] to detachBugs Found
Critical: Resize messages broken in CLI attach and UI proxy
The server (
web.rs:279) handles resize only forMessage::Textframes. However:cmd_attachsends resize asMessage::Binary— JSON bytes get written to PTY input instead of triggering resizeroutes.rs:500-509) converts ALL browser frames (including Text) to Binary before forwarding — browser resize messages also get misroutedFix needed: Either CLI/proxy should send resize as Text, or the server Binary handler should try to parse incoming data as JSON resize before writing to PTY.
Concerns
tty=trueonesportable-ptyon macOS — known quirks; needs testing on target platformstd::sync::Mutexin async context —web.rs:284locks PTY master inside async task (brief, but could block tokio thread)Testing Plan
cargo check --workspace— compilationcargo test --test pty— PTY-specific testcargo test --workspace— full suitezinit attachmanual testFiles Changed (46 files, +2633/-2173 lines)
Key files:
executor.rs,web.rs,routes.rs,commands.rs,index.html,model.rsImplementation Summary
Changes Made
Bug Fixes
commands.rs): Changed resize messages fromMessage::BinarytoMessage::Textso the server correctly handles terminal resize instead of writing JSON bytes to PTY inputroutes.rs): Preserved Text frame type when proxying browser→server instead of converting all frames to Binary, ensuring resize commands reach the server's Text handlercmd_reloadwhich referenced non-existentservice_reloadRPC methodTOML Removal (database-only)
All TOML file-based service configuration has been removed. Services are now managed exclusively through the database via RPC:
cmd_config_import,cmd_config_diff,cmd_reloadcommands--fileflag fromzinit add service--persistflag from service/job add commandsConfigCommand::ImportandConfigCommand::DiffCLI variantscmd_reset(now deletes services via RPC)cmd_lint(now validates services via database)tomlcrate dependency from workspace, zinit_cli, zinit_lib, and integration testsuser_config_dir(),system_config_dir(),SYSTEM_CONFIG_DIR,USER_CONFIG_DIR_SUFFIXfrom SDKTargetConfig::from_file()andTargetConfig::parse()TOML methods-cconfig dir argument from zinit_pid1 server spawncmd_action_setto accept JSON only (removed TOML fallback)Test Results
Files Modified (code)
Cargo.toml— removed toml workspace depcrates/zinit/Cargo.toml— removed toml depcrates/zinit_lib/Cargo.toml— removed toml deptests/integration/Cargo.toml— removed toml depcrates/zinit/src/cli/args.rs— removed Reload, Import, Diff, --file, --persistcrates/zinit/src/cli/commands.rs— removed TOML code, fixed resize bugcrates/zinit/src/main.rs— updated dispatchcrates/zinit_lib/src/db/service/model.rs— replaced TOML parsing with JSONcrates/zinit_sdk/src/socket.rs— removed config dir functionscrates/zinit_pid1/src/main.rs— removed config dir passingcrates/zinit_ui/src/routes.rs— fixed proxy frame type preservationtests/integration/tests/cli_tester.rs— removed TOML file writingFiles Deleted
examples/cli/docker/services/etc/zinit/system/tests/playground/services/