Skip to content

Angular component sibling files (ts/html/scss) merged into one File node; search_code silently incomplete #769

Description

@artaommahe

Version

codebase-memory-mcp 0.8.1

Platform

macOS (Apple Silicon)

Install channel

GitHub release archive / install.sh / install.ps1

Binary variant

standard

What happened, and what did you expect?

When indexing an Angular project, the indexer creates one File node per component and folds the component's sibling files (foo.component.ts / .html / .scss) into it. Only one sibling's path survives as file_path, and which one wins is inconsistent (sometimes .ts, sometimes .html, sometimes .scss). The other siblings disappear from the file inventory entirely.

Consequences:

  1. search_code silently returns incomplete results — it only greps files that have their own File node, so matches inside merged-away templates are never found, with no truncation warning. On a real ~10k-file Angular monorepo, a sweep for a CSS class found 95 of 137 grep matches (~70%); ~630 of 1,041 .html templates had no File node.
  2. Wrong-facet paths in results — a component can be represented by its .scss path, so query results/callers point at a stylesheet.
  3. extension / file_path mismatch — on the large repo, nodes appear with extension: '.html' but a file_path ending in .ts or .scss.

Expected: one File node per file on disk (or, if component+template merging is intentional for call-graph purposes, the merged siblings should still be present in the file inventory that search_code and file-level queries operate on — call extraction itself handles the merge fine, see below).

Reproduction

Public minimal repro (13 source files, dummy code): https://github.com/artaommahe/codebase-memory-mcp-angular-repro @ bbc0779

It contains three tiny components engineered to trigger each merge outcome (add-absence: ts+html; checkbox: ts+html+spec+stories; badge: ts+html+scss), a standalone help.html control with no component sibling, and a FeatureService.isEnabled() called from two components. All four .html files contain the literal marker repro-marker.

  1. index_repository {"repo_path":"<repro>","mode":"full"} → 34 nodes / 54 edges

  2. query_graph {"query":"MATCH (f:File) RETURN f.file_path, f.extension ORDER BY f.file_path"}

    Result — 7 File nodes instead of 13:

    src/app/add-absence/add-absence.component.ts   .ts     <- add-absence.component.html GONE
    src/app/badge/badge.component.scss             .scss   <- badge .ts AND .html GONE
    src/app/checkbox/checkbox.component.html       .html   <- checkbox.component.ts GONE
    src/app/checkbox/checkbox.component.spec.ts    .ts
    src/app/checkbox/checkbox.component.stories.ts .ts
    src/app/feature.service.ts                     .ts
    src/standalone/help.html                       .html
    
  3. search_code {"pattern":"repro-marker","mode":"files"}

    Result — 2 of 4 files (checkbox.component.html, help.html); missing add-absence.component.html and badge.component.html, both found by plain grep -rl repro-marker src/.

  4. Control checks: trace_path {"function_name":"isEnabled","direction":"inbound"} correctly returns both callers (AddAbsenceComponent.save, BadgeComponent.isHighlighted) — call extraction is unaffected; the standalone help.html (no component sibling) is indexed correctly.

Full expected-vs-actual write-up in the repro repo's README.

Project scale (if relevant)

Repro: 34 nodes / 54 edges / 13 files. Real-world Angular monorepo where this was found: 60,541 nodes / 124,930 edges / 10,330 files.

Confirmations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.ux/behaviorDisplay bugs, docs, adoption UX

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions