Skip to content

fix(heritage): PR #142 review fixes (3 cycles)#143

Merged
SutuSebastian merged 6 commits into
mainfrom
fix/type-heritage-review-cycle-1
May 26, 2026
Merged

fix(heritage): PR #142 review fixes (3 cycles)#143
SutuSebastian merged 6 commits into
mainfrom
fix/type-heritage-review-cycle-1

Conversation

@SutuSebastian
Copy link
Copy Markdown
Contributor

@SutuSebastian SutuSebastian commented May 26, 2026

Summary

Post-merge review of #142 (type_heritage substrate) across 6 subagent review cycles:

  • Cycles 1–3: Class superClass generics, type-alias resolve, incremental scope expansion, (expression) sentinel, homonym SQL dedupe, heritage-resolver tests + recipe goldens, plan doc closure
  • Cycle 4: Default-import bases, re-export barrel resolve + incremental scope, ancestor start-symbol dedupe, doc/changeset parity
  • Cycle 5: persistTypeHeritageResolution unit test + incremental run-index e2e
  • Cycle 6: Recipe param polish; ready for merge

Test plan

  • bun test src/extractors/heritage.test.ts src/application/heritage-resolver.test.ts
  • bun test src/application/run-index.test.ts (incremental heritage e2e)
  • bun run test:golden
  • Pre-commit hooks on all commits
  • CI green (re-run after cycles 4–6 push)

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated type hierarchy recipe documentation and performance metrics to reflect type-ancestors and type-descendants query support.
  • Bug Fixes

    • Improved type hierarchy resolution for edge cases: default import handling, homonym deduplication, complex expression extends scenarios, and incremental re-resolution for re-export chains.
  • Tests

    • Added comprehensive test coverage for type hierarchy resolution across same-file, imported, and re-export scenarios.

Review Change Stack

Class superClass generics, type-alias resolve, incremental scope expansion,
module-level symbol preference, complex extends fallback, recipe dedupe;
heritage-resolver tests + new recipe goldens; doc/glossary updates.
Skip resolve for (expression) heritage markers; align type-descendants
homonym dedupe with ancestors via scope_local_id ordering; add scoped
re-resolve test.
Delete shipped plan per docs-governance; prune roadmap and agent-surface
cross-refs; document (expression) heritage rows in recipe help.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR finalizes type heritage resolution edge cases following the substrate completion (PR #142) and recipe additions (PR #141). Changes span extractor improvements for complex expressions and generic types, resolver enhancements for default exports and type symbols, incremental scope expansion for dependents, SQL recipe template refinements for deterministic symbol selection, comprehensive test coverage, and aligned documentation and fixtures throughout.

Changes

Type heritage resolution and recipes

Layer / File(s) Summary
Expression handling in heritage extractor
src/extractors/heritage.ts, src/extractors/heritage.test.ts
Extractor now unwraps parenthesized types, derives fallback simple names, and emits (expression) marker for non-resolvable complex extends. Generic type arguments are captured from superTypeArguments in class extends clauses.
Type symbol support and module-scope preference
src/application/heritage-resolver.ts
Resolver treats type kind as valid resolution target. SymbolEntry includes scope_local_id for consistent module-scope preference during symbol selection.
Default export aware symbol resolution
src/application/heritage-resolver.ts
New findResolvedSymbol helper matches default export symbols or named module symbols. Both same-file and imported base resolution use default-aware lookup via pickTypeSymbol.
Expression row filtering
src/application/heritage-resolver.ts
Heritage rows with base_qualified_name = "(expression)" are early-returned, preventing resolution attempts on non-simple extends expressions.
Incremental heritage scope expansion
src/application/heritage-resolver.ts, src/application/index-engine.ts
New expandHeritageResolveScope function walks importers, barrel re-exports, and type_heritage edges to compute dependent files. Integrated into incremental indexing to broaden re-resolution scope.
SQL recipe template refinements
templates/recipes/type-ancestors.sql, templates/recipes/type-descendants.sql, templates/recipes/type-ancestors.md, templates/recipes/type-descendants.md
Correlated subqueries pin symbols.id deterministically using scope_local_id ordering. Symbol kind filter expanded to include type. Recipe docs clarified for graph walk filtering and file_path parameter semantics.
Heritage resolver comprehensive test suite
src/application/heritage-resolver.test.ts, src/application/run-index.test.ts
New test module covers same-file resolution, imported aliases, expression rejection, homonym scope preference, incremental re-resolution when bases change, default imports, and re-export barrels. Verifies persistence and scope expansion behavior.
Documentation, fixtures, and delivery tracking
docs/architecture.md, docs/glossary.md, docs/benchmark.md, docs/plans/*, fixtures/golden/*, fixtures/minimal/src/types/hierarchy.ts, .changeset/*, templates/agent-content/mcp-instructions.md
Changeset entries document edge-case fixes. Architecture and glossary docs updated for --performance heritage timing and type_heritage semantics. Plan docs reflect merged PRs #141 and #142. Golden fixtures updated for GenericBoth type and recipe output. MCP instructions refined for type-hierarchy workflows.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • stainless-code/codemap#141: Directly related; this PR refines the type-ancestors/type-descendants SQL recipes that PR #141 introduced by adding deterministic symbol pinning and type kind support.

Suggested labels

documentation, enhancement

🐰 Type heritage now handles the tricky cases with grace,
Expressions marked, defaults in place, and scope expanded wide.
From parent extends to descendant chains, symbols pinned with pride—
Tests bloom like clover, docs shine bright, this rabbit's work complete! 🌿✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: post-merge review fixes for the type_heritage substrate (PR #142). It is specific, concise, and clearly conveys the primary purpose of this changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/type-heritage-review-cycle-1

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

🦋 Changeset detected

Latest commit: af6391a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Resolve default-import bases; expand incremental scope for re-export
barrel importers; homonym dedupe on ancestor start symbols; align
type kind filters; doc/changeset parity updates.
Add persistTypeHeritageResolution unit test and run-index incremental
test proving scoped heritage re-resolve updates DB rows.
@SutuSebastian SutuSebastian merged commit e475d20 into main May 26, 2026
10 of 11 checks passed
@SutuSebastian SutuSebastian deleted the fix/type-heritage-review-cycle-1 branch May 26, 2026 10:22
@github-actions github-actions Bot mentioned this pull request May 26, 2026
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