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>
The shared cross-file layer needs, per file of a language without an
engine, what the file defines and includes in source order: the facts
its visibility closure will read. This lifts the language-neutral half
of the parked include-scope branch's extract_scope.c (round 5) with its
Protobuf handlers only.
- cbm.h: CBMScopeEvent {name, qual, pos, index, kind, flags} and
CBMFileResult.scope at the tail. Kinds DEF, INCLUDE, ASSIGN (a name
defined here that the graph has no node for), QREF (a qualified type
reference as written), OPAQUE (a parse error); flags REEXPORT
(`import public`) and CONDITIONAL (inside a parse error). The values
are the branch's, so its shell and Make kinds keep their numbers.
- CBMImport.start_byte, in padding (the struct stays 40 bytes):
parse_spec_imports records the statement every row came from, which
is how an INCLUDE event finds its row.
- extract_scope.c: one cursor walk driven by a row per language (node
kinds and roles, the label of a type's definition, the package
statement, the nesting kind); Protobuf is the only row. A DEF is the
definition result->defs already holds; its full name carries the
package and the enclosing messages.
- result_compact.c: the events and their strings move with the result,
and so through a spill.
- lsp_surface.c: the "is" key stores the facts by rank (bytes that move
keep the stored bytes and the surface hash), only for a language with
a row, so every other file's stored row is unchanged;
cbm_lsp_surface_scope_from_json reads them back.
The walk matches its rules on named nodes only: the branch also matched
the anonymous `import` keyword token, which gave every import statement
a second include event (31 on the development repositories' Protobuf
files). Apart from those, the stored facts equal the branch's round-5
binary's for every .proto file of etcd, nest, prometheus, cli, vagrant
and a fixture tree. Graphs are unchanged on both routes.
tests/test_scope_facts.c: the definitions, includes and references of
one file; nothing for a language without a row; a parse error is
opaque; compaction keeps the facts; the surface round trip; the hash
follows the facts, not the bytes; the walk's work grows linearly.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The shared cross-file layer (scope facts for languages without an engine)
needs one place where it can answer a call or usage site before main's
name chain, the same on the sequential and on the parallel route, without
the resolvers being edited for each rule.
site_bind.{c,h} is that place. Both call resolvers (pass_calls.c,
pass_parallel.c) and both usage resolvers (pass_usages.c,
pass_parallel.c) ask it at the same sites: a call no engine row matched
that does not require one, and a usage no engine row was found for. A
PROVEN answer replaces the chain where the chain runs (a call keeps every
later step of main: service classification, spawn, field policy,
guards); POSSIBLE and NO_ANSWER leave the chain as it is. A begin and an
end step per file hold the file's state and hand the layer the buffer the
file's edges went to, so an answer drawn after main's own edges needs no
further edit of the resolvers.
No language has a row yet: every file is inactive and every site gets
NO_ANSWER. Graphs are byte-identical to the base on both routes (etcd,
click, devise and two fixtures, one worker and padded past 50 files;
nodes and edges compared with strategy and properties).
tests/test_site_bind.c pins the contract for a language without a row:
no answer at a call or a usage, no edge drawn at the file's end.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
`from typing import overload as ovl` followed by `@ovl` was not recognised as @overload (the decorator's last dotted name is matched against `overload`), so the implementation's return annotation still gave the call its type: `make().replace(cls=AliasText).css()` drew Alias.css where python3 runs AliasText.css. A plain decorator name now also counts when the module's imports bind it to typing's or typing_extensions' overload (the module's namespace facts, `from ... import overload as X`); `@typing.overload`, `@tp.overload` and `@overload` match as before. A method of the same class under an ordinary decorator keeps its identity.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A function declared with @overload is typed at a call by the overload its arguments select (scrapy's `response.replace(cls=HtmlResponse)` is an HtmlResponse); the implementation's annotation (`-> Response`) is the type of no call, and neither is any one overload's. A definition whose QN the file also declares with @overload (`overload`, `typing.overload`, `t.overload`) now takes no identity from its annotations when the definitions of that QN declare different return types, so main's answer stays; when they all declare the same one (sqlalchemy's Connection.execution_options, `-> Connection` throughout), every call has that type and the identity stays. python3 runs Text.css for the fixture's `replace(cls=Text)` and Response.css for `opts(a=1)`; a plain method of the same class keeps its identity.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A type declared inside a function shadowed the package's type of that name for the rest of the whole function, so after the `if` block or outside the closure that declared it, a value of the package's type was typed unknown and its calls lost their edges. The walker now binds each type parameter and each local type name in its own lexical scope (the function, a block, a func literal) under a key no identifier can spell (`#T`), and a lookup asks the scope chain: a local type shadows from its declaration to the end of its block, as in Go. `go run` decides the new fixture (Block p1, Clo p2p1).
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
`global R` in a class body (run at import) or in a function body that binds R (`from pkg.b import R`) rebinds the module's R, so an annotation naming R in that module may mean that other binding (python3: pkg.b.R after the class body). Like a name the module binds twice, R now takes no identity there. The extractor records the names a body declares global and binds (CBMDefTypeFacts.global_names: assignments, imports, for and with targets, a nested def's or class's name, del and except targets count, the declaration alone does not), and the step marks them as bound more than once in the file's module bindings. The names join the definition's stored row (field_defs, as `name:` without a type), so an edit that adds or drops one is not a one-file repair. A function that declares `global R` and only reads it keeps the identity.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A class body's `del D` and `except ValueError as E` counted as bindings of the class, so a method annotation naming D or E after them took no identity, although by then the name is the module's again (Python unbinds an except target when its clause ends). The class-body list now takes the body's top-level statements in order: a binding holds from its statement on, and a later top-level `del` unbinds it unless a method is defined between the two (evaluated at definition time its annotation saw the class's binding, evaluated lazily the module's: no one answer, so the name stays bound); a `del` inside a compound statement may not run and unbinds nothing. An except target is a binding only for a definition inside its clause. python3.15 and 3.14 (lazy annotations) and 3.9 (eager) agree on the module's E and D; D2, bound when its method was defined, differs between them and keeps the abstention.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
go_struct_embedded_text joined each embedded type's spelling onto the text so far with a new sprintf, copying the whole prefix again for every embed: quadratic in the number of embedded types. It now measures the spellings in one cursor pass over the field list and copies them into one arena buffer in a second: linear, with the same text. A test seam counts the work (cursor steps and bytes copied), and a test extracts structs of 2000 and 4000 embedded types: the work doubles, and the last spelling is in the list.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The checks that an edge is absent gain partners that require one: the class-and-module test reaches a second class's method through the same shape; the embedded-names test calls through Ping, Lock2 and UseSame and requires Here exactly once, and Use's targets are labelled by build (Item on linux, Item2 elsewhere, as `go run` answers per platform); the function-declared-types test requires the calls into the generic functions themselves (First, Box.Get). The incremental harness can check the graph before and after the edit (ts_incremental_checked); the 17-embeds, 66-fields and class-body-edit tests now require the edges the edit keeps or drops, which 18d5f14e's routes did not draw (a per-file route that kept 15 embedded types, a 63-field limit on every route, a class body outside the stored row).
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
On macOS, cli_update_agent_configs_finish_before_guard_release and
cli_update_names_the_failing_staging_step_and_os_error package the test
runner itself as the fake release. The in-process updater, which exists
only in test builds, refuses a tar.gz that inflates past 500 MiB
(DECOMPRESS_MAX_BYTES), and an ASan runner carrying every vendored grammar
sits right at that limit. The ObjectScript v1.11.0 parse tables add about
4.9 MB to the runner, which took both CI macOS runners over it: the
archive was refused as "binary not found in archive" right after its
checksum was verified, so the first test got rc 1 and the second never
reached the staging write that fails with ENOSPC. Linux packages
/bin/true and was not affected.
The limit keeps its own test,
cli_update_refuses_an_archive_over_the_decompression_limit. These two
tests only need their archive accepted, so they set the limit to twice
the fixture's inflated tar, which the doubling decompression buffer can
never exceed, and restore it right after the update runs.
x86_64 ASan runner under Rosetta, the macos-15-intel analog: main
1ec2f262 is 520,665,520 bytes and passes; 0bde6dea is 525,530,264 bytes
and fails both tests with the CI messages; main plus only the vendored
grammar directories of 086967955 is 525,502,864 bytes and fails the same
way. With this change both tests pass at 525,530,264 bytes, and fail
again with it reverted.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
(cherry picked from commit 9d3f2af1ec)
The semantic pass builds a file's import map from its extracted imports
or, when the file extracted none, from the IMPORTS edges another pass drew
for it (the slow path). The slow path copied each key with cbm_strndup,
which is libc strndup, while free_import_map releases every key with
cbm_free. In the product build cbm_free is mi_free, and on macOS the
mimalloc global override is off, so the key was a foreign block.
An Ansible playbook is such a file: it extracts no imports, and the
Ansible pass gives it IMPORTS edges for its roles and includes. On macOS
the index worker crashed in the semantic pass (SIGSEGV in mi_free, or
SIGBUS in mi_usable_size) on every repository of 50 files or fewer
holding a role or an include, for example these two files:
site.yml "- hosts: all\n tasks:\n - include_tasks: other.yml\n"
other.yml "- debug:\n msg: hi\n"
and on any repository indexed with one worker (kubespray). The same pass
runs for the frozen test-impact index and for changed files on the
incremental route.
The slow-path key is now allocated with cbm_alloc under the semantic
class, like the fast path's cbm_mem_strdup keys.
The test suite never saw the crash: the test build backs the memory core
with the C runtime allocator, where cbm_free is free. The new test
indexes a playbook with a role and an include once, to warm what the
process builds once and keeps (the pretrained token table), then takes
the semantic class's live block and byte counts around a second,
identical full index and an incremental re-index after an edit, and
requires them to end where they started. The memory core counts only the
blocks it hands out, so a key it takes back without having handed it out
leaves the class below its start on every platform, independent of the
allocator, of where the string landed and of what ran before the test.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A class body's `x: T` without a value records an annotation and binds nothing, so a method annotation naming x still means the module's x; the class-body list no longer counts it (main's python_typed_field_external_import_stays_unresolved asserts that such a class gets no field_defs). The class-body test gains an annotation-only name whose method keeps its identity.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A definition's identity index (cbm_type_scope_index) held a 24-byte slot per entry in a table of at least four, plus the string copy: about 140 bytes for one identity, 300 for three, retained in the registry arena for the resolve phase. Entries are 12 bytes of offsets into the copy now, and up to four identities (most definitions) are a plain list a lookup scans, a bounded cost; more stay a hash table. The answers are the same. Also formats the round-3 lines clang-format reported.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The type-parameter test also reads an exported field of a generic type from another package (m.Box[p2.E]{}.V.Hello()), and an incremental test edits a class body so that it binds the name a method annotation uses (same lines): the class's bindings are part of its stored row, so the run is not a one-file repair that keeps a stale caller edge.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Three defects the second review found in the Go engine, and one limit
beside them:
- The unqualified type name of an embedded field is a field of its depth
(Go spec), so in `Server{ Config; base.Handler }` the selector s.Config is
the embedded Config even where Handler has a field Config one level down,
and an embedded func type `Logger` shadows a promoted method Logger. The
member lookup saw named fields only: a deeper field won (main's right
edge replaced by a wrong one) and a deeper method was called. Every
registry route now names each embedded type as a field of the embedding
type: typed as the embedded type when its QN is known, of unknown type
otherwise (it shadows and answers nothing, e.g. sync.Mutex). A QN of
several definitions (build variants, foo and foo_test) shadows every field
name any of them declares, so no deeper member of that name is selected
where they disagree.
- The walker typed a function's type parameter, its generic receiver's,
and a type the function declares itself (`type T struct{...}` in the body)
as the package's own T, which now promoted T's embedded members. Those
names shadow the package's types in the function (a local type from its
declaration on); they are unknown to the walker, which abstains. Main's
own false edge from a type parameter to a method of the package's T goes
with it.
- The per-file route replaced the walked file's struct fields and embedded
types with a scan of its syntax tree that kept 15 embedded types and 63
fields, while the full index took them from the definitions: a one-file
repair lacked edges the full index had. Every route now takes them from
the definitions, all of them; parse_field_defs and the in-file scan keep
every field too (the 63-field limit cut both routes alike and decided
which field calls resolve).
The agreement table's joins are linear now (one buffer each).
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Three defects the second review found, and its memory finding:
- A Python class body binds names besides its nested definitions
(`Config = OtherConfig`, an import, an annotated name, a for, with,
except or match target, a walrus, global/nonlocal/del), and inside its
methods' annotations such a name is the class attribute, not the
module's class of that name. The extractor lists them per class
(CBMDefTypeFacts.class_bindings) and the declared-type step gives none of
them an identity; a name the body does not bind keeps its own. They also
join the class's field_defs as `name:` (an attribute of unknown type the
Python registrar skips), so they are part of the stored row the
incremental planner compares: an edit of a class body is never a stale
repair.
- A class and a module of one QN (class Thing in pkg/a/__init__.py beside
pkg/a/Thing.py) share their members' QNs, so a member edge through the
class's identity named the module's function. A type QN the graph holds
as a module gets no identity (the graph the import map reads).
- A Go type parameter in a definition's types (`func First[T any](xs []T)
T`, `func (b Box[T]) Get() T`, `type Box[T any] struct{ v T }`) was read
by the cross registrars as the package's own type of that name, and the
embedded-member promotion carried that to its embedded types. The
extractor records a Go definition's type parameters (its own, its generic
receiver's), and the cross-file texts spell them `any`: no registrar reads
them as a project type.
The three definition fields the declared-type step added (type_params,
value_type, go_embedded) were 24 bytes on every definition of every
language. They move to one optional record, CBMDefTypeFacts, allocated in
the result arena only for a Go or Python definition that has a fact, which
also carries the Go type parameters and the class bindings: 8 bytes per
definition for the pointer. Compaction and the spill walk it.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Go promotes the methods and fields of an embedded type to the struct that
embeds it. A struct of another file reached the Go registrars without its
embedded types (unnamed fields are neither fields nor base classes), and
the walked file's own structs qualified `logging.LogHolder` against the
file's module, so `o.Hello()` through an embedded `base.Base` was lost.
The extractor records a struct's embedded types as written
(CBMDefinition.go_embedded; no graph edge is drawn from it), the pipeline
hands them to the cross-file LSP, the declared-type scope step resolves
their spellings in the declaring file's scope, and one Go-specific hook
(go_embedded_qns) turns them into the QNs the member lookup falls through
to: the identity, or for a bare name the declaring package's own type. The
walked file's own structs take the same answer through their imports.
The member lookup walked embedded types depth-first and took the first hit
in declaration order at any depth. It now follows Go's selector rule for
methods and fields alike: breadth-first, the member at the shallowest depth
wins, two at that depth (or a field and a method) is no selection, and an
outer field of the name shadows every promoted method; in one file as
across files.
A struct QN of several definitions (a package and its external test
package, build-tagged variants) keeps what every definition agrees on: the
fields declared with the same type text and identity, and the embedded
types only when all embed the same, so prometheus' build-tagged
labels.Builder keeps its shared `base` field and the answer never depends
on file order. An embedded type swapped for another package's type of the
same name is a change of the named type the closure planner declines on.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
`pkg.Default.Get()` and a bare `Default.Get()` of another file of the
package stayed untyped: Variable definitions carried no type, and the Go
registrars ignored them. A package-level `var`/`const` now records the
type its declaration or its single initializer spells (`T`, `T{}`, `&T{}`,
`new(T)`, a const block's implicit repetition; nothing inferred) in
CBMDefinition.value_type. The pipeline hands it to the cross-file LSP as
the Variable's type, the Go registrars register the value under
<package>.<name> with CBM_FUNC_FLAG_VALUE, and `pkg.V` / `V` evaluate to
that type. The type is not written to the graph: no Variable node of any
language carries one today.
A value is never a call target, on every route: the walker's callable
lookups and the fast resolve of unresolved calls both skip it, so a call
through a function-typed value keeps main's edge and strategy.
A directory holds both `package foo` and `package foo_test`, and their
package-level names share one directory QN. A value whose QN another
definition also has (a value of another type or identity, a function of
the other package) is registered for neither, so the answer never depends
on file order; values of one QN that spell the same type with the same
identities (build variants of one declaration) give one answer and stay.
The struct rule of the earlier commit becomes the same kind of rule: a
struct QN whose definitions all spell the same fields with the same
identities keeps them.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The Go walker recursed into a func literal's body as plain children of the
enclosing scope; its declared parameters were bound only when the literal
was evaluated as an expression (an argument, an assignment). A literal in
a composite literal's field value, a test table's
`run: func(reg *httpmock.Registry) { reg.Register(...) }`, left `reg`
untyped and every call through it unresolved. The walker now walks every
func literal it reaches with its parameters bound, through the same helper
the evaluator uses.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Both Go registrars attached a struct's fields to the FIRST registry entry of
its qualified name: a receiver placeholder when a method of the struct was
registered first. A type lookup after finalize answers with the LAST entry
of that name, so the fields were never seen and every field chain through
such a struct died (helm's `r.cfg.Releases.DeployedAll`). The fields are now
parsed onto the struct's own entry, the placeholder keeping them too for the
first-registered readers.
Go module QNs are directories: a package and its external test package
(`foo`, `foo_test`), or build-tagged variants, can declare two structs of
one QN, and which entry a lookup answers with depends on file order. Such a
QN keeps no fields in either registrar, as before this change, where its
fields were never visible.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
A definition's declared types travel to other files as source text, and
the Go and Python cross registrars qualified that text against the
defining module only: a type the defining file imported from a third file
became `<defining module>.<Name>`, a name nobody registered, and every
call through it was lost.
A shared step (src/pipeline/type_scope.{h,c}) resolves every type name a
definition's return, parameter and field texts write once, in the scope of
the file that wrote it: the file's own module, then what its imports bind
(the LSP import map). A name gets an identity only when that scope gives
exactly one answer and the answer is a project definition of a type label
the engine registers. One description row per language (Go, Python):
- An import that names no project definition is no answer (`Self` from
typing, `logging.Logger`), and neither is a path a package re-exports:
the step cannot prove one through the engine's export fold.
- Go imports bind packages: a bare name never resolves through one, and an
own-module name is left to the engine, so a type parameter cannot take
an identity.
- Python looks a name up in the def's own scopes first: a def inside a
function gets none, and so does a name its enclosing class body
declares, a PEP 695 type parameter of the file (new extraction field
CBMDefinition.type_params), a name the module binds more than once (its
ordered namespace facts: an import and a TypeVar, two imports), and any
name of a module with a star import or a parse error.
Identities ride on CBMLSPDef.type_scope ("spelling=QN|..."), are stored in
the LSP surface row ("ty", codec version 5) for the routes that do not
re-extract a file, and are left out of the surface hash and the Python
namespace comparison: a body edit stays a one-file repair. An identity
also depends on other files' type definitions; the closure planner
declines when a changed file gains a type definition, or when a type some
stored identity names changes or leaves its file
(cbm_lsp_surface_identity_decline), so the depth-1 closure stays exact.
The Go and Python registrars read identities through a per-def index
(cbm_type_scope_index / cbm_type_scope_find: one hash probe per lookup),
and the per-file selection follows them to the declaring modules, walking
each module once. Every loop the step adds has a counted-work growth test.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The per-file extract now parses C-family files with each backslash CR LF
rewritten as space backslash LF, but the cross-file C/C++ LSP pass parses
the file a second time from the original bytes: the parallel driver from
its retained copy, the sequential driver from a fresh read. Both end in
c_lsp_cross_with_registry_run or c_lsp_cross_run, which parsed those
bytes as they came, so after a CRLF string splice the rest of the file
was one ERROR region again for that pass, and a call only that pass
resolves was lost.
Export the mask as cbm_c_mask_crlf_splices (declared in cbm.h next to
the PHP inline-HTML mask) and apply it at the top of both cross bodies,
before the test-owner check, the way cbm_run_php_lsp_cross_with_bindings
does for #2000. The owner digest then sees the same bytes the extract
hashed. The copy comes from the call's arena and is made only when a
splice is found.
A 66-file C++ repo (parallel driver) with the reporter's string splice,
followed by a call through a struct declared in another header: LF 208
edges; CRLF 207 before (after_one -> ops.run, lsp_field_access, missing)
and 208 after, byte-identical to LF. The 3-file version (sequential
driver): 28, 27, 28, also identical to LF. redis 4f20cb48: the LF graph
(40,941 nodes, 141,136 edges) and the CRLF graph (40,940 nodes, 141,144
edges) are unchanged.
Tests: a pipeline test through both drivers with the shared C/C++
registry (the parallel harness can now opt into it, like the C# one), and
a c_lsp test through the per-file, shared-registry and batch entries,
each with an LF control. Both fail without the two calls; removing either
call alone fails the test that covers its body.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
subprocess_tree_rss_measures_contained_descendants compared two
independently spawned process trees, one idle and one whose descendant
touched 128 MiB, and required the loaded total to be at least 96 MiB
above the idle total. Two separate trees need not start from the same
footprint. On the hosted Windows CLANG64 leg they did not: the loaded
tree measured only 78 MiB above the idle one (167 MiB vs 245 MiB), and
the test failed on two unrelated PRs within two days (#2965 on
889170ca, #2975 run 43499140720). The diagnosis that the two separate
trees are the cause comes from #2965.
The test now samples ONE tree twice, and every wait in the handshake is
a blocking pipe read instead of a poll of a ready file:
- The test creates two pipes, "up" (tree to test) and "down" (test to
tree): FIFOs in its private temporary directory on POSIX, named pipes
named after that directory's unique leaf on Windows. The
__cbm_rss_tree_root role connects both as its first action and starts
one __cbm_rss_tree_hold descendant that inherits the connected ends
(fork on POSIX, an explicit two-handle inherit list on Windows); the
root then drops its own copies.
- The descendant writes 'I'; the test takes the idle sample and writes
'L'; the descendant touches every page of a 192 MiB load and writes
'R'; the test takes the loaded sample and closes its ends, which
releases the descendant to free the load and exit.
- A descendant that dies closes its ends, so the waiting read returns
end-of-file instead of blocking. No handshake step has a sleep, a poll
interval or a deadline.
The floor stays at 96 MiB and is now half the load: the root does not
grow between the two samples, so a probe that counts only the root
misses the floor by 96 MiB, and a probe that counts the descendant
clears it with 96 MiB to spare. The two member-fault tests use the same
handshake and keep their assertions. Production code is unchanged.
Evidence:
- macOS arm64, ASan: subprocess suite 60 passed, 2 skipped (the
Windows-only Job Object probes); the rewritten test passed 20 of 20
consecutive runs, idle 43 MiB and loaded 259 MiB in every run.
- Binding: with the macOS probe temporarily limited to the root process,
the test fails at the floor assertion (idle 33 MiB, loaded 33 MiB);
restoring the probe returns the suite to green.
- Linux arm64 container, gcc ASan: subprocess suite 60 passed,
2 skipped; the rewritten test passed 20 of 20 consecutive runs, idle
462 MiB and loaded 654 MiB in every run.
- Windows: both changed files compile with -fsyntax-only -Wall -Wextra
-Werror under llvm-mingw for x86_64 and aarch64.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Brings the branch up to main 1ec2f2623. Conflicts were the grammar
bookkeeping only:
- THIRD_PARTY.md: main's thirteen self-maintained forks (sql, vba added)
plus haskell make fourteen; the haskell paragraph sits between pascal
and main's new sql paragraph; main's tree-sitter-vba section is kept.
- MANIFEST.md summary: main's 164 grammars with haskell moved from
vendored-from-upstream to self-maintained: 138 + 21 + 5 = 164,
recounted from the tree (164 grammar dirs, 164 parser.c, ABI
9/78/77). haskell stays only in the self-maintained forks table.
- scripts/vendored-checksums.txt: regenerated with
scripts/security-vendored.sh --update.
scripts/audit-license-provenance.py merged cleanly: the haskell FORKS
row sits alphabetically between dotenv and javascript, next to main's
sql and vba rows.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
cd318253e made the package map independent of worker scheduling by
sorting every candidate of a package name by depth and path before the
first-wins insertion. That also reordered the candidates of ONE manifest:
a pyproject.toml pushes src/<name> first and <name> second, the first had
always won, and after the sort the shallower second one did, for every
Python package. Imports that used to bind their own package then fell to
the same-name fallback: in flask, `from flaskr import create_app` in
examples/tutorial bound the celery example's create_app.
The dispatcher now stamps each entry with the manifest that yielded it and
its position among that manifest's entries, and the merge orders by package
name, the manifest's depth and path, and that position. Different manifests
are still ordered by the repository, not by the run; one manifest's entries
keep the order its parser chose.
ei_pkgmap_one_manifest_keeps_its_candidate_order hands a pyproject.toml and
a sibling's to the merge in both worker orders;
ei_python_example_project_import_binds_its_own_package indexes the flask
shape and checks the import's target file. Both fail without this change.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The "8 slowest suites" summary in scripts/run-tests-parallel.sh sorted with
`sort -t= -k6 -rn`. uutils sort (Rust coreutils, shipped as sort on newer
runner images) reads the attached form -t= as -t with an inline "=value",
an empty separator, and exits with "separator must be exactly one character
long: ''", leaving the table empty. Pass the separator as its own argument,
which GNU, BSD and uutils sort all parse alike. Informational only: the
script has no set -e and its exit status is unchanged.
scripts/test.sh's environment line now also names the CPU and whether it
has SHA-256 instructions (x86 sha_ni / ARMv8 sha2), the signal
src/foundation/sha256.c uses to choose its hardware or portable backend.
A sanitized runner fingerprints its own large image on that path, so which
CPU a hosted job drew decides how long those fingerprints take. The helper
lives in scripts/env.sh (cpu_summary, opted into via print_env --cpu, so
build.sh, lint.sh and repro.sh print exactly what they did); it reads
/proc/cpuinfo or lscpu on Linux/MSYS2 and sysctl on macOS, reports
"unknown" for anything unreadable, and never fails the caller.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>