Skip to content

feat(expansion): make the graph's growth felt — arrival glow, frontier ring, anchor toast, undo - #20

Merged
jack-arturo merged 11 commits into
mainfrom
feat/ux-expansion-visible
Jun 11, 2026
Merged

jack-arturo merged 11 commits into
mainfrom
feat/ux-expansion-visible

Conversation

@jack-arturo

Copy link
Copy Markdown
Member

What

Part 2 of the UX audit workstreams (stacked on #19). Focus-and-expand is the product's signature interaction, yet expansion was invisible: useExpandableGraph computed newNodeIds "for transient highlight" and nothing consumed it. This PR makes the graph's growth unmistakable:

  • Arrival animation — newly merged nodes scale up from 0.2× with an emissive boost that catches the bloom pass (~1.5s of embers cooling into place). You see exactly where the graph grew.
  • Anchor toast with Undo — every expansion announces itself: +26 memories connected to "Comprehensive list of everyt…". Undo removes the most recent expansion only — those nodes sit at the array tail, so removal never moves an earlier node's index. (The audit's "exploration popover with per-expansion remove" was deliberately scoped down: arbitrary removal would violate the documented append-only invariant that the index-keyed interpolation buffers depend on.)
  • Expansion frontier ring — a slowly rotating dashed "+N more" ring around a selected node whose neighbors aren't all loaded; reads the Inspector's neighbors query from cache (no extra fetch). A fully expanded node renders nothing — absence reads as exhausted.
  • Live "in view" counts — StatsBar showed the snapshot's returned_nodes, which goes stale the moment an expansion merges nodes; it now counts the rendered graph.
  • Status toast gained an optional action button (used for Undo, 6s window).

Implementation notes

  • The frontier ring's dashes are mesh ring-arcs (RingGeometry with thetaStart/thetaLength), not THREE.Line — LineDashedMaterial misrendered as a giant filled disc in this scene (caught during live verification).
  • Hover affordance from the audit turned out to already exist (1.2× scale + brighten + pointer cursor in InstancedNodes) — the audit claim was wrong, so no change there.

Verification (live, against a 10k-memory local store)

  • ✅ Expand into graph (39) → toast +26 memories connected to "…" → header 2,000 in view → 2,026 in view → Undo → 2,000 in view (exact revert, no crash, no teleporting)
  • ✅ Off-graph search-result click: neighborhood injected, camera frame-fly, toast fired, inspector shows "Expanded", frontier ring correctly absent
  • ✅ Frontier ring + "+N more" renders for partially expanded selections; gone after full expansion
  • ✅ npm run lint (0 errors, 14 warnings = main's baseline) + npm run build green

Stacked on #19 — merge that first; this PR's base is feat/ux-truth-foundations.

🤖 Generated with Claude Code

jack-arturo and others added 7 commits June 11, 2026 22:24
Four divergent type→color maps (GraphCanvas VIBRANT_TYPE_COLORS, MiniMap,
TagCloud, tailwind config) plus server meta.type_colors rendered the same
memory type as different hues per surface. Canonicalize on the scene palette
in src/lib/palette.ts, resolve it over server colors at the API chokepoint,
and make normalizeNode prefer the type-keyed color. Pathfinding trace hues
and the pinch pre-select amber become named tokens; settings relationship
swatches now derive from EDGE_STYLES instead of a duplicate table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The UI never said which universe a number referred to: the stats bar's bare
count read as exhaustive, the search badge counted the whole store while the
canvas highlighted only loaded matches, pathfinding silently vanished when no
path existed among loaded edges, and the timeline counted 'memories' that were
really just the loaded scene. Every count now names its scope, and pathfinding
failure gets an honest no-path card with the expand-and-retry hint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Force, display, clustering, and relationship-visibility configs were plain
useState — every reload reset the workspace to defaults (only sound settings
persisted). Extract the sounds.ts localStorage pattern into usePersistentState,
apply it to all four configs plus the tag AND/OR mode, and add a 'Reset all'
escape hatch to the settings header.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A successful snapshot with zero nodes left an unexplained black canvas —
indistinguishable from a crash, and the literal first impression for anyone
opening a freshly deployed (empty) AutoMem store. Distinguish the two causes
via stats.total_nodes: an empty store gets a friendly onboarding card with
Refresh and a wire-up-an-agent link; an over-filtered view says how many
memories the filters excluded and offers one-click filter reset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Embedded /viewer/#token= sessions authenticated silently — no confirmation,
no way to see which server you're on, no sign-out, and a rejected shared-link
token dead-ended at a generic 'Connection Error' whose Retry re-hit the same
401 forever. Add a one-time 'Connected to <host>' toast for URL-token
sessions, a Settings → Connection section (server, masked token, Disconnect),
and an auth-aware error card whose 'Enter credentials' strips URL-borne
tokens so TokenPrompt can actually take over.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
usePersistentState setters aren't lint-exempt like React's useState setters;
they're stable (useCallback on key), so listing them is behavior-neutral.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TanStack Query's default networkMode 'online' parks a failed query at
fetchStatus 'paused' whenever the browser's online-manager misdetects
connectivity — no retry, no error state, an infinite spinner exactly where
the error card should be (reproduced in a managed browser; failureCount
froze at 1 with status 'pending'). This app talks to exactly one API, so
let the fetch itself be the connectivity check: networkMode 'always' for
queries and mutations. Auth rejections (401/403) additionally skip retries
entirely — they don't fix themselves, and failing fast is what makes the
new Access-denied card render immediately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 11, 2026 21:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes graph expansion events visually and informationally explicit by adding arrival animations, an expansion frontier cue, and a status toast with single-level Undo, while also fixing “in view” counts to reflect the live rendered graph (snapshot + expansions).

Changes:

  • Added single-level “undo last expansion” state + API to the expandable graph reducer.
  • Implemented expansion arrival animation for newly merged nodes and added a dashed “+N more” frontier ring for partially expanded selections.
  • Updated StatsBar and App wiring so “in view” counts and expansion toasts reflect the current rendered graph.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/hooks/useExpandableGraph.ts Tracks last expansion and supports tail-only undo in the reducer/hook API.
src/components/StatsBar.tsx Uses live in-view node/edge counts instead of stale snapshot counts.
src/components/SelectionHighlight.tsx Adds ExpansionFrontierRing (dashed ring + “+N more” label) for partially expanded nodes.
src/components/GraphCanvas.tsx Plumbs newNodeIds to instanced rendering and adds arrival scale+glow animation logic.
src/App.tsx Computes frontier count, wires live counts to StatsBar, and adds status toast with Undo action.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/App.tsx Resolved
Comment thread src/components/GraphCanvas.tsx Resolved
Comment thread src/App.tsx Resolved
Comment thread src/App.tsx
Comment on lines +1389 to +1395
<button
onClick={() => {
statusMessage.action!.onClick()
setStatusMessage(null)
}}
className="px-2 py-0.5 rounded bg-white/10 hover:bg-white/20 text-accent text-xs font-medium transition-colors"
>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0681810 — explicit type="button" and the auto-dismiss timer is cancelled on click so a stale timer can't clear a later toast.

jack-arturo and others added 3 commits June 11, 2026 23:20
Copilot review: the button implied it reset everything in the panel but only
covered forces/display/clustering/relationships. It now also resets audio
(enabled/volume) and the tag AND/OR mode; the tooltip states exactly what it
covers and that filters (view state) are deliberately untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r ring, anchor toast, undo

Focus-and-expand is the product's core model, yet expansion was invisible:
useExpandableGraph computed newNodeIds 'for transient highlight' and nothing
consumed it. Now:

- Arrival animation: newly merged nodes scale up from 0.2x with an emissive
  boost that catches the bloom pass (~1.5s of embers cooling into place), so
  the user sees exactly where the graph grew.
- Anchor toast: every expansion announces itself — '+26 memories connected
  to "…"' — with a single-level Undo. Undo removes only the most recent
  expansion: those nodes sit at the array tail, so removal never reorders an
  earlier index (the one removal the append-only invariant permits).
- Expansion frontier ring: a slowly rotating dashed '+N more' ring around a
  selected node whose neighbors aren't all loaded (cache-read of the
  Inspector's neighbors query — no extra fetch). A fully expanded node shows
  nothing: absence reads as exhausted. Dashes are mesh ring-arcs, not
  THREE.Line — LineDashedMaterial misrendered as a filled disc in this scene.
- Live 'in view' counts: StatsBar previously showed the snapshot's
  returned_nodes, which goes stale the moment an expansion merges nodes;
  it now counts the rendered graph (verified live: 2,000 → 2,026 → undo →
  2,000).
- Status toast supports an action button (used for Undo, 6s window).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Sweep expired arrivalsRef entries on each expansion: useFrame only deletes
  an entry when its node still renders, so an Undo mid-animation would leak
  removed ids in the map indefinitely.
- Gate the expansion toast on lastExpansion identity instead of newNodeIds,
  so an edges-only expansion (all neighbors already in view, new connections
  discovered) announces '+N new connections' instead of merging silently.
- Toast action button: explicit type="button" and cancel the auto-dismiss
  timer on click so a stale timer can't clear a later toast.
- Correct the frontier-count comment: the neighbors query dedupes with the
  Inspector's identical key but CAN fetch on a cold or stale cache.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jack-arturo
jack-arturo force-pushed the feat/ux-expansion-visible branch from 2b03845 to 0681810 Compare June 11, 2026 21:21
Base automatically changed from feat/ux-truth-foundations to main June 11, 2026 21:24
@jack-arturo
jack-arturo merged commit 9ae940b into main Jun 11, 2026
@jack-arturo
jack-arturo deleted the feat/ux-expansion-visible branch June 11, 2026 21:26
jack-arturo added a commit that referenced this pull request Jun 11, 2026
Merging stacked PRs #19 and #20 re-applied the connection-visibility block
(connectionToastShownRef / handleReenterCredentials / connectionInfo /
isAuthError) a second time — #20's branch still carried the rebased #19
commits, and after #19's squash-merge the second merge duplicated the block
in a shifted context, breaking tsc (TS2451 redeclarations) and the image
build. src/ now matches the reviewed #20 branch tip exactly.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants