Skip to content

Compute descendants as the inverse of linearized ancestors#892

Draft
soutaro wants to merge 1 commit into
mainfrom
codex/descendants-as-ancestors-inverse
Draft

Compute descendants as the inverse of linearized ancestors#892
soutaro wants to merge 1 commit into
mainfrom
codex/descendants-as-ancestors-inverse

Conversation

@soutaro

@soutaro soutaro commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
  • Add Resolver::compute_descendants, run at the end of resolve()
  • Invert each declaration's Complete ancestors into descendant edges
  • Remove the per-linearization descendant bookkeeping it replaces
  • Fixes descendant over-counts from stale edges left by abandoned tentative parents

- Add Resolver::compute_descendants, run at the end of resolve()
- Invert each declaration's Complete ancestors into descendant edges
- Remove the per-linearization descendant bookkeeping it replaces
- Fixes descendant over-counts from stale edges left by abandoned tentative parents

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@soutaro soutaro self-assigned this Jun 30, 2026
Comment on lines +155 to +160
// Clear any previously recorded descendants.
for declaration in self.graph.declarations_mut().values_mut() {
if let Some(namespace) = declaration.as_namespace_mut() {
namespace.clear_descendants();
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is heavy handed. We should only clear descendants when the invalidation logic identifies that it's necessary to do so, otherwise incremental resolution is going to be super slow.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'm trying to support incremental resolution here.

One note: the current implementation is not super slow I think. It takes 0.5s for full resolution of our monolith, while I agree it's noticeable delay for user interaction -- editing files.

I will try incremental resolution performance profiling first.

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