feat(model): the envelope checkout, and no to Joern server mode

contributor-scan 2.2 for libpng and the 2.3 decision it exists to inform.

89,082 lines of C across 93 files, under a 2GB heap cap:

  CPG build      16.1s (25s cold)
  Joern queries  250.0s
  arbitration    122.0s (105 calls, $0.0122)
  whole scan     446s
  peak RSS       911MB
  regions        121, all arbitrated, 32 unasked
  CVE-2025-66293 out_of_scope, as the recipe declares

Memory is not the constraint a fleet runner would hit: 911MB leaves room
for the rest of the job on a 2-vCPU/7GB runner. The memory pressure seen
while building this was concurrent JVMs on one desktop, not repository
size.

**Server mode: no.** The query phase splits taint 243.3s / config 10.7s
over two invocations, and fixed overhead measured on the same CPG is ~13s
per invocation. So ~26s of the 250s is JVM startup and ~224s is CPGQL
evaluation: a warm server removes 6% of the scan and none of the part that
costs. The driver now records query seconds per kind, because a single
total cannot tell startup from evaluation and the two answer this
oppositely.

The small repository pointed the other way. vampi's 34.3s over three kinds
is roughly three startups and almost no evaluation, which made a warm JVM
look worth having; the ratio inverts with size. That inversion is why the
task was sequenced after a real repository rather than decided on a
520-line file.

On whether one whole-repository CPG is the only shape for a horizontal
fleet: no, and it is also not where the pressure is. The build
parallelises and costs 16s; the query does not shard and costs 250s, so
splitting a repository across runners divides the cheap phase -- and after
2.4 a shard boundary hides exactly the cross-module flows that matter.
Scoping to a contributor's diff cuts the expensive phase instead. 911MB
for 89k lines extrapolates to roughly 5GB at a million lines, which would
exceed a standard runner, so the ceiling is real and further out than this
checkout can locate.

Two defects recorded rather than fixed, both invisible at vampi scale:
2.9, all 26 entailed findings are the same site reported 26 times, because
regions that share a sink each emit their own; and 2.10, 22 of the 30
highest-ranked regions are libpng's `contrib/` example programs rather than
the library.

Also ignores Joern's `workspace/`, which a maintainer querying a CPG by
hand from the repository root will create.

Gates byte-identical.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
Marius Ciepluch
2026-09-09 11:30:02 +02:00
co-authored by Claude Opus 5
parent d15985f695
commit 68b4e551f3
6 changed files with 176 additions and 1 deletions
+18
View File
@@ -309,3 +309,21 @@ def test_the_call_depth_is_bounded() -> None:
from openultrasast.model.scan import ENTRY_POINT_CALL_DEPTH
assert 0 < ENTRY_POINT_CALL_DEPTH <= 5
def test_the_scan_reports_query_time_per_kind() -> None:
"""contributor-scan 2.3: which query costs the time is the whole server-mode decision.
On libpng the phase split taint 243.3s / config 10.7s over two invocations, against ~13s of fixed
startup each. A single total cannot tell startup from evaluation, and the two lead to opposite answers.
"""
from openultrasast.model.scan import scan_repository
regions = (
_region(path="a.py", families=("injection",)),
_region(path="b.py", families=("config_secrets",)),
)
result = scan_repository(Path("/repo"), regions, backend=_Backend(), client=None, model="")
assert set(result.query_seconds_by_kind) == {"taint", "config"}
assert sum(result.query_seconds_by_kind.values()) <= result.query_seconds + 0.05