Skip to content

codegraph explore "RealtimePlusService" No relevant code found for "RealtimePlusService" #1642

Closed

Description

@CmmVoid

codegraph uninit
⚠ This will permanently delete all CodeGraph data. Continue? (y/N) y
✓ Removed CodeGraph from /Users/cmm/Downloads/idea/panda-es-build
codegraph init

┌ Initializing CodeGraph
│
◆ Initialized in /Users/cmm/Downloads/idea/panda-es-build
│
│ ◆ Scanning files — 38 found
│ ◆ Parsing code — done
│ ◆ Resolving refs — done
│ ◆ Linking dynamic dispatch — done
│
◆ Indexed 38 files
│
● 64 nodes, 83 edges in 309ms
│
└ Done

codegraph status

CodeGraph Status

Project: /Users/cmm/Downloads/idea/panda-es-build

Index Statistics:
Files: 38
Nodes: 64
Edges: 83
DB Size: 0.30 MB
Backend: node:sqlite — built-in (full WAL)
Journal: wal

Nodes by Kind:
file 33
method 23
function 5
constant 3

Files by Language:
xml 17
javascript 16
properties 5

✓ Index is up to date

codegraph status

CodeGraph Status

Project: /Users/cmm/Downloads/idea/panda-es-build

Index Statistics:
Files: 38
Nodes: 64
Edges: 83
DB Size: 0.30 MB
Backend: node:sqlite — built-in (full WAL)
Journal: wal

Nodes by Kind:
file 33
method 23
function 5
constant 3

Files by Language:
xml 17
javascript 16
properties 5

✓ Index is up to date

codegraph explore "RealtimePlusService"

No relevant code found for "RealtimePlusService"

i have three time reinstall ,not success, include all java file can not explore

Activity

  1. CmmVoid commented on Aug 28, 2026

    @CmmVoid
    Author

    我刚定位到具体原因了:CodeGraph 内置默认忽略规则里有 build/,它本意是排除构建产物目录,但你们 Java 包路径
    是:

    com/ctrip/panda/es/build/...

    所以所有 Java 文件路径里都有 /build/ 这个目录段,被 CodeGraph 当成构建产物过滤掉了。资源文件和 pom.xml 没
    有这个包路径,所以还能被索引进去。

    关键验证结果:

    isSourceFile(RealtimePlusService.java) = true
    buildScopeIgnore(RealtimePlusService.java) = true
    scanDirectory files = 38
    java count = 0
    git ls-files '*.java' = 246

    所以本质是 CodeGraph 的默认 ignore 规则对 Java 包名误伤了,不是 .codegraph 生成文件的问题。你说
    的 .db / .db-shm / .db-wal / .log / .pid / .sock 都是正常本地索引/daemon 运行产物;当前这个仓只有
    codegraph.db 也正常,不代表少了 Java 索引能力。

    处理方式我建议两档:

    短期本仓可用:在根 .gitignore 加 negation,让 CodeGraph 的内置 build/ 被覆盖:

    !/src/main/java/
    !/src/test/java/

    然后重新执行:

    codegraph index
    codegraph explore "RealtimePlusService"

    但注意:这会改 .gitignore。如果你不想进仓库,就别提交这个改动。

    长期正确处理:给 CodeGraph 提 issue。这个是它的默认规则设计问题,build/ 不应该误伤 Java package path,至少
    应该对 src/main/java/
    、src/test/java/** 做例外,或者默认 ignore 只针对项目级/构建输出上下文。**

    一句话结论:你另一个工程能用,是因为它的 Java package 路径里大概率没有 /build/ 这个目录段;panda-es-build
    这里刚好包名和默认忽略规则撞上了。

  2. maxmilian commented on Aug 29, 2026

    @maxmilian
    Contributor

    @CmmVoid's root cause holds up — I checked it against current main, and there is a wrinkle worth surfacing for whoever picks this up. Not claiming it.

    Confirming the mechanism. build is in DEFAULT_IGNORE_DIRS (src/extraction/index.ts:172, on the "Build output (common across ecosystems)" line), and DEFAULT_IGNORE_PATTERNS expands every entry to ${d}/ (:224). A gitignore pattern with no leading or internal slash matches at any depth, so build/ excludes com/ctrip/panda/es/build/ exactly as it excludes a top-level build/. Resources and pom.xml survive because they don't carry the Java package path — which is precisely the asymmetry in the report.

    The wrinkle: this collides with a rule the file already states. The doc comment at :150-160 says generic, first-party-prone names — packages, lib, app, bin, src, deps, env, tmp, storage, Library — are "deliberately NOT listed, to avoid ever hiding real source." In Java, build is that same category: it is a perfectly ordinary package segment. So this isn't only a missing special case, it's an entry that arguably fails the list's own admission test at depth, even though it passes at the root.

    Why there's no one-line fix, which is why I'm leaving this as triage rather than sending a patch:

    • target/ (Maven, Rust), out/, and dist/ are the same shape — all are legal package or directory names below a source root.
    • Restricting build/ to the project root would break Gradle monorepos, where module/build/ is genuinely build output and the depth-matching is doing real work.
    • Telling the two apart seems to need source-root awareness (is this path under src/main/java, src/, a module root?), which is a new concept for this list rather than a tweak to it.

    Workaround in the meantime, using the escape hatch :150-160 documents — an explicit .gitignore negation in the project:

    !**/src/main/java/**

    Worth noting the failure is silent: codegraph init reported Indexed 38 files and Done with no warning, and the shortfall only surfaced later as explore finding nothing. Whatever the fix turns out to be, a project where git ls-files '*.java' returns hundreds and the index holds none seems worth a warning on its own.

  3. colbymchenry commented on Sep 27, 2026

    @colbymchenry
    Owner

    Thanks for the detailed report, @CmmVoid, and thanks for using CodeGraph! This is fixed on main by #1998, which builds on @danusha2345's #1646 (thank you!): Java, Kotlin and Scala packages named build under a source root (src/main/java/.../build/) are indexed again, while real build-output directories stay excluded. The fix will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions