Skip to content

chore(sync): merge upstream 329dd12 and release 1.6.2-fmagent.4 - #25

Open
Dshuishui wants to merge 23 commits into
mainfrom
sync-upstream-329dd12
Open

Dshuishui wants to merge 23 commits into
mainfrom
sync-upstream-329dd12

Conversation

@Dshuishui

Copy link
Copy Markdown
Collaborator

What this does

This PR moves the fork's base from upstream d2e0389 to 329dd12, upstream main as of 2026-11-15 and 21 commits later. It also sets the version to 1.6.2-fmagent.4. The merge has no conflicts. Upstream has not tagged a release since v1.6.2.

What FM-Agent mainly gets from this sync is better Java call resolution: more calls now reach the right overload. FM-Agent reads Java through CodeGraph alone, so it gets this change directly.

Please merge with a merge commit, not a squash, so that upstream's commit history is kept. We will publish a prerelease first and promote it once FM-Agent runs cleanly on it in both full and --incremental mode.

Patches

Apart from FORK.md and the version number, every fork file differs from the new base by exactly the lines it differed by from the old base. All 44 patch tests pass on this branch; copied onto upstream's code, they fail in all 5 test files, 32 tests in total. On real projects the patches have the same effect as at the last sync. On opencode, this branch has 463 call edges that upstream lacks and lacks 56 that upstream has. On a Redis tree that contains an fm_agent/ directory, upstream indexes 16,310 nodes from that directory and this branch indexes none.

Verification

  • Tests: The full suite has 6 failures. The 2 in bundle-launcher fail because the test machine has no zip, and upstream fails them too. Three in daemon-older-version fail because of the fork's version string, and CI skips them. The remaining one in daemon-older-version passed all 3 times it was rerun on its own.

  • Regression cases: All 15 cases pass, 4 of which cover the fork's patches. .3 also passes all 15, and upstream passes 11.

  • Java: We measured recall and estimated precision against the calls that each project's own test suite actually makes at run time (.3 → this PR):

    Project Recall Estimated precision
    jsoup 71.4% → 74.7% 86.3% → 90.0%
    gson 61.5% → 63.5% 78.3% → 80.5%
    commons-collections 48.3% → 49.7% 78.0% → 80.1%
    jackson-databind 55.1% → 58.7% 62.5% → 66.3%
  • What FM-Agent reads: We compared what FM-Agent 7ff4709 reads through its own backends (pyrefly for Python, VTA for Go, Clang for C and C++ plus function-pointer analysis for C, rust-analyzer for Rust, CodeGraph alone for Java, JS and TS) on 16 trees in 8 languages. The 16 trees come from 14 repositories, since etcd and ripgrep were each run both whole and as a subdirectory. This PR and .3 give identical functions, bodies included, and identical function-pointer edges. Call edges change in only four projects:

    • jsoup loses 159 edges and gains 203. For every edge it loses, the same caller now reaches another overload of the same method, and in 7 cases it reaches two. Of the other 37 new edges, 36 add another overload of a method the caller already reached. We spot-checked 6 of the changes, and all were correct.
    • etcd loses 12 edges on the whole repository and 1 on server/etcdserver alone. Each of them linked an interface method to a same-named method with a different signature, so all were false.
    • re2 and leveldb gain 1 edge each, where template code now reaches the constructor of its type argument. We checked both against the source, and both are correct.
  • Memory: Peak memory while indexing dropped by 20–54% on each of the 13 trees we measured. We measured each tree once and did not measure gin or the whole etcd and ripgrep.

