Skip to content

fix(intro): wire up redetector so "Change directory" stops hanging#441

Merged
kelsonpw merged 1 commit intokelsonpw/skills-html-stripfrom
kelsonpw/fix-dir-change-hang
Apr 30, 2026
Merged

fix(intro): wire up redetector so "Change directory" stops hanging#441
kelsonpw merged 1 commit intokelsonpw/skills-html-stripfrom
kelsonpw/fix-dir-change-hang

Conversation

@kelsonpw
Copy link
Copy Markdown
Collaborator

@kelsonpw kelsonpw commented Apr 30, 2026

Summary

Fixes a hang where the IntroScreen's "Change directory" picker freezes after the user submits a new path.

Root cause

store.changeInstallDir(newDir) (in src/ui/tui/store.ts) does the right thing on its end — resets detectionComplete=false, clears the framework config, and calls a registered redetector callback. The store has clean test coverage of this contract (src/ui/tui/__tests__/store.test.ts:1717-1803).

The bug is on the production-wiring side. src/commands/default.ts ran framework detection as a one-shot inline IIFE that captured installDir from closure. It never called tui.store.setFrameworkRedetector(...). Result: when the user submits a new path, the spinner reappears (because state resets) but no detection ever runs, and the screen is stuck forever.

Same gap meant store.autoEnableInlineAddons('auto-tui') never fired in TUI mode either — that call lives inside runFrameworkDetection (the helper extracted from bin.ts specifically so detection could be re-runnable), which had no production caller.

Fix

Replace default.ts's inline detection IIFE with the shared runFrameworkDetection helper, and wire up both store hooks the helper expects:

  • setFrameworkRedetector(...) — closes the IntroScreen loop so submitting a new path actually re-runs detection against it.
  • registerActiveDetection(controller) — lets a directory swap that lands mid-detection cancel the in-flight run, so a stale setDetectionComplete() from the old directory can't fire after the state reset.

Net diff: -83 / +30 lines. The duplicated detection logic in default.ts (and its FRAMEWORK_REGISTRY / detectAllFrameworks / DETECTION_TIMEOUT_MS dynamic imports) is gone.

Test plan

  • pnpm test — 2469 tests pass / 14 skipped (the existing changeInstallDir + setFrameworkRedetector contract tests at store.test.ts:1717-1803 are the regression coverage)
  • pnpm lint clean
  • pnpm build succeeds; smoke test passes
  • Manual: launch TUI with --install-dir=$RUN_BASELINE pointing at one project, then in the IntroScreen pick "Change directory" → type a different path → press Enter. Verify the spinner re-runs detection against the new tree and either auto-detects a framework or falls back to Generic. Repeat with rapid changes to confirm earlier detections don't stomp on later ones.

Related

  • src/ui/tui/screens/IntroScreen.tsx:282-299 — the PathInput that calls store.changeInstallDir(absolutePath)
  • src/ui/tui/store.ts:418-479changeInstallDir impl that fires the redetector
  • src/lib/framework-detection.ts:86-243 — the runFrameworkDetection helper now wired up

cc @amplitude/growth

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only changes (skill prompts and reference markdown) with no runtime code paths affected; main risk is broken internal links or outdated doc guidance.

Overview
Updates the instrumentation workflow skills to reference the consolidated taxonomy skill via the new relative path (../taxonomy/SKILL.md), replacing the older ../../taxonomy/amplitude-quickstart-taxonomy-agent/... references.

Tightens best-practices guidance by enumerating the full Amplitude Browser SDK Autocapture event exclusion list and warning against conceptual duplicates.

Refreshes integration reference materials by replacing large embedded HTML documentation snapshots (e.g., Android and Quickstart) with much smaller markdown excerpts and adjusts a few reference labels (Android/Angular) for clarity.

Reviewed by Cursor Bugbot for commit 50db6d1. Bugbot is set up for automated code reviews on this repo. Configure here.

@kelsonpw kelsonpw requested a review from a team as a code owner April 30, 2026 05:14
@github-actions
Copy link
Copy Markdown
Contributor

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci django
  • /wizard-ci fastapi
  • /wizard-ci flask
  • /wizard-ci javascript-node
  • /wizard-ci javascript-web
  • /wizard-ci next-js
  • /wizard-ci python
  • /wizard-ci react-router
  • /wizard-ci vue

Test an individual app:

  • /wizard-ci django/django3-saas
  • /wizard-ci fastapi/fastapi3-ai-saas
  • /wizard-ci flask/flask3-social-media
