Repository navigation
Reach MVP: precision and soundness fixes of the link step and the reach query - #60
Conversation
… files (FOU-576) The JavaScript language read .js, .mjs and .cjs files only. A React project of .jsx files gave no file to the index, so vet marked its npm packages unknown with no source files. The script blocks of .vue, .svelte and .astro files hold imports too, and the index missed them. The JavaScript language now lists .jsx, .vue, .svelte and .astro. Its grammar parses JSX. .tsx files already parse with the TSX grammar. A new optional interface, core.SourceSelector, picks the language of a file from its bytes. The JavaScript language implements it for the component files. It replaces each byte outside the script blocks with a space and keeps the line ends. Each import and call then keeps its line and column in the file. A block with lang="ts" or lang="typescript" makes the file TypeScript, and lang="tsx" makes it TSX. Astro reads the code between the two --- lines at the top, and every script, as TypeScript. A block with a src attribute holds no code. A block that does not close runs to the end of the file. The parser parses the source that the selector gives, and the tree keeps the bytes of the file, so the index keeps the hash of the file. The indexer picks the language before it makes the store key, so the key and the index agree and a warm run serves a TypeScript component file from the store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…ds (FOU-575) When the parse of a batch returned the error of the context, run.flush skipped Store.Put and Store.PutArtifacts for the whole batch. The files that finished before the deadline were lost too. A scan with the same time budget parsed the same partial batch again and never warmed the store past it. flush now stores the indexes and the artifacts of the files that finished, and then returns the error of the context. The store write ignores the end of the context, because a done context fails the write. A file that the deadline cut keeps no index and no artifact. A cut index has a deadline truncation and fails its file, as before. Two paths could still give a partial result as whole, so the change closes them: - skeletonIndex returned the skeleton index of a generated Go table with a deadline truncation and no error. It now fails the file, as the index plugin does. - A cached plugin can stop at the end of the context and return a partial artifact with no error. The run now stores an artifact only when the context is still live after the plugin returns. The next run parses that file again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…e (FOU-561) The method measure gave the Go modules of each project as units, but not the standard library. So a receiver of a standard library type had no known type, and a call on it was an unknown-receiver record. vet passes GOROOT as a unit, so the measure did not show what vet gives. scripts/fetch_method_corpus.sh now reads the go line of the go.mod of each Go project, fetches the src tree of that Go release from go.dev, and records the release in gostd/releases.txt. The measure links the tree as the unit go:std@<release>. PROJECTGRAPH_METHOD_NO_STD=1 leaves the unit out, so a run shows its effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…t govulncheck (FOU-563) The method measure counted the answers of reach, but nothing checked that a not-found answer is true. A false not-found hides a real vulnerability. With govulncheck v1.9.0 on the PATH, the measure now writes the Go advisories of advisories.json as a local vulnerability database, and runs govulncheck -mode source -json on a copy of each Go project with GOPROXY=off. The fetch script fills the module cache of the corpus with the build list of each Go project, so the run needs no network. The measure compares the answer of each target with the symbols that govulncheck reaches. A target that govulncheck reaches and that reach gives as not-found or no-such-target is a false negative, and the test fails. A target that reach finds and govulncheck does not is a review row. A listed symbol that govulncheck reaches and that is no target is an unmatched row, so a key that the two tools write in two ways cannot hide a false negative. TestVulnAgreement checks the comparison on fixed answers, and the CI job of the public sets runs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…-call record (FOU-556) The Rust link step guessed a ? from a table of the methods of Option and Result. A name that the table did not hold took the type inside, so dep::try_thing().inspect(..) made an edge to Thing::inspect. The check also matched the whole path of the wrapper, so std::io::Result<T> and anyhow::Result<T> wrapped nothing. The Rust index now records each ? in the receiver of a method call as the name ? in the target, as dep//load//?//run for dep::load()?.run() and for t.run() after let t = dep::load()?. The walk of the link step reads ?, unwrap and expect as the value inside, and any other name on a wrapped result as a method of the wrapper, with no type. The table is gone. A wrapper type matches by the last name of its path. A call on the result of a call whose package no unit gives is a no-dependency-source record. The record also came for the builtins of a language, as Promise.resolve().then. The runtime calls other code only through a value that the call passes, and a reference edge holds it. So the record now skips the builtins of the language. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The reach query answered not-found for dep::Html::write when main called w.write() on a Box<dyn dep::Write> that held a dep::Html. The call graph took Box::new as a constructor method of Box. So w became an instance of Box, and the call linked to Box//write with high confidence and no record. The declared type of the let never reached the link step, because the index typed a Rust receiver only from a parameter. The call graph now takes the value of Box::new, Rc::new and Arc::new as the value of a call, as these pointers hold their argument. A call on such a value keeps an unknown-receiver record. The index of a Rust file now gives such a call the key of the name in its scope when a parameter or a typed let declares the name. The link step then reads the trait of the unit and adds a cha edge to each impl of the method. A value that the call graph makes, as String::new(), keeps its target. The declared type types the call only when the function binds the name once, before the call. A let, a match arm, an if let, a for or a closure can bind the name again with another type. Without that check, a call on the new value took the method of the old type and lost its record, and the case trait-object-shadowed read dep::Plain::write as not-found. The cases trait-object, glob-use and macro-import copy the cases of the vet reach corpus. trait-object is now found. glob-use and macro-import stay uncertain with an unresolved-call at the call site, as before. Method measure, PROJECTGRAPH_METHOD_LANGUAGES=rust, before and after: function targets=13 found=1 found/low=3 uncertain/no-definition=9 method targets=38 found/low=16 uncertain/budget=9 uncertain/no-definition=13 other targets=5 no-such-target=5 The corpus has no call on a boxed trait object on a target path, so no count changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…eck agreement (FOU-561, FOU-563) The report gives the Go rows of the method measure with and without the unit go:std@<release>, the top sites of the targets that stay unknown-receiver, and the agreement of each Go target with govulncheck in each direction. The run gives 0 false negatives, because reach gives no Go target as not-found or no-such-target yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
linkFields cleared the method name of a site with more than 20 name
candidates. The reach query scopes a record by its method name, and a
record with no method name concerns every target. So one ambiguous call,
as x.Len(), made every target of the project uncertain.
An ambiguous call can run only a method of its name. The site now keeps
the method name, so the reach query applies it to the targets with that
last segment and to the targets that a definition of the name reaches.
The name-ambiguous case adds a function of another name that no root
calls. Its target is now not-found and was uncertain before the change.
The Go method measure (PROJECTGRAPH_METHOD_LANGUAGES=go) gives:
kind=method before: ambiguous=416 computed-name=213 no-definition=71
unknown-receiver=154 no-such-target=0
kind=method after: ambiguous=0 computed-name=579 no-definition=110
unknown-receiver=156 no-such-target=9
kind=function before: ambiguous=106 computed-name=50 no-definition=5
kind=function after: ambiguous=0 computed-name=139 no-definition=21
no-such-target=1
No target carries an ambiguous site any more. The targets fall to the
next uncertainty that concerns every target, mostly computed-name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
The Go index recorded functions, methods and types, but not struct
fields, constants or package variables. A read of n.Data or
pgx.ErrNoRows in dependency code walked into the unit, found no
definition and gave a no-definition record on the external node. That
record made every target of the unit uncertain. A read of a field or a
constant runs no code.
The index now records each named struct field as a field, each constant
as a constant and each package variable as a variable. A variable holds
the target of a value that names a function, as run in var Run = run.
The index marks a variable as data when its declared type or its value
shows that it is no function. The link step gives a field, a constant
and a data variable no node. A read of one gives no edge and no record.
A call of any other variable keeps its edge or its unknown-receiver
record, so a call of var Handler = func() {...} stays uncertain.
A method that an embedded interface declares, as ssh.Client.Close
through ssh.Conn, now resolves as a call on a value of the interface. The
walk of an external key into a unit that ends at a method of an interface
gives an interface-receiver record.
The case go/dependency-data-reads covers a field, a constant, a data
variable, a function value in a variable, a promoted method of an
embedded struct and of an embedded interface.
Method measure, Go only, against main:
no-definition: function 5 -> 0, method 71 -> 19
not-found: 0 -> 19, all in melody. Its constant reads hid a gap of the
missing GOROOT unit (FOU-561), as ioutil.ReadAll calls messageReader.Read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
A Go type alias, as type Context = context.Context in golang.org/x/net/context, names its target type as a base. The link step did not resolve that base, so a call of netctx.Context.Done gave a no-definition record. The scope bound the name of an import only when the alias differed from the module. A Go import of context, io or sync has the alias context, io or sync, so it bound no name, and no declared type, embedded type or alias of such a package resolved. The Go profile now binds the alias of every import. The alias base gives the external key context//Context, and a unit of the standard library gives it on. The case go/dependency-data-reads gains the alias. This change also resolves each declared type of a package with a one element path, as io.Reader or context.Context. Without a GOROOT unit such a type is an external key with no package edge, as net/http types already were, so a call on it gives no record. Method measure, Go only, against main: no-definition: function 5 -> 0, method 71 -> 16 not-found: function 0 -> 58, method 0 -> 215 ambiguous: function 106 -> 32, method 416 -> 154 The not-found answers need the GOROOT unit of FOU-561 and the check of FOU-563 before vet trusts them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…-560)
A call of a function value, as BackoffLinearWithJitter(d, j)(attempt) or
route.Handlers[0](c), was a computed-name record. Such a record concerns
every target, so one site made most targets of a project uncertain.
A Go function value is a function that some code uses as a value, a
function literal, or a value that reflection gives. The link step now
gives such a call the reason function-value, and the reach query applies
it to no target. The soundness argument is in docs/projectgraph.md. The
change makes each source of a function value reach the search:
- The index records a function that a send statement holds as a
reference.
- A reference to a method that the link step cannot name, as h.Handle on
a value of an interface, is a record with the method name. Before, the
link step dropped it.
- A Go file that imports a package that runs code at load runs code at
load too, also when the package is in a unit of dependency code. Before,
the search did not reach the init functions and the package-level values
of a unit that the project imports through another unit.
- An external key has an import edge to each module top level of its
package that runs code at load, so the search of a summary reaches the
package-level values.
- A call or a reference of Call, CallSlice, Method or MethodByName in a
file that imports reflect is a computed-name record, unless each target
resolves outside package reflect. Before, reflect.Value.Call concerned
no target at all.
The Rust index does not record a function that the tail expression of a
block or a match arm holds, so a Rust call of a function value stays a
computed-name record.
The new cases function-value-call, function-value-reflect and
dependency-function-table fail before the change. The reflect case gave
not-found before.
The Go method measure (PROJECTGRAPH_METHOD_LANGUAGES=go), after FOU-557
and after this change:
kind=method computed-name 579 -> 2, no-definition 110 -> 509,
unknown-receiver 156 -> 183, no-such-target 9 -> 144,
found 82 -> 78, found/low 249 -> 267, not-found 0 -> 0
kind=function computed-name 139 -> 6, no-definition 21 -> 115,
no-such-target 1 -> 19, not-found 0 -> 0
Four sftp targets go from found to found/low, because a shorter path now
goes through a reference of a package-level value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
…d cases (FOU-559) FOU-559 asks to scope a failed or truncated file of a unit, and a record with no method name in the code of a unit, by the code that the unit reaches (unitReaches). This commit does not make that change, because the argument does not hold: - A failed file has no index, so its imports are not known. The closure of the edges of the unit, and the import closure of its packages, read the same indexed files, so neither bounds the packages that the failed file can call. Only the manifest of the unit bounds them, and the link step does not record it. - The project can give the unit a value of an interface. Unknown code of the unit can call a method of that value, and the method can call any code. Known code of the unit records such a call with its method name, which concerns every target of the name. Unknown code can hold such a call for any name. docs/projectgraph.md now holds the argument. Two cases guard the rules: - go/dependency-callback: the project gives the unit a named function, a function literal, a value of an interface and a method value of an interface. Each target that a callback reaches is found or uncertain. The case fails on the code before FOU-560: fs[0]() was a computed-name record then, and the method value c.Close had no record. - go/dependency-failed-callback: a failed file of a unit calls a method of a value that the project gives. The target stays uncertain only through the budget of the failed file, so a scope by the unit would make it not-found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
# Conflicts: # projectgraph/golang.go # projectgraph/resolve.go
…FOU-560 The two changes meet in two cases. FOU-558 indexes package variables, so node.go of dependency-data-reads runs code at load (errors.New). The load rule of FOU-560 then adds an import edge from each external key of the package to node.go, and the summaries of the unit reach errors.New and the calls in the func literal of Handler. The literal does not run at load, so this reach is wider than the truth. It can add a reach and never hide one. FOU-558 binds an import with one path element, as reflect. A chained call on reflect.ValueOf then has a callee package with no unit, so its record reads no-dependency-source in place of unknown-receiver. The record stays, and the computed-name records of the reflect rule stay too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…e aliases (FOU-562)
Four forms of Rust module paths gave a global no-definition record, so
every target of the project was uncertain: extern crate in a submodule,
a path through a crate that is not a unit, pub use of a whole crate
under a name, and a type alias.
extern crate x, extern crate x as y, use x and pub use x as y now bind the
name in their module to the crate. A path through that binding is a path
of the crate, as rand::thread_rng for crate::secure::rand::thread_rng.
A call gets the external key that a plain path of the crate gets. A use
of such a path into a crate that no unit gives is a no-dependency-source
record with the crate as its import prefix, so only a target of that
crate sees it. The route reads each binding of a name in the file,
because an inline test module can bind the name again. A first name
that names no module that the file sees names a crate, also when a file
of the project has the name, as extern crate schannel in
src/imp/schannel.rs. The route of an outer lookup stays for the build,
because each walk asks for the route of each glob use again.
The Rust index records type A = B as a definition of the kind alias, with
B in the new field Alias. The link step binds the alias to the type that
the file of the alias names when a walk first reads it. A type of another
crate is its external key with no node, so a type target does not turn
from no-such-target into not-found.
Rust method measure, before and after this branch (FOU-556 and FOU-562):
function (13): found 1, found/low 3, no-definition 9
-> found 2, found/low 2, ambiguous 2, no-definition 1,
unknown-receiver 6
method (38): found/low 16, budget 9, no-definition 13
-> found/low 16, ambiguous 4, budget 9, no-definition 1,
unknown-receiver 8
other (5): no-such-target 5 -> no-such-target 5
Cookie finds rand::thread_rng through crate::secure::rand::thread_rng()
at src/secure/key.rs:164 with a high hop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
# Conflicts: # docs/projectgraph.md # fileindex/index.go # plugin/indexer/calls.go # plugin/indexer/rust.go
…ternal key (FOU-563) The link step gave no external key to a definition of a package under an internal directory of a unit, because no importer outside the module can name it. An advisory names a symbol of such a package by its import path, as google.golang.org/grpc/internal/transport.NewServerTransport. A target of that key matched no definition, so reach could not find it, and the answer was no-such-target. The method measure without a unit of the standard library gave this answer for three grpc targets that govulncheck reaches in grpc-middleware. goImportPath now gives the path of an internal package. A main package still gets none, because no program imports it. The surface of a unit, which a summary reads, still leaves out an internal package. FOU-560 exposed the defect. Before it, the computed-name record of a call of a function value in retry/options.go made every target uncertain. The case go/dependency-internal-package fails without the change: each of its three targets is no-such-target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…k into it (FOU-563) A Go call of an external key whose package no unit gives runs code that the graph does not hold. That code can call back into the graph, and no edge showed it. gorilla/websocket passes its reader to io.ReadAll, and io.ReadAll calls Read of the reader. With no unit of the standard library, as vet links a project, the search stopped at io//ReadAll, and messageReader.Read and flateReadWrapper.Read of melody were not-found, which govulncheck reaches. Before FOU-558 (b9adbc6), the no-definition records of the constant reads TextMessage and BinaryMessage made every target of the unit uncertain and hid the gap. The link step now gives each such key a record with the reason no-dependency-source: - A key of the standard library gets a callback record. The standard library imports no package outside it, so it calls into the graph only through a function value, which a reference edge already joins, or through a method of an exported name of a value that it holds. The record concerns the targets that a Go method of an exported name reaches. The reach query counts it once per search, and a summary keeps one entry for it. - A key of another module, and a key of C, gets a record that concerns every target. A summary links one unit alone, so it gets no record for another module. - The builtin panic gets a record for the methods Error and String, which the runtime calls to print the value. docs/projectgraph.md gives the argument and the gaps that stay. The new cases stdlib-callback, stdlib-callback-scope, dependency-no-unit and panic-value fail before the change: each target that the change makes uncertain was not-found. stdlib-callback-scope keeps three targets not-found that no method of an exported name reaches. Method measure, Go only, govulncheck agreement: no std unit: false-negative 5 -> 0 (with the internal key fix) not-found: function 69 -> 8, method 302 -> 1 no-such-target: function 19 -> 1, method 155 -> 10 uncertain/no-dependency-source: function 2 -> 113, method 7 -> 571 govulncheck-not-reached answered not-found 540 -> 20 std unit: false-negative 0 -> 0, not-found 0 -> 0 The callback alone gives not-found 540 -> 233 for the targets that govulncheck does not reach. The records of other modules give the rest, because the corpus gives no unit for most modules of a project, as golang.org/x/sys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The fixes of this branch change the index, the graph, the reach results and the summaries. A store must not serve data of the old rules, and the version tests need one row per version. So this commit bumps each version once for the whole branch: fileindex.Version 16, projectgraph.Version 18, reach.Version 5 and summary.Version 3. It adds the hash rows and the version fields of the test data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…in (FOU-556) The record of a call on a call result skipped the builtins of the language. The skip assumed that runtime code calls back only through a value that the call passes. Some builtins give back a value that the call passes, or an element of it: new(thing) in Go, max(t, t) and next(iter(ts)) in Python, Object.assign(p, o) in JavaScript. The method then runs on a value of the project or of a dependency. With no record, a target of that method was no-such-target, and a target that the method reaches was not-found. The record now comes for a builtin too. In Go, the name edges of the site come back too, because linkFields makes them from the method-named record. So new(thing).vuln() finds what thing.vuln calls again. The FOU-556 item "Promise.resolve().then gives no no-dependency-source record" goes. The case references-argument has the record again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The indexer picked the language of a component file from its bytes to make the store key. The parse then picked the language and the code again from the same bytes, so each component file got two passes. The indexer also set the language of each file twice. core.SourceSelector now returns a core.Source, which holds the language and the code. The indexer keeps the source in the pending file and gives it to the new parser.ParseSource, so the parse does not pick it again. ParseContent and Parse pick the source and call ParseSource. The indexer sets the language of a file once: from the extension when the read fails, and from the source after the read. A Go file that the indexer excludes after the read gets no language, as the doc of Result.Languages says. The scan of a component file returns its script element as a struct, and it uses strings.ToLower and isSpace where it repeated them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The index read the script blocks of a .vue, .svelte or .astro file and nothing else. Before FOU-576 an import of such a file was a no-definition record, so each target was uncertain. After it, the import resolved, but the markup of the file stayed unread. A function that only the markup calls, as danger in @click="danger(item)", or as a handler that the markup names, had no caller. A method of a Vue options object, which Vue calls, had none too. So such a target read not-found or no-such-target. A <script src> element also gave no edge to the file that it loads. core.Source now holds the markup of a component file: the offset of its first byte that is no space, and each script element with a src attribute. The parse keeps the markup on the tree, and the index reads it through core.MarkupTree. Each such script element is an import of its file. The rest of the markup is one record with the new reason markup at the top level of the file. The record has no method name, so it concerns every target of a search that reaches the file. docs/projectgraph.md argues why no narrower scope is sound. A file with no template gets the record too, because Vue calls the hooks of its options object. A case for each form of the review guards the fix: template calls, a Svelte event handler, an Astro expression, a script setup handler, the options API with and without a template, and a script src. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
A JSX element renders the component that its name holds, as Child in
<Child />. The index gave the name no reference, so a component that only
an element renders had no caller. A target that only such a component
calls read not-found. FOU-576 made the index read .jsx files, and .tsx
files had the same gap before.
The name of a JSX opening or self-closing element and the value of a JSX
expression are now references, as an argument is. So <Child />,
<table.Row /> and onClick={handle} give a reference edge. A lower case
name, as div, is a tag of the host, which JSX gives as a string. It gives
no reference, also when an import binds the same name.
The index also dropped each name in an export statement, to keep the
exported name of export default parse from being a reference. That rule
dropped each reference in the body of an exported function too, as
export default function App() { return <Child /> }. It now drops only a
name at the top level of the file.
The cases javascript/jsx-elements and typescript/tsx-elements guard each
form and the lower case tag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
…e (FOU-562) A use path can start with a name that another use of the module binds, as helpers::run after use crate::deep::helpers. The walk read the binding of helpers, but the walk of a module binding with no names after it ended on a unit, and a walk that ends on a unit fails. So the path read as the crate helpers, the call got the edge helpers//run, and what run calls was not-found. unitMember now gives the unit of such a binding. A path through a use of a module of another crate, as sub::f after use dep::sub, also read as the crate sub. The crate route now reads the uses of the module of the file too. A use that binds its own path, as use rand or use smallvec::smallvec, routes nothing, because Rust never reads the binding of a use in its own path. A use that a route names can bind an item, as fl of use crate::ffi::flush as fl after pub use dep as ffi. A call of fl linked the routed key, which had no node, so the edge reached nothing and the target was not-found. The resolver now makes the node of a routed key, as it does for a key of a use with no route. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…e (C1, FOU-560)
A Go function-value record concerned no target in every search. The
rule holds only when the search reaches each code that can store a
function value. A search from the roots that the rules mark does. A
search with a source does not, in either source mode. The program can run
code before the source that no root reaches, as the init of a package
that only main imports and that fills a registry, or a setup that main
calls before serve. The load step enters only the load code of the
packages that the search reaches, so it does not find that code. So
registry.D2 with handlers["rm"]("x") and serve with fs[0]("x") gave
os//Remove not-found from a source, where main gave uncertain.
A search whose roots hold a root of kind query now counts a
function-value record for every target, as a computed-name record does.
A summary counts it for every target too. A search of any kind reads a
summary, and the value can come from the project, from another unit, or
from a package of the unit that the symbol does not import. summarytest
now checks a summary against a search from the symbol as a root of kind
query, which has the same rule.
The load step stays. It finds a call in the load code of the package of
a source, and a value that the load code stores in an attribute, as
python/source-module-load shows.
The case go/source-function-value holds both inputs of the review. It
gave not-found for four results before the change. The summaries of
go/dependency-callback and go/dependency-function-table now hold their
function-value records. The source Run of go/source-package-load gives
os.RemoveAll uncertain, because Run calls steps[0]. A search from the
roots keeps the rule, so the method measure does not move.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
…re a call runs a method (C3, FOU-557) An ambiguous site kept its method name in every language, and the reach query counted only what the candidates of the name reach. A Python call of a name can run code that no definition of the name holds: an object with __call__ in a class attribute, a value that __getattr__ gives, a function that a module binds by an import, or code of a module that no unit gives. So os.remove read as not-found or no-such-target, where main gave uncertain. A Rust call of a parameter, as handle(s), can run a function value that the Rust index does not record, as the tail expression of a function. It read as not-found too. The profile now decides. A Go site keeps the name, because a Go call of a name runs a method of the name or a function value, and a reference edge leads to each function value. A Rust call on a receiver keeps the name, because a Rust field that holds a function needs the form (x.f)(). Every other site, and every site of Python, JavaScript, TypeScript, Ruby and PHP, concerns every target, as on main. A Go call of a field of a function type can run a value that code before a source stores. So a search with a source, and a summary, count an ambiguous site for every target, as they count a function-value record. The cases python/name-ambiguous-callable, -getattr, -module and -nounit hold the review inputs, and rust/name-ambiguous-param holds the Rust form. Each gave not-found or no-such-target before the change. go/name-ambiguous gave os.Chdir and os.Remove not-found from the source serve before the change. It and rust/name-ambiguous-method guard the precision of a search from the roots: a target that only uncalled code reaches stays not-found. python/name-ambiguous, python/name-ambiguous-record and javascript/field-ambiguous move back to the answers of main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The fixes of the second review change graphs, results and summaries of the cases. The rows of the versions of this branch take the new hashes in place, because no release holds these versions yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The fixes of the second review move the cause labels of some uncertain answers. An ambiguous site of Python concerns every target again, as on main. The found counts and the agreement with govulncheck do not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
|
This pull request exceeds GitHub's diff limits and cannot be scanned. GitHub Limits:
Recommendations:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedToo many files! This PR contains 523 files, which is 423 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files.
|
vet Summary ReportThis report is generated by vet Policy Checks
Malicious Package AnalysisPackages were checked against SafeDep's known malicious packages database Malicious Package Analysis Report
Changed PackagesChanged Packages
|
|
The SafeDep supply chain scan fails because the diff is over the limit of GitHub (459 files). It does not report a finding. This PR changes no dependency: CodeRabbit skipped the review for the same reason. The PR description lists the reviews that ran on the branch before it was opened. Generated by Claude Code |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
- Coverage 77.18% 76.64% -0.55%
==========================================
Files 180 186 +6
Lines 18163 19449 +1286
==========================================
+ Hits 14019 14906 +887
- Misses 3300 3654 +354
- Partials 844 889 +45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f6516eb8a
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…557) A Rust call of into runs the from of an impl of From. The link step adds name edges to the from candidates of the project. But the record of the site keeps only the method name into. When the site has more than 20 candidates, it is ambiguous and gets no edge. Then the reach query starts the scope only from the definitions of into, and a target that one from reaches reads as not-found. The same holds for a from of a dependency, which is never a candidate. The span of a method scope now enters the scope of each alias of the name, as the profiles give them. MethodAliases takes the aliases of every language, because the reach query does not read the language of a site. The cases rust/into-ambiguous and rust/into-dependency fail without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The index dropped a reference to a predeclared name, as clear, unless
the file itself declared the name. A declaration of another file of
the package shadows the name in every file of the package. So
[]func(){clear} in main.go gave no reference to the clear of other.go.
The call of the element is a function-value record, which concerns no
target in a search from the roots, and the target of clear read as
not-found.
goName now keeps a predeclared name as a name. The link step resolves
it in the package, or drops it when no declaration binds it, as it
does for other names that the file does not bind. The case
go/predeclared-shadow fails without the change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
A Go program can load a plugin with plugin.Open, get a function of it with Lookup, and call it as sym.(func())(). The plugin is code of another build, so no reference edge names that function. The call is a function-value record, which concerns no target in a search from the roots. So a target that only the plugin calls read as not-found, and a target that no code of the graph names read as no-such-target. A unit of the standard library does not help, because its plugin code fills the symbols from code of another build. The reflection rule of the Go profile now holds a list of packages. A call or a reference of Open or Lookup in a file that imports plugin gets a computed-name record, as Call or MethodByName in a file that imports reflect does. docs/projectgraph.md argues why no other package of the standard library gives a function that no reference names. The cases go/plugin-lookup and go/plugin-lookup-std fail without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The fixes of the Codex review add cases, references of predeclared Go names and plugin records. The rows of the versions of this branch take the new hashes in place, because no release holds these versions yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06577dadbc
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The index records the typed locals of a Go function with no extent. So a
typed local of a closed block hid a package function with the same name.
In `{ var helper T; _ = helper }; fs := []func(){helper}`, the index gave
no reference to the function helper of another file. The call fs[0]() is a
function-value record that concerns no target in a search from the roots.
So a dependency that only helper calls read not-found.
goReference now skips a typed name only when goLocal finds the declaration
in scope at the node. goName keeps the raw name of a typed local that is
out of scope, and the link step resolves it in the package or drops it.
The case go/typed-local-block fails without the fix. Its typed local
cleanup is in scope, so it guards that a typed value still gives no
reference.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c642d32edb
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ction value
The link step skipped a call that resolved to a definition of data, as a
field or a variable. In Go such a call runs the function value that the
field or the variable holds, as s.cfg.Remove("x") for a field of a
function type. No edge names that function. A search from the roots
reaches the code that stores the value, but a search from a source does
not. From run alone, os.Remove read not-found, where main gave uncertain.
A call of data in a language with function values now gets a record with
the reason function-value. A search from the roots lets it concern no
target, so its answers do not change. A search from a source lets it
concern every target. The case go/source-field-func fails without the
fix. Four cases and the summary of dependency-generated-table gain the
record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
…he same name A file declares Client as a struct under one cfg and as a type alias under the other cfg. The index lets the alias replace the definition of the struct. A call of send on a parameter of the type Client then gets only the edge to the method of the type that the alias names. So std::fs::remove_file, which the send of the struct calls, reads not-found. origin/main gives found. The case expects found, so it fails on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
App spreads an object of handlers into a button, as
<button {...handlers}>. The index reads no value of a spread attribute,
so the function onClick of the object gets no reference and no record,
and plug.danger reads not-found. origin/main does not read .jsx files.
Its record of the import of ./App.jsx concerns every target, so it gives
uncertain.
The case expects found, so it fails on this branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
…o scope worker.rs has use super::*, and go calls helpers::cleanup of the sibling module helpers. The link step does not resolve a module through a glob use. origin/main reads helpers as a possible module of the project, because a file has that name, and records the call with the reason no-definition, so std::fs::remove_file is uncertain. This branch reads helpers as another crate, because it is no child module and no module of the root. The call gets the key helpers//cleanup and no record, so std::fs::remove_file reads not-found. The case expects found, so it fails on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
…ation (FOU-562) A scope can declare one name more than once under cfg attributes, as a struct and an alias, or two aliases of other types. The index holds one definition per key. So the last alias replaced the struct or the other alias, and the link step sent each walk through that alias. A call then got only the method of one declaration. A target that only the other declaration calls read not-found. The case alias-cfg-struct showed this for std::fs::remove_file. The index does not know which cfg the build sets. Now an alias with another meaning in its scope names no type. A typed call through the name gets the record unknown-receiver, and the name edges reach the method of each declaration. The methods of the struct stay under the key of the alias. So the link step also gives the record for a path to one of them, as Client::new, and not a single edge to the method of the struct. An alias that the scope declares once, or two aliases of one type, still bind the type, as FOU-562 asks. The case alias-cfg-struct now also checks a target that only the type of the alias calls through Client::new. The new case alias-cfg-two checks two aliases with a path call and a typed call. Both cases read not-found before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The index dropped the value of a spread attribute, as {...handlers} in
<button {...handlers}>. jsx_expression is a holder, but its value is a
spread_element, and reference gives no target for it. The visitor thus
added no reference and no record. React makes each property of the
object a prop of the element and can call each function of it. Since
the index parses .jsx files, a function that only such a spread passes
read not-found. The case javascript/jsx-spread-attributes shows it.
Now the visitor reads the operand of a spread in a JSX expression. When
the operand names a definition of the file, the element gets a reference
to each function and method that the definition holds, as the member
reference handlers.onClick does. The index cannot name the functions of
any other object, as a parameter, the result of a call or an import. So
such a spread gets a computed-name record, which concerns every target.
That answer is uncertain, never not-found. The new case
javascript/jsx-spread-unknown-object guards it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
A Rust path can start with a name that a glob use brings into the module, as helpers::cleanup after use super::* in src/deep/worker.rs. The link step did not read glob uses for the first name of a path. The path went to the external key helpers//cleanup as a path of another crate. rustLocalRoot saw no child module and no module of the root with the name, so FirstPartyFrom gave no record for the use of the path. The target std::fs::remove_file under cleanup read not-found. origin/main gave uncertain, because FirstParty took any file of the name as first party. rustScopePaths now adds the path under the module of each glob use of the file to the candidates of rustPaths. It puts them after the child item and before a crate of the project, as Rust reads them. resolveRust and rustModuleUnit read these candidates. So the call resolves to src/deep/helpers.rs//cleanup, and rustLocalRoot sees the module when the walk under it fails, which keeps the no-definition record. A first name that a glob use brings as a module thus never reads as another crate. A glob use in an inline module, as use super::* in mod tests, stays out. Read from the module of the file, its super names a sibling module, and a path of a crate with the name of that sibling would lose its edge to the crate. The cases rust/glob-use-module and rust/glob-use-crate-module fail without the change. The case rust/glob-use-inline-module fails when the inline glob uses count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
functionsOf read the definitions from a map. So the targets of the reference of a spread came in a random order, and the index of a file could differ between two runs. The function now sorts the keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
The cases of the alias, JSX spread and glob use fixes change the graphs and the reach results of the cases. The versions of the branch stay the same, so the rows 16/18 and 16/18/5 take the new hashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm Signed-off-by: Claude <noreply@anthropic.com>
Summary
This PR holds the safedep/code issues of the Linear milestone "v2.2a Reachability MVP". vet reads the reach query to say whether a project calls a vulnerable function. On main, global uncertainties made almost every Go and Rust target uncertain, so vet could not say
calledornot calledfor most findings. This PR removes the global causes that are unsound to keep, and it adds records where code outside the graph can call back into it, so no change turns a reachable target intonot-found.docs/projectgraph.mdshows why a unit scope is unsound without the declared dependencies of the unit, and a guard case holds the argument.?is recorded in the index and replaces the method table. The builtin skip of the first version is gone: a builtin can return its argument.go:std@<release>.extern crate,pub useof a crate,useof an item, and type aliases resolve..jsxand the scripts of.vue,.svelteand.astro. The markup gets a record,<script src>gets an import, and a JSX element name gets a reference.New soundness rules, each argued in
docs/projectgraph.mdand guarded by cases:no-dependency-sourcerecord. Without this rule, the FOU-558 change exposed false negatives in vet's mode, because vet gives no unit to the standard library.The versions move once for the branch: fileindex 16, projectgraph 18, reach 5, summary 3.
Verification
go test ./...: all pass. The only failure ismodgraph TestBuildHoldsEachEdgeOfGoList, which fails on main in the same container too.-racetests of the indexer, parser, lang and reach pass.scripts/run_examples.shpasses.golangci-lint run ./...gives 0 issues.test/projectgraph/report.mdhas the counts per cause.Each fix has a hand-written case or a receiver row that failed before the fix.
Reviews
useforms;Notes for vet
uncertain · no-dependency-source. That answer is sound. vet gets the precision back when it links GOROOT and every module with source in the module cache.missline oftest/reach/cases/rust/trait-object.txtaronce it takes this version.Generated by Claude Code