diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-27 14:12:28 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-27 14:12:28 +0200 |
| commit | 50c433e82c368b9861a89deecb74e5f29fa50353 (patch) | |
| tree | fe6d87b79387f6c53ef9bf615b7b530daf9a8d3a /tests/e2e.sh | |
| parent | 9f3a567d4bb1b7b6e42a744936f993bcd437882d (diff) | |
mark as unread: make an idle agent done again, to come back to it
like "mark as unread" in mail: an agent you have seen (idle) becomes done
again, last among done agents of its importance, with no sound or
notification. it stays done until you come back to it: leave its tmux
window and return, or jump to it. marked while you look at it, it holds
until you look away (`held`); a new turn clears it. only idle agents can
be marked.
- daemon: `pane.mark_unread` on the hook socket; the watcher applies it
after the tick's observations (mark_unread, advance's hold rule).
- `dingger unread [--pane]`: refuses done, working, blocked, and panes
without an agent; returns once the agent shows as done.
- pi: /unread (refused while the agent works or is blocked).
- panel: right-click an idle agent in the full list, "Mark as unread".
- search: ⌘U or right-click marks the selected idle agent; the footer
offers ⌘U when it applies; search stays open.
tests: unit (hold, jump, new turn, idle only), e2e step 22 (queue
position, hold, look away and back, jump, refusals, no sound, menu, the
extension), pi-live in real pi 1.4 (a mark, not a turn: an unknown
command would also end done), swift selftest (menu only for idle, footer).
Diffstat (limited to 'tests/e2e.sh')
| -rwxr-xr-x | tests/e2e.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh index e51b18d..0da517a 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -930,6 +930,65 @@ if command -v node >/dev/null; then expect "and leaves the footer" "grep -c '^status dingger-importance $' $EXTLOG" 1 fi +# --- 22. mark as unread ---------------------------------------------------- +# An idle agent marked unread is done again, last among done agents of its +# importance, until the user comes back to it. +echo "22. mark as unread" +t new-session -d -s unr -n u1 -c "$DIR" -x 120 -y 40 "$DIR/bin/pi" +t new-window -d -t unr: -n u2 -c "$DIR" "$DIR/bin/pi" +t new-window -d -t unr: -n u3 -c "$DIR" "$DIR/bin/pi" +t new-window -d -t unr: -n away -c "$DIR" "sleep 100000" +U1=$(t display -p -t unr:u1 '#{pane_id}'); U2=$(t display -p -t unr:u2 '#{pane_id}') +U3=$(t display -p -t unr:u3 '#{pane_id}'); AWAY=$(t display -p -t unr:away '#{pane_id}') +uqueue() { gopt @dingger_queue | tr ',' '\n' | grep -xE "$U1|$U2|$U3" | tr '\n' ' '; } +look() { t switch-client -c "$CLIENT" -t "$1"; $DINGGER poke; } +look "$AWAY" +report "$U3" "" low +for p in "$U3" "$U1"; do report "$p" working ""; report "$p" idle ""; expect "unr: $p done" "opt $p @agent_state" done; sleep 0.05; done +look "$U1" +expect "unr: looking at u1 sees it" "opt $U1 @agent_state" idle +look "$AWAY" +# u2 finishes after u1 was seen: by its old time, u1 would come first. +report "$U2" working ""; report "$U2" idle ""; expect "unr: $U2 done" "opt $U2 @agent_state" done +expect "unr: the queue without it" "uqueue" "$U2 $U3 " +look "$U1" +sleep 3.5; : >"$SOUNDS"; : >"$NOTES" +expect "dingger unread marks it" "$DINGGER unread --pane $U1" "marked unread" +expect "done again" "opt $U1 @agent_state" done +expect "last among done agents of its importance, before a low one" "uqueue" "$U2 $U1 $U3 " +expect "menu: shown as done" "mb --print | grep -F 'unr · u1' | cut -d' ' -f1" "✓" +$DINGGER poke; sleep 1; $DINGGER poke +expect "still looking at it: still done" "opt $U1 @agent_state" done +sleep 1 +expect "marking makes no sound" "cat $SOUNDS" "" +expect "and no notification" "cat $NOTES" "" +look "$AWAY" +expect "looking away: still done" "opt $U1 @agent_state" done 10 +look "$U1" +expect "coming back sees it" "opt $U1 @agent_state" idle +expect "unr: marked again" "$DINGGER unread --pane $U1" "marked unread" +$DINGGER focus --client "$CLIENT" --pane "$U1" +expect "a jump to it sees it" "opt $U1 @agent_state" idle +look "$AWAY" +expect "marked while away" "$DINGGER unread --pane $U1" "marked unread" +look "$U1" +expect "seen on arrival" "opt $U1 @agent_state" idle +expect "a done agent is refused" "$DINGGER unread --pane $U2 2>&1" "dingger: it is unread already (done)" +report "$U3" working ""; expect "unr: u3 working" "opt $U3 @agent_state" working +expect "a working agent is refused" "$DINGGER unread --pane $U3 2>&1" \ + "dingger: only an idle agent can be marked unread; this one is working" +expect "a pane without an agent is refused" "$DINGGER unread --pane $AWAY 2>&1" "dingger: no agent in pane $AWAY" +if command -v node >/dev/null; then + : >"$EXTLOG"; iext "$U1" session_start "/unread" + expect "/unread marks it" "opt $U1 @agent_state" done + expect "and says so" "grep -c '^notify marked unread: dingger shows it as done until you come back to it$' $EXTLOG" 1 + look "$AWAY"; look "$U1" + expect "unr: seen again" "opt $U1 @agent_state" idle + : >"$EXTLOG"; iext "$U1" session_start agent_start "/unread" + expect "/unread while working is refused" "grep -c '^notify only an idle agent can be marked unread$' $EXTLOG" 1 + expect "and changes nothing" "opt $U1 @agent_state" working +fi + # Every daemon this run started must stop with it. kill "$DAEMON_PID" "$DAEMON2_PID" 2>/dev/null expect "the test daemons stop" "ps -o pid= -p $DAEMON_PID,$DAEMON2_PID | wc -l | tr -d ' '" 0 |