colbymchenry and others added 23 commits November 1, 2026 02:48
…e 1.6.2 did (colbymchenry#3178)

A sync after an edit took more memory at its peak than 1.6.2 on several repos:
caddy 188 to 264 MB, django 350 to 437, rails-src 358 to 413. Nothing is held.
At the end of caddy's sync the live heap is 33 MB of 178 MB: Node 24 lets the
new space double up to 64 MB a side, and a short run that allocates a little
more than it did lands one doubling higher.

Every way the CLI starts now passes --max-semi-space-size=16: the bundled
launchers, the npm shim and the re-exec. It has to be on the command line, since
setting the flag at run time doesn't reach the main thread's heap. Workers get it
too, which is what resolver workers already asked for by their own limit.

Peak RSS of a sync after an edit, main to this, 3 rounds: caddy 258 to 193 MB,
tokio 196 to 164, excalidraw 223 to 168, with wall and CPU level. 1.6.2 on caddy
is 190.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ss a slow file (colbymchenry#3179)

A small project paid for threads it couldn't use. Eight workers started however
many files there were, each loading its modules and grammars, for a few hundred
ms of parsing: 1.6.2 did that too, and since then loading has grown, by about
half a second of CPU on flask. The pool now starts what the parsing to come is
worth. W workers take parseMs / W, so one more saves parseMs / W^2, and it stops
when that falls below a worker's cost. It takes a typical file's time until it
has measured a few of its own, and grows if the files prove slow.

A parse worker also loaded every framework resolver at start, which is half its
modules, for a project that may use none. They now load on first use.

Parsing could run only 2 files per worker ahead of the ordered commit, so one slow
file at the cursor stopped every worker once the window was out: on rocksdb they
sat idle more than half the time. It is 8 per worker now. Files still commit in
order, so the graph is the same, and what waits is a few MB.

Interleaved, 5 rounds, this against main: gin 4.28 to 2.81 s CPU, 365 to 259 MB;
flask 3.77 to 2.61, 359 to 223; taxonomy 3.27 to 2.19, 405 to 270; ripgrep 5.37 to
4.23, 444 to 298. Wall is level or lower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
colbymchenry#3180)

Reading a node built an object keyed by column and then a second one by hand.
node:sqlite can hand a row over as an array, about a third cheaper, on Node 22.16
or newer; an older runtime keeps its objects.

The resolver stat'ed a file and then read it, and on Windows that's a second walk
of the path, a quarter of the read. It now opens the file and asks the open file,
with O_NONBLOCK so a FIFO with no writer can't park the open, as the trail store
does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nce (colbymchenry#3181)

The self time in C++ resolving rose from 93 to 109 s on rocksdb, in code added
since 1.6.2: a flat tail of whole-file scans and of the same questions asked again
for every reference. cppNonCodeLines and cppLiteralsBlanked walked strings a
character at a time and built arrays of them; they now read char codes and work by
slices. The answers about a candidate from one file, about a caller's class, about
a type as written and about an include search are remembered: on rocksdb the
questions asked are 3 to 15 times the distinct ones.

None of what's remembered reads an edge, so it holds through the resolve; what
depends on a reference has the reference's place in its key. The memos of one
file's candidates keep to the last 256 files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m one file holds (colbymchenry#3184)

tokio's `use crate::process::unix::GlobalOrphanQueue;` linked nothing on
main, where 1.6.2 linked it. Since PR colbymchenry#3014 a `use` path walks the crate's
modules, and tokio's `mod unix { pub(crate) use super::imp::*; }` globs a
module with a `#[path]` for each cfg: `unix/mod.rs` or `windows.rs`.
rustSubmodule answered null for such a module, so the glob couldn't be
followed and the import had no target.

The fix: rustSubmodule keeps every file the alternatives name
(RustModule.choices), and rustCfgChoiceItems looks a name up in all of them.
What one alternative holds is that one's, whichever the build takes; a name
two of them hold is the build's choice and stays unread, as PR colbymchenry#3064 pinned.
A step further down the path walks each alternative the same way.

Validation:
- rust-path-attribute-modules.test.ts: 2 of its new cases fail on main and
  all 9 pass.
- A/B against main 4499d00: tokio +7 imports, all true (the reported edge,
  `Wait` and `OrphanQueue` through `imp::orphan`, `AtomicU64` through tokio's
  cfg'd `imp`), and 2 calls keep their target by the import instead of by
  name. ripgrep, clap, serde, dioxus, gleam and axum byte-identical (axum's
  24 "moved" are the diff tool's duplicate route nodes, identical by row);
  controls flask and express identical.
- CPU, dioxus, median of 5 interleaved: 33.97 to 33.28 s. Resolution only, so
  no kernel change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s types (colbymchenry#3185)

goImplementsEdges matched method names and, since PR colbymchenry#2447, parameter and
result counts. Go wants the signatures identical, so a type with the right
number of the wrong types passed: caddy's TLS matchers, with
`Match(*tls.ClientHelloInfo) bool`, "implemented" its HTTP `RequestMatcher`,
whose `Match` takes an `*http.Request`, and every HTTP matcher its TLS
`ConnectionMatcher`. Each false entry also sent calls through the interface
to a method they never reach, and took a place under the per-interface cap.

The fix: at the counts that fit, typesFit compares each parameter's and
result's type, read off the stored signature (goItemTypes,
goComparableType). A type compares by its name with the package left off,
since the two declarations may write `Context` and `caddy.Context` from
different packages. Nothing is ruled out by a true alias, by a type
parameter of the type or of what it embeds, by a `func`/`struct`/`interface`
literal type, or by a method a standard-library embedding brings, whose
types the table doesn't hold. A gRPC server keeps crossing to its client
interface at the server's counts.

Validation:
- go-implements-types.test.ts: 4 of 9 cases fail on main, all pass.
  go-promoted-dispatch.test.ts pinned the old behaviour (two series sets
  implementing each other's interface by name) and now says what Go says.
- A/B against main 4499d00, implementers dropped: caddy 24, prometheus 261,
  etcd 36, hugo 169. A separate judge reads each dropped pair's signatures
  through embedded types with qualifiers and names removed: 490 of 490 differ.
  Calls dropped with them: caddy 24, prometheus 636, etcd 36, hugo 98.
  Added: prometheus 8 implementers and 30 moved dispatch edges, real
  implementers the false ones had pushed past the cap (`blockSeriesSet`,
  `seriesSetAdapter`). gin and cobra byte-identical; controls flask and
  express identical.
- REG's 7 false entries on caddy are gone. The 11 real implementers caddy's
  `Provisioner` and `Unmarshaler` still lose against 1.6.2 are the cap's: both
  arms keep 40 real ones, of more than 40, in file order. That isn't changed
  here; raising the cap to 400 adds 239 implementers and 467 edges on caddy.
- CPU, median of 3 interleaved: hugo 22.75 to 22.44 s, etcd 21.19 to 22.00 s
  (wall 7.23 to 7.14 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alue the other (colbymchenry#3186)

Alamofire's `Protected` declares `write(_ closure: (inout Value) throws -> U)`
and `write(_ value: Value)`. Their labels are alike, so retargetSelfOverload
kept whichever the ranking found first: every `didStop.write(true)` reached
the closure overload. A trailing closure wasn't read at all, so
`write { $0 = value }` inside `write(_ value:)` called itself, as did
Kingfisher's `clearCache { … }` inside `clearCache() async`.

The fix: swiftOverloadForClosure reads the call's labels and whether its last
argument is a closure, trailing or in the parentheses, and takes the one
overload whose parameter for that argument agrees. An `@autoclosure` parameter
takes a value, and the `{` after an `if`, `guard`, `while`, `for` or `switch`
condition is the statement's. It only runs for an overload set in which some
overload takes a function, and each overload's parameters are read once.

Validation:
- swift-overload-closure.test.ts: 3 of 6 cases fail on main, all pass. Fixture
  sw1 had reproduced this all along: REG read it as clean because 1.6.2 is
  wrong in the same way there.
- A/B against main 4499d00, Swift calls moved: Alamofire 46, Kingfisher 67,
  vapor 1, SnapKit 0; nothing added or lost. All 114 read against source.
  The 26 `write(value)` sites go to `write(_ value:)`, `adapt(_:using:)` with
  a trailing closure to the overload with that label, `cURLDescription { … }`
  to `cURLDescription(calling:)`, and Kingfisher's async wrappers from
  themselves to the completion-handler overload. Controls flask and express
  identical.
- CPU, Kingfisher, median of 7 interleaved: 5.33 to 5.19 s. Resolution only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eter is typed (colbymchenry#3187)

Java overloads were told apart by nothing but the count, and only when one
sibling alone fitted it. With two of a count the first declared won:
jsoup's `super.before(node)`, new on main since 2577601, reached
`before(String)`, and rocksdb's `it.seek(k2)` with a `ByteBuffer` reached
`seek(byte[])`. With several of the right count and a target of the wrong one
the wrong one stayed: every `Jsoup.parse(html)` reached the two-argument `parse`.

The fix: retargetSelfOverload, which every Java call passes through, asks
javaOverloadsFitting. It keeps the overloads of the right count, reads each
argument's static type where its text says (a literal, a cast, a `new`, `this`,
a local or parameter, a field of the class or one it inherits, `x.f` and
`Type.FIELD`, an element of an array, or a call on one of those, by what that
method returns), and scores it against each parameter as Java does: the same
type, widening before boxing, a project type's supertypes, variable arity last
when every argument was read. An overload the compiler would refuse goes, and a
private one goes from another file. A name the project doesn't declare may be a
type parameter, so it refuses nothing. When the arguments don't settle it the
ranking's pick stands, a pick that was a private overload of another file stays
unresolved as it was rather than become a guess between the rest, and a set with
a Kotlin overload goes on to the count check as before.

A lambda's parameter is the other half of REG's list: `tb` in jsoup's
`assertAdoptionRecovery(new HtmlTreeBuilder(), tb -> { tb.process(…); }, …)`
linked by a name guess on 1.6.2 and nothing on main. javaLambdaParameterType
reads the type from the method the lambda is passed to, when that is a
receiver-less call to a method of the same file taking a JDK functional
interface with a type argument of its own: a rule, not the guess back.
`list.forEach(x -> …)` says nothing until `list` is typed, so it stays out.

Validation:
- java-overload-arguments.test.ts: 16 of 22 cases fail on main, all pass.
- A/B against main 4499d00, calls moved to the overload that fits (the wrong
  argument count before / told apart by type / variable arity):
  jsoup 2,002 (1,347 / 636 / 19), rocksdb's java/ 1,136 (987 / 146 / 3),
  Minestom 711 (351 / 349 / 11), spring-ai 881 (141 / 645 / 95),
  kestra 1,235 (498 / 617 / 116), elasticsearch 2,860 (770 / 1,649 / 438),
  okhttp 2.
- Read against source: every call moved by a call's return type or a field on
  jsoup, Minestom and rocksdb (about 180), every call decided by score with an
  argument unread on jsoup, Minestom and rocksdb (130: one still wrong,
  Minestom's `wrap(MemorySegment.ofArray(bytes), …)`, and wrong on main too),
  plus random samples of 70 on jsoup, 50 on spring-ai, 45 on Minestom, 30 on
  rocksdb and 30 on elasticsearch.
- Left open: where an argument can't be read (a chain, a library call) and the
  overloads of its count differ there, the ranking's pick stands, or the first
  of the count when the ranking's had the wrong count. jsoup 28 of the 2,002,
  rocksdb 209 of 1,136, Minestom 70 of 711, spring-ai 24 of 881. Samples of 26 on
  Minestom and 16 on rocksdb found 4 of those on the wrong overload, all of them
  wrong on main as well: `db.newIterator(handles.get(1))`, a `List` element.
- Added, all true: jsoup 7 lambda calls and 5 `remove(String)` calls, which had
  reached a private `remove(int)` in another file and been refused; spring-ai 4
  and kestra 35 lambda calls; elasticsearch 10 lambda calls and 25 of the
  private overload's: 19 `Errors.merge`, 3 `Checkpoint.write`, 2 `shardContainer`
  and 1 `executeFetchPhase`.
- Lost: spring-ai 4 and elasticsearch 2 `super.x(…)` calls into a library class
  (commonmark's `AbstractVisitor`, Lucene's `FieldInfos`) that reached a sibling
  overload of the caller. Those calls leave the project.
- REG's rocksdb/added/10 class: `it.seek(k2)` and every such call in
  WriteBatchWithIndexTest now reach `seek(ByteBuffer)`.
- Controls flask, express and serilog identical; no other language changes.
- CPU: the Java PRs together, elasticsearch, median of 5 interleaved rounds, 151.03 to
  153.81 s, +1.8%, with wall -4.1%; Minestom +0.2%. The cost is reading the
  arguments of the calls that have overloads, which is what moves about 3,000 of
  elasticsearch's calls. Resolution only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on a namesake (colbymchenry#3188)

Four false readings of which type a Java name means.

javaAncestorNames walked up the supertypes with one memo for every type,
filled at whatever depth a type was first reached. A type met at the depth
limit was remembered with its own header's names alone, and every shallower
walk through it stopped there, while a walk that found a finished entry reached
past the limit, so what a bare `Reader` could mean turned on which reference ran
first. Each resolver worker keeps its own memo and sees the chunks the pool
hands it, so the graph changed with the pool's size: two cold indexes at one
size agree, as REG saw, but on elasticsearch the default pool and 2 workers
differ in 16 edges and references, and `GetSynonymsAction.Response` lost the
`Reader` it inherits from `Writeable`. Each type now walks to the top for itself
and memoizes only the finished answer. csharpAncestorNames had the same shape
and gets the same walk.

The walk also went through every type of a supertype's name.
`InternalGeoGrid implements GeoGrid` means its own package's interface, but a
record `BlockLoaderFunctionConfig.GeoGrid` shares the name and implements its
owner, so `BlockLoaderFunctionConfig` passed for an ancestor, the record for a
nested type in reach, and with paths too deep to tell them apart the record took
the `implements`. Now a supertype's name means the types its file has in reach,
when it has any.

With every inherited name now found, a name written through a qualifier needs
the qualifier read: `java.io.Reader` is no `Writeable.Reader` the class inherits,
and `IndexFieldData.Builder` is the one nested in `IndexFieldData`, not the
`Builder` the enclosing class declares. What's written directly before this
reference decides, not what the line holds elsewhere: an anonymous class's
`new BucketOrdsEnum() {` below `LongKeyedBucketOrds.BucketOrdsEnum delegate = …`
stays its own file's.

`Template::lifecycle` matched every member of that name, and since records
have accessors a record `Template` nested in another class made two candidates
in other files, so the reference resolved to nothing. Now it means the
`Template` the file can see, as a bare type name does.

Validation:
- java-supertype-reach.test.ts: 6 of 9 cases fail on main, all pass, none by
  timing: `Deep` sorts first and poisons the memo for `Near`.
- Worker order: elasticsearch's default pool, 2 workers and 5 workers now give
  identical dumps of every edge and unresolved reference; on main the default
  pool and 2 workers differ in 8 lines each way.
- elasticsearch, A/B against main 4499d00: `GeoGrid` and 2 `Range` implements
  back on their own package's interfaces, which moves 6 `super.x()` calls to the
  real parent, drops 8 interface-impl edges of the records and adds 3 real ones;
  4 `Reader` and 2 `BucketComparator` references and 2 `Template::lifecycle` back;
  266 references through a type move to the type it names; 6 through a package
  drop (`org.apache.lucene.search.ScoreMode` and the like), all false before.
- spring-ai: 55 method references gained (`Generation::getOutput` and the like),
  each on the type the file imports; 50 references through a type moved to it.
- kestra: 39 references moved, each to what its qualifier names
  (`io.kestra.jdbc.AbstractJdbcRepository`), 6 through a package dropped.
- jsoup 6 and Minestom 1 references through a package dropped
  (`java.util.regex.Matcher`, `java.lang.Class`, `java.util.Comparator`), all
  false before; okhttp and rocksdb's java/ unchanged by this class.
- C#: serilog, eShopOnWeb, modular-monolith and jellyfin identical to main.
  Controls flask and express identical.
- Seen outside this change: pascal-scope's classNamed keeps a depth-limited memo
  too, for a chain of 5 or more aliases; no fixture reached it, so it stays.
- CPU: with the Java overloads PR, which has the numbers. Resolution only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wn (colbymchenry#3189)

The value-reference pass links a symbol to the same-file constants its body
reads, and it matched identifiers by name alone: elasticsearch's
`RerankRequest.parseStringOrObject` passed for a reader of its own `PARSER`
because it reads `InferenceString.PARSER`.

The fix, in the wasm extractor (isForeignJavaField) and the kernel
(is_foreign_field) alike: an identifier that is the field of a `field_access`
counts only through `this` or through the class that declares the constant.

Validation:
- java-value-reads.test.ts: 1 of 2 cases fails on main without the kernel, all
  pass with and without it.
- Kernel parity, java: jsoup, Minestom and rocksdb's java/ 2,267 of 2,301 files
  byte-identical, 34 deferred to wasm, 0 with diffs; elasticsearch's action and
  cluster packages 1,269 of 1,270, spring-ai and kestra 5,488 of 5,489, 0 with
  diffs.
- A/B against main 4499d00: value references dropped, elasticsearch 226,
  Minestom 72, kestra 19, jsoup 1, spring-ai and okhttp 0. A check over each
  dropped edge's source finds no bare, `this.` or owner-qualified read of the
  constant in any of them (`LeafBucketCollector.NO_OP_COLLECTOR` passes for one
  by its suffix, 3 times: it is a read of another class).
- Kotlin and Swift have the same reader, and it matters little there (2 of 31
  and 3 of 496 on nowinandroid and okhttp), so they stay as they are.
- CPU: with the Java overloads PR, which has the numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bymchenry#3190)

Since 01e0ac3 a Kotlin receiver chain stops at a type the project
doesn't declare, and gets no edge: right for `Regex`, but nowinandroid's
`viewModel.uiState.value.shouldKeepSplashScreen()` goes through
`StateFlow<MainActivityUiState>`, whose `.value` is written in the
declaration. 1.6.2 linked it, by a name guess that happened to be right.

The fix: KOTLIN_VALUE_HOLDERS names the library types whose member is one of
their type arguments (`StateFlow`, `MutableStateFlow`, `State`, `MutableState`,
`LiveData`, `MutableLiveData`, `Lazy`, `Pair`, `Triple`), and the chain reads
on as that argument, from the declaration of the segment before it. Any other
library type still stops the chain, so no guess comes back.

Validation:
- kotlin-value-holder-chains.test.ts: 3 of 4 cases fail on main, all pass.
- A/B against main 4499d00: nowinandroid +1, the reported edge; mihon +2,
  `extensionManager.value` and `downloadManager.value` on `Lazy` properties;
  okhttp no call changed. Nothing lost. Controls flask and express identical.
- CPU, mihon, median of 3 interleaved: 20.02 to 19.86 s. Resolution only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…against (colbymchenry#3191)

A Kotlin Multiplatform `expect` and its `actual`s share one qualified name,
and a reference through an import took the nearest declaration, the `expect`
on a tie. That suits common code only. PR colbymchenry#3023 sent Java's calls through this
pick, so `Util.go()` from `app/src/main/java`, which 1.6.2 linked to the
`androidMain` `actual` by a name guess, reached the `commonMain` `expect`, and
so did `extends Timber.Tree`, which 1.6.2 left unresolved. An `expect` isn't in
JVM bytecode, so a Java caller can never reach one. Kotlin in `androidUnitTest`
or a plain Android module went the same way.

The fix: pickJvmDeclaration chooses by what the caller compiles against, for
the owner of an imported reference and for the import itself. Common source
sets (`commonMain`, `commonTest`, okhttp's `commonJvmAndroid`) keep the nearest
declaration. A platform's source sets take that platform's `actual`, so
`androidUnitTest` takes `androidMain`'s, or that of a target they build on
(`iosArm64Main` from `iosMain`), and otherwise the `expect`, as an intermediate
set like `nativeMain` sees. Java and a plain Kotlin module take a JVM target's
`actual`, never `iosMain`'s: the one their path names, else not Android's, so
okhttp's samples reach `jvmMain` and its `android-test` `androidMain`.

This reimplements the idea of PR colbymchenry#3136 by @johnhldiver-beep, who found the
cause. Beyond it: `commonTest` stays on the `expect` (that PR's check named
`commonMain` alone), `androidUnitTest` finds `androidMain`, Java never lands on
a native target's `actual`, and the import edge agrees with the calls.

Validation:
- kotlin-expect-actual-callers.test.ts, 10 cases built from the issue's repro
  and timber's and okhttp's shapes: 8 fail on main, all pass.
- 1.6.2 run first: the Java cases link the `actual` by a 0.65 guess, so this is
  a regression from colbymchenry#3023, as the issue says.
- A/B against main 4499d00: okhttp 9 imports and references move from the
  `expect` in `commonJvmAndroid` to the platform `actual`, each to the target
  its module builds for; nowinandroid, mihon and every Java repo unchanged,
  having no `expect`. Controls flask and express identical.
- CPU, mihon, median of 3 interleaved: 20.02 to 19.86 s. Resolution only.

Fixes colbymchenry#3033

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… scans (colbymchenry#3182)

Each resolver worker read the same whole-project facts for itself as it first
needed them: the namespace macros and aliases, and where every include resolves.
The main thread now reads them once and gives them to the workers as they start,
along with what it probed on disk. A worker that gets nothing reads for itself.

That reading is one synchronous stretch of the thread the liveness watchdog
watches (colbymchenry#1091), so it is bounded. Only a full index does it, whose parse has just
read every file: a sync may find them cold, at 5.7 ms a file on redis against 0.3.
And only up to 2,500 C and C++ files: 0.6 to 1.1 ms a file on rocksdb on a busy
machine, includes and all, so 3 s at worst. Past that, each worker reads for
itself off the main thread, as it always did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…usy (colbymchenry#3183)

The pool started 6 workers on any large project, though the main thread saves
every batch itself and keeps about 4 busy. A further worker mostly waited, having
cost a second or two of CPU to load and to compile the hot code in its own isolate,
a share of the others' cache hits, and a few hundred MB. That's a large part of why
rocksdb's CPU rose 31% for a wall rise of 8%: V8's background threads went from 12
to 25 s, mostly compiling, for more code in every isolate. The pool now takes at
most 4, and fewer when a run projects little work.

Workers 6 to 4, 2 rounds: rocksdb 125.9 to 107.3 s CPU, 2780 to 2425 MB, best wall
37.0 to 35.8 s; react 113.4 to 103.2; django 70.0 to 60.0; vscode-be 53.2 to 47.3,
wall 14.4 to 12.2. Dumps of the whole stack are byte-identical on 24 repos.

The rest of the waiting was the batch barrier: 10 chunks over a few workers, and
the next batch held until the slowest was done. Past the prerequisites no batch
makes an edge resolving reads, so the next one now queues behind it. A file's
chunks stay on one worker, which has its cached reads.

The WAL valve parks only at a pool-idle boundary, since a full backfill needs the
readers between statements, so it now waits for a batch with nothing queued ahead,
which the connection recycle guarantees every 8 batches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oesn't scan the project (colbymchenry#3192)

The first batch of a run resolved on the main thread while the workers booted. That
batch is the prerequisites, and in C++ the first qualified base class reads every
source file for the project's namespace aliases: one synchronous stretch on the
thread the liveness watchdog watches, 287 ms on rocksdb and 20 s or more on a project
the size of LLVM (colbymchenry#1091). 1.6.2 had no such scan on that path; it never shipped.

A run large enough to start the pool up front, 150k references or more, now waits
for it before the first batch. The wait is bounded at 30 s, and a failure ends it, so
a pool that doesn't come up leaves the run on its own thread, as it would be with no
pool. That needed one more fix: a worker that failed to open the index never failed
ready(), which nobody had waited on before. Any failure does now, and so does a worker
that exits before it's ready. A run under the bar starts nothing up front and doesn't
wait for a pool engaged mid-run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es a function (colbymchenry#3193)

Follow-up to colbymchenry#3187. A lambda or a method reference has no type of its own, so
the overload reader left it unread, and where overloads differ at that argument
the ranking's pick stood: Minestom's `.append(x, b -> …)` reached
`append(Argument, Execution)`, `item.withAmount(a -> a * 2)` reached
`withAmount(int)`, and `setDefaultValue(sender -> …)` the bare `T`.

The fix: javaArgumentType reads a lambda, with the count of its parameters, or
a method reference as a function value, and javaFunctionFit scores it against a
parameter. 1 for a JDK functional interface (java.util.function's, `Runnable`,
`Callable`, `Comparator`) whose method takes as many arguments as the lambda
has. 0 for what may be one: another interface, a library type, a type variable.
-1 for what can't take one: a primitive, `String`, `Object`, an array, a project
class or enum, and a JDK interface of another count. So `defaulted(s -> s)` is
the `Function` overload and `defaulted(() -> x)` the `Supplier` one. A string or
a number is no function for any JDK functional interface now, not only the ones
a lambda's parameter is read from. And a number may start at its point:
`spawnPos.sub(.5)` is `sub(double)`; `2d` is a double.

A project's own `@FunctionalInterface` isn't scored. I tried it: elasticsearch's
`parseList(parser, p -> …)` has a marked `CheckedBiFunction` in the index and its
`CheckedFunction` outside, and the marked one took 10 true calls to the wrong
overload. So two project interfaces tie, the ranking's pick stands, and Minestom's
`RegistryTaggedUnion(Registries::x, …)` stays open.

Validation:
- java-overload-arguments.test.ts: 5 of 27 cases fail on main, all pass.
- The 78 Java, JVM and resolution test files, 890 tests, pass. The change doesn't
  reach past Java: every new branch sits in the Java overload reader.
- A/B against main 1548371, calls moved: Minestom 27, spring-ai 137, kestra 45,
  elasticsearch 101. jsoup, rocksdb's java/ and okhttp unchanged, nothing added or
  lost anywhere. Controls serilog and flask identical.
- Read against source: all 27 on Minestom, and every group on spring-ai (14),
  kestra (5) and elasticsearch (37). True, except two classes that were false on
  main as well. spring-ai's 37 `SearchRequest.from(r).filterExpression("…")` sit on
  a wrong class before and after, and move between two of its overloads because
  a string is no `Supplier`. elasticsearch's 6 `stringListSetting(key, value -> …,
  Property.Dynamic)` move from `(String, Property...)` to `(String, List<String>,
  Property...)`, where `Validator` is right: `List` and `Validator` both may be
  functional, so the first of the count stands.
- The class colbymchenry#3187 left open, moved calls whose arguments don't settle the overload,
  recounted: jsoup 28 to 27, rocksdb 209 unchanged (no lambda among them), Minestom
  70 to 61, spring-ai 24 to 81. spring-ai rises because 57
  `FunctionToolCallback.builder("x", (City c) -> …)` calls now move to the right
  overload and stay open between `Function` and `Consumer`, each of one parameter.
  All calls left open, moved or not: jsoup 207 to 206, rocksdb 267 unchanged,
  Minestom 567 to 533, spring-ai 1,167 to 1,109.
- Read: all 61 left open on Minestom. 20 are on a wrong overload, all false on main
  too: 5 `RegistryTaggedUnion`, 4 `register(Key.key(…), …)`, 3 `allocateTrimmedPacket`
  with a `var` packet, 2 `Duration.of(…)`, 2 static-imported constants, 2
  `div(…get())`, 1 `setDefaultValue(Block.AIR)`, 1 on a wrong class.
- CPU, elasticsearch, median of 5 interleaved: 134.17 to 130.89 s, so no cost. Resolution only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot who asked first (colbymchenry#3194)

django's graph changed between runs of one build: 5 runs of main gave two hashes.
isPythonLocallyBound said whether a function had bound a name above the reference,
and kept that yes or no per function and name, so the first reference to ask
answered for all of them. `async_view = login_required(async_view)` hands on the
function, and the `async_view(request)` calls below read the local. When a call
asked first, the argument's edge was lost, and with a pool that depends on which
worker gets which chunk. 1.6.2 has the same memo.

It now keeps the line the binding starts at, and each reference compares its own.

That exposed a second fault the memo had hidden: a line inside a call could read as
an assignment. `Fan, through="Invitation"` matched as the tuple `Fan, through = ...`,
so every `Fan` below it looked local. Only a line that starts a statement can
assign now.

django: one hash over 7 runs on one thread, 2 workers and 4, against two for main.
+2 edges and none lost, both read: the argument of `x = wrap(x)` is the function
defined above it. flask, fastapi, requests and rocksdb are byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll sites (colbymchenry#3195)

`table.foreign_key` in rails' `ReferenceDefinition#add_to(table)` says
nothing of `table`, and a guess by the receiver's word took the class
called `Table`. 1.6.2 got this one right by a substring accident, through
a rule that also sent 429 `error.message` to `WrongEncodingError`. But
`add_to` has one caller, and it passes `self`.

A new pass, `parameter-flow.ts` with `ruby-parameter-flow.ts` as its one
adapter and `db/parameter-flow-queries.ts` for its SQL: a call on a
parameter of the calling method, when every call site in the project
passes a value of one known class, is a call on that class. It runs last,
on what resolution left, and moves only the calls a flow answers, so a
method no flow types stays exactly as it was. Any call site it can't type,
two that disagree, or anything in the project that could be a call the
graph never linked gives no answer.

An unseen caller is found by counting: the project's text may write the
name no more often than its declarations and recorded calls account for.
That catches send, public_send, method(:x), &:x, alias, delegate, a string,
and a call in a class body or a top-level block, which the graph records
nowhere. A call on an unknown receiver counts as a caller unless its
arguments can't fit the method: `part.add_to(buffer, hash)` isn't a call
of `add_to(table)`.

Where the class has no such method, the guess goes only on evidence that
it answers the call itself (attr_reader, attr_accessor) or that the class
is from outside the project. Dropping every such guess lost rubocop's
delegated `target_ruby_version`; keeping them all kept 5 false edges.

A pass over rails takes about 0.7 s, on a 5 s sync, so a sync doesn't run
one unless it has to. The pass leaves a record in one metadata key:
what every flow came to, the names each reads, and how often each file
writes the names the moved calls rest on. A sync reads what a changed file
declared and called before and after, and looks again at the methods of
those names and at the flows that read them. Anything it can't settle
from that goes to the pass over the project: a class, a constant or an
ancestor changing, `initialize` defined or undefined, a flow unlike its
record, a missing record, or a run that stopped short.

Validation: rails-src 4 moved, 16 added, 1 false guess gone; mastodon's
Ruby +1; rubocop +4; jekyll 4 false guesses gone; sinatra, gin and flask
identical. Every entry read against source: all right, no true edge lost.
A sync matches a pass over the project, edge by edge, across 790 steps of
randomized edits on rails, rubocop, mastodon's Ruby files, jekyll and
generated projects, and a fresh index across 12 real edits on rubocop and
jekyll. Pool matches sequential on 5 repos. No extraction change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m moves (colbymchenry#3214)

A resolver lives as long as its CodeGraph, so a server syncs on one for days.
Eight memos in name-matcher and three in frameworks outlived clearCaches, and
the Cargo crate map and compile database's include directories were read once
for the process, so an edit was resolved by what the file said before it.

The eight go in clearNameMatcherMemos, and the framework memos renew with the
node lists, whose identity changes with the caches. Cargo manifests and compile
databases join the module-config snapshot: a sync stats them, reads one only
when its stamp moved, and re-opens Rust or C and C++ imports when what
resolution reads from it did. A crate under a glob member is found when files
come or go. importMappingCache and the two clear functions no one called go.

A pool that fails while no one waits on it leaves no rejection: each worker's ready promise rejects when a start fails, and only ready() handled that, so a pool torn down mid-boot left an unhandled rejection when the timing gave it that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tten as its argument (colbymchenry#3196)

`Txn::PutEntity(…)` in `template <typename Txn> class SecondaryIndexMixin` names
a member of whatever class the template is given, so no lookup at the call can
answer it. 1.6.2 reached three such calls on rocksdb by name coincidence, and the
boundary fix that ended that rule left them failed. What decides the target is
written elsewhere, in `new SecondaryIndexMixin<WriteCommittedTxn>(…)`, and with
several instantiations each really runs its own, so every class gets an edge.

A new pass, cppTemplateEdges, reads the failed references that go through a
template parameter: `T::x`, `T::T/2`, what `T x;` constructs, an alias of a member
of the parameter, and a call on a value of its type. It finds what the template
is written with: base clauses, variables, members, `new`, aliases, explicit
instantiations, `f<Foo>()`, deduced `f(x)` where the argument's type is known
exactly, gtest's type lists, and arguments that are another template's parameter,
four templates at most. An argument is a project class by the lookup a declared
type gets, a class local to the function first, in a file that sees it; anything
else gives no edge and takes nothing from the rest. A specialization takes its
instantiations from the template. A parameter that reaches more than 40 classes
gets no edges, nor does one whose walk reaches a template written in more than
1,024 files or called more than 1,024 times, decided before any of them is read.

The hop names the argument, the parameter and where it's written, in explore's
Flow and the node trail. The pass walks every C and C++ file once, through
ResolutionContext.scanFile (readSourceText's checks, latin1, no content cache),
takes the namespace aliases from that walk, and reads includes from the graph's
include edges in one query.

Validation against main: all three rocksdb entries reached. The template tests
are 125, 93 of them red with the pass off; the new guards each go red when undone.
Added edges: rocksdb 347, abseil 1,013, protobuf 969, folly 1,978, json 479, fmt
254, googletest 114, leveldb 3, gin and flask 0. Nodes, unresolved refs and every
other edge are identical on all ten repos, with column and metadata. Pool,
sequential and repeat runs give the same edges in the same order, and sync matches
a fresh index on rocksdb, abseil and fmt. rocksdb index, 10 interleaved rounds:
CPU +0.6% mean (+0.4% median), peak RSS -0.5%, wall -0.2%. A median-file sync on
rocksdb takes 6.63 s against main's 5.76 and 1.6.2's 8.41. On a generated project
of 20,222 files the pass takes 2.4 s with the site cap and 1,030 s without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
colbymchenry#3215)

Three walks stopped after a few steps and kept what they had: asked from the
top of a chain of type aliases or Lua re-exports, the walk stopped short and
stored a null for the middle of the chain, which the next asker took. The
TypeScript and Lua walks have one successor at each step, so they now follow a
chain to its end, with a visited set to end a cycle. Pascal's can branch, an
alias declared in each arm of an {$IFDEF}, so it walks with a seen set and
keeps only the answer for where it started.

cMacroRename's index grew as source files asked, so a rename in a file another
includes counted only once that file had asked, per worker. Sources something
includes now go in the index up front within the budget, the index is fixed
once built, and any other source's renames count for itself alone.

A config name that isn't a regular file now counts as absent and is never read:
a FIFO would park readFileSync, and colbymchenry#3214 took that to manifests and databases.

Taking the depth caps off the alias walks took their stack guard with them: a
generated chain of 20,000 TypeScript aliases ran the stack out at about 3,780
steps, and the whole index failed. Lua overflowed between 1,500 and 2,000
modules, Pascal between 2,000 and 5,000 aliases.

An alias names one thing, so the TypeScript walk is now a loop that collects
the chain's keys, stops on a memo hit, a repeat or the end, and stores the one
answer for every key it passed. Lua's walk is a loop over steps: a module
re-exporting a member hands back the module to go to next instead of calling
into it. Pascal's walk can branch, so it keeps its recursion within a bound of
1,000 steps, well past any real chain: it reads no memo, so where it stops
depends on where it started alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the base from upstream d2e0389 to 329dd12 (main, 2026-11-15, 21
commits), for Java overload and inheritance resolution. No conflicts;
all five patches merge back unchanged. FORK.md records the new base.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T06:49:31.390940Z
We couldn’t complete this review. Comment @codex review to try again.
0232fec PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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