Skip to content

gitgalaxy libsurface: which libraries a repository leans on, which files lean hardest, how the surface changes #8534

Closed

Description

@squid-protocol

What

No gauge says anything about a dependency. A scan already stores every file's imports and includes and, since #8530, every call to a name the repository does not define (fcall_external). Together they say which libraries a file uses and which of a library's functions it calls, but nothing reads them that way. This issue tracks gitgalaxy libsurface, a read-only post-scan command (like gitgalaxy reach, #8532) with three views: the external libraries in use, the files coupled to one library (where work on it lands), and the surface change between two scans (API names added and dropped, files newly or no longer coupled).

Evidence (exploratory, research repository)

Coupling to a library predicts where that library's work lands (a commit whose subject names the library touches the file within 180 days; recall@20, per snapshot, bootstrapped over snapshots):

  • C and C++, 19 (repository, library) pairs in curl, libarchive and harfbuzz: function-name patterns plus includes, +0.389 over a size ranking (99.7% lower bound +0.344); -0.018 against the research's regex method (non-inferior at a margin of -0.05). Includes alone: +0.253, and -0.136 against the full measure, so the API-name patterns carry real signal (libraries reached through a wrapper header).
  • Outside C, import coupling alone (no API names; calls there are bare names), 11 evaluable pairs: +0.241 over size (lower bound +0.188); Go +0.395 on 5, Python +0.102 on 5, Java one library, Rust not evaluable.
  • Surface change, curl OpenSSL 2020-06 to 2022-12: 31 API names added and 15 dropped; checked against the source, 90% and 80% were right; the added names are the OpenSSL 1.1 object API.

Design (how libraries are defined)

Three layers, later wins by name: (1) discovery with no list (every external import root is a library, using the engine's own standard-library and system-header lists); (2) a shipped table of glob patterns for the API names of 20 C-family libraries; (3) user TOML files ($XDG_CONFIG_HOME/gitgalaxy/libraries.toml, ROOT/.gitgalaxy/libraries.toml, --libs FILE). Patterns are globs, never regexes, so a user pattern cannot hang the matcher.

Slices

  1. The command, the shipped table, tests and the wiki page (one PR).
  2. Docs follow-up: index and nav entries.
  3. Open: more table entries; C++, Objective-C and Fortran wrapper-header cases untested; Rust needs another repository.

Counts and lists only: no score and no risk claim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    call-graphenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions