lucioandClaude Opus 5.5 275d42aeb4 Add docs, tests and agent rules; fix demo paths and a lock-release race
- README.md: usage, keys, how a sanity run works, config, demo command
- CLAUDE.md: rules for agents, ported from verilogrustformatter with a
  single serial dev loop (lead plans, dev, QA, lead reviews)
- tests/test_runner.py: stdlib unittest suite running the runner end to
  end against the demo sandbox (pass, fail, cancel, stale, stamp hash)
- tools/guard.py: time limit plus leaked-process check for test runs
- TODO.md and docs/features/dsflow-tui/README.md: backlog and feature doc

Fixes found by the tests:
- the fake dssc resolved paths wrong under symlinked dirs, breaking the
  default --demo location on macOS (/var -> /private/var)
- the runner saved its terminal status before releasing locks, so the
  TUI could report a run finished while locks were still held

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-23 11:09:35 -07:00

dsflow_tui

A terminal UI for the dsflow DesignSync check-in flow. It lets a designer see their changes and locks, fire a sanity regression that locks the files while it runs, and check in or tag the result without typing dssc.

One file, Python 3.6+ standard library only (curses), plus bash. Copy dsflow_tui.py next to dsflow and it runs; there is nothing to install.

 ◆ dsflow │ ws ~/ws/wifi_mac │ lucio │ Trunk:Latest │ green tag: working     updated 12:03:11 (1.5s)
  1 Changes 5   2 Locks 1   3 Checked-out 4   4 Sanity run ⠹   5 Logs
────────────────────────────────────────────────────────────────────────────────────────────────
    St  File                                   Base → Latest     Lock         Flags
 ◉  M   rtl/rx/rx_fsm.sv                       1.4  latest       you          IN-RUN
 ◉  M   rtl/top/wifi_mac_top.sv                1.12  latest      you          HOT IN-RUN
 ○  M   rtl/tx/tx_ctrl.sv                      1.7 → 1.8         —            STALE
 ○  A   rtl/rx/rx_agg.sv                       new file          —
────────────────────────────────────────────────────────────────────────────────────────────────
 ⠹ SANITY   Sanity kibo_2x2 ████████░░░░░░░░ 0/2 cfg  │ 3m10s  │ 1 locked by run    2 selected
  spc  mark   a  all   s  sanity   c  check in   t  tag   n  add new   m  rebase   r  refresh

Try it (demo)

The demo builds a sandbox workspace driven by a fake dssc, so you can try every action without a DesignSync vault:

./dsflow_tui.py --demo --demo-reset

It has modified, stale, new, hot and locked-by-someone-else files. Useful knobs, all environment variables:

DEMO_FAIL=jaguar_1x1 ./dsflow_tui.py --demo        # make one config fail
DEMO_STEP_SECS=0.2 ./dsflow_tui.py --demo          # faster fake sanity

--demo-reset rebuilds the sandbox from scratch; without it the sandbox keeps its state between runs. --demo-dir DIR puts it somewhere else.

Usage

Run from the workspace root, the same place you run dsflow:

dsflow_tui.py                     # interactive TUI
dsflow_tui.py status              # progress of the current sanity run, then exit
dsflow_tui.py status --json       # the same, for scripts
dsflow_tui.py --sanity-cmd 'sim/regress.sh --cfg {cfg}'
Option Meaning
--ws DIR workspace root (default: current directory)
--conf FILE dsflow.conf (default: $DSFLOW_CONF, else <ws>/flow/dsflow.conf)
--sanity-cmd CMD external sanity command; {cfg} and {ws} are substituted
--tags T1,T2 tags offered for batch tagging (default: DSFLOW_TAGS)
--auto-refresh SEC re-query DesignSync every SEC seconds (default: only on r and after actions)

Tabs

  1. Changes: locally modified and newly added files, with base/latest version, lock holder and flags (HOT, STALE, IN-RUN, MISSING).
  2. Locks: your locks, plus every hot file and who holds it.
  3. Checked-out: writable copies you have not locked.
  4. Sanity run: each step of the current or last run, progress bars and a live log tail.
  5. Logs: full sanity logs per config, the runner log, and this session's activity.

Keys

Key Action
space / a / esc mark a file / mark all in the tab / clear marks. With nothing marked, the cursor row is used.
s run sanity on the marked changes
c check in marked files that a passing run already covers
t batch-tag the marked files with a tag from DSFLOW_TAGS
l / u lock / release a lock
n register brand-new files for check-in (same as dsflow add)
m rebase stale files onto Trunk:Latest (same as dsflow rebase)
x cancel the running sanity, or clean up after a lost runner
1-5, tab switch tabs
r / ? / q refresh / help / quit

How a sanity run works

s asks for the configs, what to do on pass (check in, or unlock only), a comment and an optional tag, then starts a detached runner:

  1. check the files are not stale on Trunk and not locked by someone else
  2. lock them (files you already held are left as they are)
  3. refresh unmodified files to Trunk:Latest (optional)
  4. run sanity on every config, one after another, stopping at the first failure
  5. on pass: confirm the files did not change during the run, check in, tag; or just stop there in unlock-only mode
  6. release every lock the run took, whatever happened

The runner does not depend on the TUI. Quit, lose the SSH session, reopen later: the run carries on and status shows where it is. If the runner itself dies, the TUI notices after 60 s without a heartbeat and x stops the leftover simulation and releases the locks.

A later c checks in only if a passing run on all configs covers exactly the current file contents and is younger than MAX_STAMP_AGE.

Sanity runs on the whole workspace. If you mark only some of your changed files, the unmarked ones are tested too but not checked in; the run dialog warns about this.

Configuration

Everything comes from dsflow.conf, the file the bash dsflow already uses. Optional additions:

DSFLOW_TAGS="wmac_working wmac_rx_drop"      # tags offered by batch tag
SANITY_SCRIPT='$WS_ROOT/sim/run_sanity.sh {cfg}'   # instead of run_sanity()

All DesignSync access goes through ds_* helpers. The TUI adds defaults for the ones dsflow.conf does not define; verify these against your dssc version before rollout and override any of them in dsflow.conf:

Helper Default Check
ds_lock dssc lock must take the vault lock without touching the local copy
ds_list_managed dssc ls -rec -report N . one workspace-relative path per line
ds_list_writable managed files that are writable, plus their holder assumes files are fetched read-only unless checked out
ds_tag dssc tag -replace moves an existing tag
ds_checkin, ds_checkin_new dssc ci, dssc ci -new whether ci releases the lock
ds_refresh, ds_rebase dssc pop as in dsflow

Files it writes

In <ws>/.dsflow/, next to the bash dsflow state it shares (new_files, sanity.stamp):

File Contents
tui_job.json state of the current or last run
tui_runner.log what the runner did, step by step
sanity_<cfg>.log sanity output per config
tui_history.json last passing duration per config, for progress estimates

A run that covered all your changes on all configs also writes a sanity.stamp that dsflow checkin accepts.

Development

python3 -m unittest discover -s tests -v

The tests run the runner end to end against the demo sandbox. See CLAUDE.md for the rules and the dev loop. files.zip holds the original dsflow plan scripts this tool builds on.

S
Description
No description provided
Readme
2.4 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%