/ testing / thread_test.sh
thread_test.sh
  1  #!/usr/bin/env bash
  2  set -eu
  3  
  4  RID="rad:zyAM8wXNAXZh3423qneGMsCu5wAy"
  5  HOST_IP="${HOST_IP:-172.17.0.1}"
  6  HOST_NODE_ID="z6Mko6jDPmLevohDAU7tzHPsZV7kmeWBjK5tiv57cxrKPHZC"
  7  
  8  log() { echo "==> $*"; }
  9  
 10  # Extract issue ID (40-char OID from "│ Issue   <oid>" line)
 11  issue_id() { grep 'Issue' | grep -oE '[0-9a-f]{40}' | head -1; }
 12  
 13  # Extract comment ID (7-char OID from "│ author (you) <time> <id>" line)
 14  comment_id() { grep '(you)' | grep -oE '[0-9a-f]{7}' | tail -1; }
 15  
 16  # ── 1. Identity ────────────────────────────────────────────────────────────────
 17  
 18  log "Starting SSH agent..."
 19  eval $(ssh-agent -s)
 20  
 21  log "Creating tester identity..."
 22  echo "" | rad auth --alias tester --stdin
 23  
 24  git config --global user.name "tester"
 25  git config --global user.email "tester@radicle.xyz"
 26  git config --global init.defaultBranch master
 27  
 28  # ── 2. Node ────────────────────────────────────────────────────────────────────
 29  
 30  log "Starting radicle node..."
 31  rad node start
 32  
 33  for i in $(seq 1 15); do
 34      rad node status 2>/dev/null | grep -q "running" && break
 35      sleep 1
 36  done
 37  
 38  log "Connecting to host node..."
 39  rad node connect "$HOST_NODE_ID@$HOST_IP:8776" 2>/dev/null || true
 40  sleep 3
 41  
 42  # ── 3. Clone repo ──────────────────────────────────────────────────────────────
 43  
 44  log "Seeding and cloning repo..."
 45  rad seed "$RID"
 46  sleep 5
 47  rad clone "$RID" /workspace/repo
 48  cd /workspace/repo
 49  
 50  # ── 4. Create issue with threaded comments ─────────────────────────────────────
 51  
 52  log "Creating issue..."
 53  ISSUE=$(rad issue open \
 54      --title "Review: inbox expand UX feedback" \
 55      --description "$(printf 'Tried the new expandable notification rows — overall very nice. A few observations:\n\n- The popover description is a great touch\n- Reply buttons now visible on all comments\n- Nested threading looks clean\n\nOne thing: the reply form should auto-scroll into view when opened below a long comment thread.')" \
 56      2>&1 | issue_id)
 57  echo "   issue: $ISSUE"
 58  
 59  sleep 1
 60  
 61  log "Adding top-level comments..."
 62  
 63  C_A=$(rad issue comment "$ISSUE" \
 64      -m "The expand chevron was too small to target. Good that the whole row acts as toggle now." \
 65      2>&1 | comment_id)
 66  echo "   A: $C_A"
 67  sleep 1
 68  
 69  C_B=$(rad issue comment "$ISSUE" \
 70      -m "Popover positioning with position:fixed + getBoundingClientRect is correct. The previous absolute positioning was clipped by overflow:auto on the list wrapper." \
 71      2>&1 | comment_id)
 72  echo "   B: $C_B"
 73  sleep 1
 74  
 75  C_C=$(rad issue comment "$ISSUE" \
 76      -m "The 120ms hide delay feels right — long enough to move mouse to the popover, short enough not to feel sluggish." \
 77      2>&1 | comment_id)
 78  echo "   C: $C_C"
 79  sleep 1
 80  
 81  log "Adding replies..."
 82  
 83  C_A1=$(rad issue comment "$ISSUE" --reply-to "$C_A" \
 84      -m "Confirmed: clicking anywhere on the row header now toggles expand. Also the Open button in row actions is a good escape hatch for the full view." \
 85      2>&1 | comment_id)
 86  echo "   A->A1: $C_A1"
 87  sleep 1
 88  
 89  # Reply to A1 (depth 2)
 90  rad issue comment "$ISSUE" --reply-to "$C_A1" \
 91      -m "Also works great with keyboard — Esc goes back to inbox from issue or patch view." 2>&1 || true
 92  sleep 1
 93  
 94  C_B1=$(rad issue comment "$ISSUE" --reply-to "$C_B" \
 95      -m "One edge case: if the row is near the top of viewport the popover goes off-screen upward. Should flip below the row in that case." \
 96      2>&1 | comment_id)
 97  echo "   B->B1: $C_B1"
 98  sleep 1
 99  
100  # Reply to B1 (depth 2)
101  rad issue comment "$ISSUE" --reply-to "$C_B1" \
102      -m "Fix: compare popoverPos.top with a threshold and flip the popover below the row when too close to the top." 2>&1 || true
103  sleep 1
104  
105  rad issue comment "$ISSUE" --reply-to "$C_C" \
106      -m "Agree. I would go 80ms — snappier without losing the ability to move to the popover." 2>&1 || true
107  
108  # ── 5. Sync ────────────────────────────────────────────────────────────────────
109  
110  log "Syncing..."
111  rad sync --announce 2>/dev/null || true
112  
113  echo ""
114  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
115  echo "  Done! On your host run:"
116  echo "    rad sync rad:zyAM8wXNAXZh3423qneGMsCu5wAy --fetch"
117  echo "  Then Refresh in radboard inbox."
118  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"