Skip to content

Conversation

@JordanCoin
Copy link
Owner

Summary

  • Fix false hub detection for package-level imports (Go, Python, Rust, etc.) - only count imports that resolve to exactly one file
  • Fix atomic save artifacts in session history - editors using write-to-temp + rename pattern now show "edited" instead of "remove"
  • Unify dependency resolution - removed duplicate buggy findInternalDeps() from render/depgraph.go, now uses scanner.BuildFileGraph() everywhere

Problem

  1. Hub detection was incorrectly flagging all files in a Go package as "imported by 11 files" when only the package was imported
  2. Session history showed files as "removed" when editors did atomic saves
  3. --deps output used different (buggy) resolution logic than hooks/MCP/daemon

Solution

  • In filegraph.go: Only count imports that resolve to exactly 1 file. Package imports that resolve to N files are skipped.
  • In hooks.go: Check if "REMOVE" files still exist, relabel as "edited" if so
  • In depgraph.go: Replace findInternalDeps() with BuildFileGraph() call, removing ~130 lines of duplicate code

Test plan

  • Go codebase shows 0 internal deps (correct - Go imports are package-level)
  • JS/TS projects correctly identify file-level hubs
  • --deps and hook outputs now consistent
  • All existing tests pass

🤖 Generated with Claude Code

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- Fix false hub detection for package-level imports (Go, Python, Rust, etc.)
  Only count imports that resolve to exactly one file. Package/module imports
  that resolve to multiple files are now correctly skipped.

- Fix atomic save "remove" artifacts in session history
  When editors do write-to-temp + rename, fsnotify sees REMOVE events.
  Now checks if "removed" files still exist and relabels them as "edited".

- Unify dependency resolution by removing duplicate findInternalDeps()
  The render/depgraph.go had its own buggy import resolution that incorrectly
  parsed file extensions (e.g., "./utils/helper.js" → "js" instead of "helper").
  Now uses scanner.BuildFileGraph() for consistent, accurate resolution across
  --deps output, hooks, MCP tools, and watch daemon.

- Filter deps to displayed files in --diff mode
  When using --deps --diff, dependency counts and hub info now only reflect
  files in the diff, not the entire repo.

- Remove ~130 lines of duplicate/buggy code from render/depgraph.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@JordanCoin JordanCoin force-pushed the fix-hub-detection-accuracy branch from 9e8f4b4 to d472dea Compare December 11, 2025 23:09
@JordanCoin JordanCoin merged commit 1ed7f8d into main Dec 11, 2025
12 checks passed
@JordanCoin JordanCoin deleted the fix-hub-detection-accuracy branch December 11, 2025 23:12
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