Review 1 of the A stack (A1-1, A1-2, A1-3, B1, M3 and the walk ruling),
to be folded into A1 ("path rule for Protobuf and Make imports" and "an
import path that names no repository file has no target").
The universe is the run's indexed file list (the files discovery kept,
the same list on the full and the incremental routes), built once before
any question and read-only afterwards. The directory walk, the symbolic
link flag and the walk-based listing digest are gone: a copy of a file in
an ignored or skipped directory (node_modules, a .gitignore'd tree) is not
seen, so an import that only such a copy could satisfy names no file and
draws no IMPORTS edge. The semantic manifest keys the universe by the
sorted indexed paths a row's import can name, read from the discovered
list: no disk access on any planning.
A pick that depends on what the index cannot know is a guess, its own
verdict (CBM_INCLUDE_PATH_GUESS), never FILE: main's strategies decide the
IMPORTS edge and the shared layer takes the include as unresolved.
- Protobuf: when several indexed files end with the import path, the one
beside the importer is only one include root's reading (protoc -I . and
-I svc read different files).
- Make: a relative include in a makefile below the repository root names
a file relative to the directory make runs in (GNU make 4.3 does not
read sub/b.mk for `include b.mk` in sub/a.mk included from the root);
only a makefile at the root decides.
A Protobuf path protoc refuses as a virtual path (a `.` or `..` segment,
`//`, a backslash) is not read. Absence for a Make path that climbs out
of its directory is read from the path after its leading `../` segments.
Tests: the edge-level test is red on main (an import naming no repository
file drew main's edge to a same-named Go module); a copy under
node_modules is not seen; the beside pick keeps main's edge; the guess
verdicts for Protobuf and Make; the virtual-path refusals; the inventory
key; linear build work.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A Protobuf `import "a/b.proto"` and a Make `include x.mk` name a file.
When the path rule could not settle such an import, main's strategies ran
and their last fallback bound it to a definition named like a piece of
the path (a Go struct `kv` for `import "etcd/api/mvccpb/kv.proto"`), or to
another file; a statement that names a file cannot name a symbol.
The path rule now decides two more cases (include_path.c only; the hook
in resolve_import_strategies is unchanged):
- proven to name no repository file: the whole listing holds no file
that is the path or ends with it, none when letter case is ignored, and
the walk passed no symbolic link a path could hide under. Then no
include root or run directory inside the repository supplies the file:
no IMPORTS edge.
- it names exactly one repository file, which has no graph node (a file
discovery does not index): no edge either; any other target is another
file or a symbol.
With several candidate files, or a path it cannot read, main's strategies
decide as before. Only Protobuf and Make, the languages with a path row,
change; SCSS, HTML and Bash keep main's resolution until they get a row.
Edges removed, development and infrastructure corpora (all of them wrong
by the statement's own text):
- etcd (development): 3 Protobuf IMPORTS onto Go structs (client/v3
`kv`, `options`) from `import "etcd/api/..."` lines of
api/etcdserverpb/rpc.proto and v3electionpb/v3election.proto: no
repository file ends with those paths.
- prometheus (development): 2 Make IMPORTS onto the root Makefile's own
Module from `include Makefile.common` (root Makefile) and
`include ../../../Makefile.common`: the named file exists but has no
graph node, and the target was another file.
- deckhouse (infrastructure, counts only): 8 Protobuf IMPORTS onto
Methods.
The 11 Protobuf edges are the 11 of 32 a census found wrong.
No edge is gained. Incremental equals full after import edits.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A Protobuf `import "a/b.proto"` and a Make `include x.mk` name a file by
its path, but main resolved them like module names: the one repository
file the path names was often missed, and the last fallback could pick a
symbol of the same name.
src/pipeline/include_path.{c,h} lifts the path rule of the parked
include-scope branch (round 5, include_scope.c section 2): the repository
listing (every file named like what a row's import can name, `.git` and
symbolic links not entered, walked once per run on the first need), the
bases (the importing file's directory, the root), exactly one, the
whole-path tail index and the import node (the file's Module node, else
its File node). Rows: Protobuf (an import that names no `.proto` file is
left alone; the one file that is the path or ends with it, else the file
beside the importer) and Make (the makefile's directory or the root, only
when exactly one is a file).
resolve_import_strategies asks it first (one hook, pass_pkgmap.c); where
it finds the file, that file is the IMPORTS target; otherwise main's
strategies decide as before. The run's universe lives on the pipeline
context of the full and both incremental routes. A virtual manifest row
holds the digest of the listing when a Protobuf or Make file is
discovered, so a changed set of those names, anywhere, routes an
incremental run to a full index.
Measured on the development and infrastructure corpora: two Protobuf
IMPORTS edges gained (nest, `import public "common/item_types.proto"`
and `"common/shipment_types.proto"`, each the one file with that path),
one Make include moved from a Folder to the included file's Module.
Incremental equals full after edits that add and remove imports.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>