Commit 1d8bd23
fix(resolver): four robustness fixes from dual-agent (superpowers + codex) brainstorm
Both reviewers independently identified the same four corner-cases in the
Phase 4 + 6 wiring; this lands the converged fix list.
1. JavaSymbolResolver — `volatile` on `solver` and `combined`
bootstrap() publishes; resolve() and the public accessors read from
arbitrary virtual-thread carriers. The JLS Thread Start Rule covers
the executor.submit() path but does NOT cover callers that read the
public accessors after bootstrap on a different thread. Cheap fence,
closes the visibility hole.
2. JavaSymbolResolver.resolve(String) — strict parse-success check
JavaParser is permissive and may return a partial CompilationUnit
even when the source has parse problems. Resolving against a partial
CU silently emits simple-name-only edges and looks like coverage
even though resolution is broken. Treat any non-success as
EmptyResolved so the graph never carries phantom RESOLVED-tier
edges from broken parses.
3. Analyzer.resolveFor — catch StackOverflowError
Pathological generic / type-cycle inputs can blow JavaSymbolSolver's
recursion stack. Catching the Error keeps the virtual-thread worker
alive and degrades that file's resolution to lexical. Other Errors
(OOM, ThreadDeath) remain fatal and propagate.
4. JavaSourceRootDiscovery.containsJavaFile — try-with-resources on Files.walk
Files.walk holds an open directory stream; without a close, the file
descriptor leaks for every plain-layout fallback scan. Cheap fix.
mvn test: 3592 tests / 0 failures / 31 skipped (full suite, no regressions).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 60864e3 commit 1d8bd23
3 files changed
Lines changed: 31 additions & 9 deletions
File tree
- src/main/java/io/github/randomcodespace/iq
- analyzer
- intelligence/resolver/java
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
| |||
src/main/java/io/github/randomcodespace/iq/intelligence/resolver/java/JavaSourceRootDiscovery.java
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
Lines changed: 17 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
| |||
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
104 | 114 | | |
105 | 115 | | |
106 | 116 | | |
| |||
0 commit comments