Skip to content

Terminate TypeScript hierarchy walks on inheritance cycles - #519

Merged
CaelmBleidd merged 3 commits into
mainfrom
caelmbleidd/ts-cycle-safe-hierarchy
Oct 15, 2026
Merged

CaelmBleidd merged 3 commits into
mainfrom
caelmbleidd/ts-cycle-safe-hierarchy

Conversation

@CaelmBleidd

Copy link
Copy Markdown
Member

A real BinarySearchTree class from the 200-class startup screen never reached symbolic execution: its main thread spent 47.94 CPU seconds in EtsHierarchy while constructing the initial state, then hit the 60-second child timeout. The original TypeScript declares both an interface and a class named BinarySearchTree, with class BinarySearchTree extends BaseCollection implements BinarySearchTree. Once #517 resolves those merged declarations, that interface reference resolves to the canonical runtime class itself. The previous unbounded ancestry sequence followed this self-reference forever.

Compute ancestry with a work queue and a visited set instead. Each reachable class is expanded once, including cycles through superclass or interface edges. The resulting ancestor and inheritor sets retain the starting class, every reachable parent, and the existing SDK Object behavior. Resolution rules are unchanged: an unknown-file name still explores every matching candidate; missing exact signatures and duplicate runtime declarations still fail.

This change is independent of #517 and targets main; apply both to address the merged-declaration startup case. No experiment driver, frontend, dependency pin, or model changes are included.

Validation: eight focused EtsHierarchyTest cases passed (self-reference, mutual class/interface cycles, diamond, same-name candidates, exact signatures, and ambiguity failures); :usvm-ts:detektMain, :usvm-ts:detektTest, and git diff --check passed. The original saved frontend IR and thread dump establish the reported cause. The machine and full test suite were not rerun in this change.

Refs #487.

Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
Comment thread usvm-ts/src/test/kotlin/org/usvm/util/EtsHierarchyTest.kt Fixed
@CaelmBleidd
CaelmBleidd force-pushed the caelmbleidd/ts-cycle-safe-hierarchy branch from 7133148 to cfa4d0c Compare October 15, 2026 14:07
@CaelmBleidd
CaelmBleidd merged commit fb62206 into main Oct 15, 2026
6 checks passed
@CaelmBleidd
CaelmBleidd deleted the caelmbleidd/ts-cycle-safe-hierarchy branch October 15, 2026 14:08
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