Documentation
¶
Overview ¶
Command python-semantic audits the exactness of the Python path over the fixtures of `testdata/python`, in both of the modes the path offers.
The Python path has two producers and they promise different things, so a single number would hide the interesting half. `fallback` runs the bundled AST worker `python-worker/index.py`, whose payload declares `authoritative: false`; the normaliser therefore stamps every relation it reports as CANDIDATE (`internal/pythonloader/loader.go:93` and `internal/facts/semantic.go:295`). Publishing one exact edge from that arm would break the promise, so this harness measures the absence as a first-class property instead of asserting it in a comment. `exact` runs `python-worker/pyright_index.py` against a Pyright language server, whose payload declares `authoritative: true`, and there the question is the usual one: how many of its exact edges are wrong.
The ground truth is written by hand from the fixture sources. Every expectation carries the file and the line it comes from; comparing an index against its own previous output proves nothing.
The artifacts are deterministic: no timestamps and no machine paths, so two runs on the same host produce byte identical files and a regression is visible in the diff. The two toolchain versions are the only host dependent fields, and they are recorded because a measurement of Pyright that does not name Pyright is not reproducible.
Exit status is about the measurement, never about the verdict: it is zero whenever the audit ran and wrote its artifacts, and the verdict lives in the gate token, which is printed on stdout and written into both files. A broken contract is `PYTHON_SEMANTIC_FAIL` there, not a missing report.
Usage:
go run ./benchmarks/python-semantic