# dsflow-tui ## Goal Give designers one interactive screen (keyboard and mouse) for the `dsflow` check-in flow: see local changes, locks and checked-out copies; run sanity on chosen files with those files locked for the duration; then check in, tag, or just unlock. This replaces typing `dsflow precheckin` / `checkin` / `claim` / `release` by hand and makes "I forgot to release the lock" impossible. ## Assumptions - `ds_lock` = `dssc lock` takes the vault lock without touching the local copy. **Unverified**: TODO §1. - `dssc ls -rec -report N .` lists managed files, one relative path each. **Unverified**. - DesignSync fetches read-only copies unless a file is checked out, so "writable and unlocked" means "checked out without a lock". **Unverified**. - `dssc tag -replace` moves an existing tag. **Unverified**. - `dssc ci` releases the lock. The runner does not rely on it: it checks the holder and unlocks what the run took either way. - Sanity runs on the whole workspace, so unmarked local changes are tested too. The run dialog warns; it does not stop the run. - The runner and TUI may be on different hosts sharing the workspace over NFS, so liveness is a heartbeat in the job file, not a pid check. - The servers have Python >= 3.8.1 (answer from the lead, 2026-09-24) and no access to outside package repositories, so Textual and its dependencies are vendored. **Unverified on the servers**: TODO §1. - Designers use a UTF-8 terminal that Textual can drive (xterm, VNC, SSH from a modern terminal). **Unverified**: TODO §1. ## Handshakes Consumes from `dsflow.conf`: `TRUNK_SEL`, `WORKING_TAG`, `SANITY_CONFIGS`, `MAX_STAMP_AGE`, `HOT_FILES`, `CHECKIN_LOG`, `run_sanity`, and the `ds_list_modified` / `ds_base_version` / `ds_latest_version` / `ds_lock_holder` / `ds_unlock` helpers. Optional: `DSFLOW_TAGS`, `SANITY_SCRIPT`, and overrides of every `BASH_DEFAULTS` helper. Promises to bash `dsflow`: `.dsflow/new_files` stays a sorted path list; `.dsflow/sanity.stamp` is written only by a run that covered exactly `all_changes` on exactly `SANITY_CONFIGS`, with `dsflow`'s `content_hash`; `CHECKIN_LOG` lines are `timeuserhashfiles`. Promises to `dsflow_ci`: never moves `WORKING_TAG`. The runner is re-executed through `dsflow_tui.py` (`common.ENTRY`), so the launcher must stay at the repository root next to `dsflow/`. Job file (`.dsflow/tui_job.json`): written by the runner, read by the TUI and `status`. A terminal `status` (`passed`, `failed`, `cancelled`, `error`) means lock release has finished. `heartbeat` is refreshed every 5 s; 60 s without one means the runner is gone. ## Status / TODO - [x] Changes, Locks (with hot-file board), Checked-out, Sanity run, Logs tabs - [x] detached runner: validate, lock, refresh, sanity per config, verify, check in, tag, unlock - [x] cancel, lost-runner cleanup, later check-in with `c`, batch tag, add new, rebase - [x] `status` / `status --json`, `--sanity-cmd`, `SANITY_SCRIPT` - [x] `--demo` sandbox with a fake `dssc`; `tests/test_runner.py` - [x] Textual UI with mouse support, detail pane, filter, themes, command palette - [x] self-contained checkout: `vendor/` + `tools/vendor.py`; runs isolated (`python -I -S`) - [x] headless UI tests (`tests/test_ui.py`), green on Python 3.12 and 3.8 - [ ] real-DesignSync verification: TODO §1 ## Work log - 2026-09-23: first version built on the `dsflow` plan in `files.zip`. Choices: curses over Textual (no pip on EDA hosts); the runner is a separate detached process so a closed terminal can't strand locks; cancel is a file (`tui_job.cancel`) rather than a signal so it works across hosts. Tested in the demo through a pty with pass, fail, cancel, unlock-only then `c`, kill -9 of the runner, stale guard, ASCII locale. - 2026-09-23: writing the test suite found two bugs, both fixed. The fake `dssc` computed wrong paths when the demo lived under a symlinked directory (macOS `/var`), which broke the default `--demo` on a Mac. The runner saved the terminal status before releasing locks (CLAUDE.md invariant 7). - 2026-09-24: rebuilt the UI on Textual at the lead's request ("interactive and pretty", servers without outside repo access, Python 3.8-3.9). Textual 6.2.1 is the newest line that supports 3.8.1; it and 9 pure-Python dependencies are unpacked into `vendor/` (11 MB) and put first on `sys.path` by the launcher, so a checkout runs isolated with no pip. The single file became the `dsflow/` package: backend modules are pure moves of the old sections; action rules moved out of the UI into `ops.py` so they stay testable. The curses UI is gone. Bugs found on the way, all fixed: an `auto_refresh` attribute clobbered Textual's repaint interval (division by zero); start-up focus landed on the hidden filter so every key went into it; TabbedContent followed the restored focus back to Changes after the run dialog closed; a `rows` attribute shadowed DataTable's; rich's pulse bar divides by zero without a colour system; late events hit the DOM during teardown. Verified: 11 tests green on Python 3.12 and 3.8.20, the shipped file set runs under `python -I -S` through a symlink on both, and the real TUI starts and quits cleanly in a pty on both. ## QA log ## Review