Show more apps
  • /wizard-ci javascript-node/express-todo
  • /wizard-ci javascript-node/fastify-blog
  • /wizard-ci javascript-node/hono-links
  • /wizard-ci javascript-node/koa-notes
  • /wizard-ci javascript-node/native-http-contacts
  • /wizard-ci javascript-web/saas-dashboard
  • /wizard-ci next-js/15-app-router-saas
  • /wizard-ci next-js/15-app-router-todo
  • /wizard-ci next-js/15-pages-router-saas
  • /wizard-ci next-js/15-pages-router-todo
  • /wizard-ci python/meeting-summarizer
  • /wizard-ci react-router/react-router-v7-project
  • /wizard-ci react-router/rrv7-starter
  • /wizard-ci react-router/saas-template
  • /wizard-ci react-router/shopper
  • /wizard-ci vue/movies

Results will be posted here when complete.

The IntroScreen's "Change directory" picker freezes after the user
submits a new path. `store.changeInstallDir(newDir)` resets
`detectionComplete = false` (so the spinner reappears) and then
fires the registered redetector callback — but in production the
redetector was never registered, so the spinner spun forever.

Same gap meant `store.autoEnableInlineAddons('auto-tui')` never
fired in TUI mode. It's only called inside `runFrameworkDetection`,
the helper extracted from bin.ts for re-runnability — and that
helper had no production caller.

`default.ts`'s detection task ran inline as a one-shot IIFE that
captured `installDir` from closure and never offered cancellation
or re-run. This commit replaces the inline version with the shared
`runFrameworkDetection` helper and wires up both:

  - `setFrameworkRedetector(...)` — closes the IntroScreen loop so
    submitting a new path actually re-runs detection against it.
  - `registerActiveDetection(controller)` — lets a directory swap
    that lands mid-detection cancel the in-flight run instead of
    leaving a stale `setDetectionComplete()` to fire after the
    state reset.

Removes ~83 lines of duplicated detection logic from default.ts
and drops the `FRAMEWORK_REGISTRY` / `detectAllFrameworks` /
`DETECTION_TIMEOUT_MS` dynamic imports that fed it.

Existing store tests at `src/ui/tui/__tests__/store.test.ts` already
cover the `changeInstallDir` + redetector contract end-to-end
(lines 1717-1803). All 2469 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kelsonpw kelsonpw force-pushed the kelsonpw/fix-dir-change-hang branch from 1306a9b to 50db6d1 Compare April 30, 2026 05:36
@kelsonpw kelsonpw changed the base branch from main to kelsonpw/skills-html-strip April 30, 2026 05:36
@kelsonpw kelsonpw merged commit e120994 into kelsonpw/skills-html-strip Apr 30, 2026
11 checks passed
kelsonpw added a commit that referenced this pull request Apr 30, 2026
) (#447)

The IntroScreen's "Change directory" picker freezes after the user
submits a new path. `store.changeInstallDir(newDir)` resets
`detectionComplete = false` (so the spinner reappears) and then
fires the registered redetector callback — but in production the
redetector was never registered, so the spinner spun forever.

Same gap meant `store.autoEnableInlineAddons('auto-tui')` never
fired in TUI mode. It's only called inside `runFrameworkDetection`,
the helper extracted from bin.ts for re-runnability — and that
helper had no production caller.

`default.ts`'s detection task ran inline as a one-shot IIFE that
captured `installDir` from closure and never offered cancellation
or re-run. This commit replaces the inline version with the shared
`runFrameworkDetection` helper and wires up both:

  - `setFrameworkRedetector(...)` — closes the IntroScreen loop so
    submitting a new path actually re-runs detection against it.
  - `registerActiveDetection(controller)` — lets a directory swap
    that lands mid-detection cancel the in-flight run instead of
    leaving a stale `setDetectionComplete()` to fire after the
    state reset.

Removes ~83 lines of duplicated detection logic from default.ts
and drops the `FRAMEWORK_REGISTRY` / `detectAllFrameworks` /
`DETECTION_TIMEOUT_MS` dynamic imports that fed it.

Existing store tests at `src/ui/tui/__tests__/store.test.ts` already
cover the `changeInstallDir` + redetector contract end-to-end
(lines 1717-1803). All 2469 tests pass.

Co-authored-by: Claude Opus 4.7 (1M context) <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.

1 participant