LearnNewsExamplesServices
Frontmatter
id8426
titleClean up SourceParser and use Class Hierarchy
stateClosed
labels
airefactoring
assigneestobiu
createdAtJan 8, 2026, 2:50 PM
updatedAtJan 8, 2026, 2:53 PM
githubUrlhttps://github.com/neomjs/neo/issues/8426
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 8, 2026, 2:53 PM

Clean up SourceParser and use Class Hierarchy

Closed v11.19.0 airefactoring
tobiu
tobiu commented on Jan 8, 2026, 2:50 PM

Now that docs/output/class-hierarchy.json is the single source of truth for the class hierarchy, the SourceParser logic can be simplified and improved.

Issues:

  1. Remove Flawed Logic: The SourceParser still contains the heuristic logic for resolving superClass (imports map + path resolution + heuristic app naming) which was deemed "messed up". This should be removed.
  2. Use Hierarchy File: Instead of guessing the superClass from imports, SourceParser (or rather ApiSource calling it) should look up the extends property from the authoritative class-hierarchy.json.

Plan:

  1. Refactor SourceParser.mjs:
    • Remove the complex import mapping and heuristic resolution logic for superClass.
    • Accept an optional hierarchy object in the parse() method arguments.
    • If hierarchy is provided, look up the extends value using the extracted className.
    • Fallback: If not in hierarchy, leave extends empty or null (better than guessing wrong).
  2. Refactor ApiSource.mjs:
    • Load docs/output/class-hierarchy.json at the start of extract().
    • Pass this hierarchy map to SourceParser.parse().

Goal: Ensure vector metadata (className and extends) is populated using the authoritative hierarchy data, removing all "hallucinated" heuristics.

tobiu added the ai label on Jan 8, 2026, 2:50 PM
tobiu added the refactoring label on Jan 8, 2026, 2:50 PM
tobiu assigned to @tobiu on Jan 8, 2026, 2:51 PM
tobiu referenced in commit 90db17b - "refactor: Cleanup SourceParser and use Class Hierarchy (#8426)" on Jan 8, 2026, 2:52 PM
tobiu
tobiu Jan 8, 2026, 2:52 PM

Input from Gemini 3 Pro:

✦ I have refactored SourceParser and ApiSource to implement a clean, authoritative inheritance resolution.

Changes:

  1. SourceParser.mjs: Removed the flawed import-mapping and heuristic superClass resolution logic. It now accepts an optional hierarchy object and performs a simple O(1) lookup: superClass = hierarchy[className].
  2. ApiSource.mjs: Now loads docs/output/class-hierarchy.json at the beginning of the extraction process and passes it to SourceParser.parse(). It includes a warning if the hierarchy file is missing (to avoid silent failures).

This ensures that the vector metadata (extends) matches the authoritative JSDoc-generated hierarchy, removing all hallucinated or guessed relationships.

tobiu closed this issue on Jan 8, 2026, 2:53 PM