Skip to content

feat(ui): rename Run button + stale-graph banner (#21, #22) - #37

Merged
melonamin merged 1 commit into
masterfrom
feat/issue-21-22-rename-and-stale-banner
Apr 17, 2026
Merged

melonamin merged 1 commit into
masterfrom
feat/issue-21-22-rename-and-stale-banner

Conversation

@melonamin

Copy link
Copy Markdown
Member

Closes #21, closes #22.

Summary

Why

After #23/#24 shipped bidirectional text↔graph navigation, any post-analysis edit silently invalidates the byte-offset spans the navigation relies on — clicking an occurrence arrow or "Reveal in lineage" would jump to the wrong place. The banner + gates make that invariant visible and the nav safe.

Design

  • LineageState gains analyzedContentByPath: ReadonlyMap<string,string> | null (snapshot taken at analyze time) and stalePaths: ReadonlySet<string> (paths whose live content diverges). Both cleared on setResult(null); snapshot preserved across successful re-analyze to avoid a stale→fresh flicker.
  • App owns the ground truth (project files); EditorArea runs computeStalePaths(snapshot, currentFiles) on every content change and pushes the result via setStalePaths. useAnalysis seeds the snapshot on successful analyze and on IndexedDB cache-hit restore.
  • Staleness comparator is strict equality — any byte-level edit flags the path. Cheap, honest, and matches the byte-offset semantics of the spans we're protecting.
  • Nav gates live next to their affordances: OccurrenceCycler (disabled ◀/▶ with aria-disabled), useOccurrenceShortcuts (n/Shift+n short-circuit), SqlView ("Reveal in lineage" hidden).

Scope notes

  • Dropdown labels ("Run Configuration", "Run Active File Only", etc.) left untouched — they describe execution modes, not the primary action.
  • No Playwright test (app has no test harness yet); covered via unit tests on the pure comparator and store behavior instead.

Test plan

  • yarn workspaces run typecheck — all workspaces clean
  • yarn workspaces run test — 169 tests pass including 12 new ones (staleContent.test.ts, stalePaths.test.ts)
  • yarn workspaces run lint — clean
  • yarn workspace @pondpilot/flowscope-app build — builds
  • Manual smoke: edit analyzed SQL → banner appears, cycler dims, reveal button hides
  • Manual smoke: undo back to analyzed content → banner clears, nav re-enables
  • Manual smoke: re-run analysis after edit → banner clears, nav re-enables

Renames the primary action button from "Run" to "Lineage" and adds a
non-blocking banner plus nav-affordance gates that protect the text↔
graph navigation shipped in #23/#24 from silently drifting after edits.

- Lineage store: analyzedContentByPath snapshot + stalePaths set, cleared
  on setResult(null), preserved across successful re-analyze.
- useAnalysis seeds the snapshot on both fresh runs and cache-hit
  restores; EditorArea diffs live files via computeStalePaths on every
  content change and pushes stalePaths.
- OccurrenceCycler disables ◀/▶, useOccurrenceShortcuts short-circuits
  n/Shift+n, and SqlView hides "Reveal in lineage" when the relevant
  sourceName is stale.
- Amber banner above the editor when the active file diverges from its
  snapshot, clearing on undo or re-analyze.
@melonamin
melonamin merged commit 8d8a85f into master Apr 17, 2026
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.

UI: stale-graph banner when SQL is edited after analysis UI: rename 'Run' button to 'Lineage'

1 participant