frontera-runner 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- frontera_runner-0.2.0/PKG-INFO +487 -0
- frontera_runner-0.2.0/README.md +470 -0
- frontera_runner-0.2.0/frontera_runner/__init__.py +9 -0
- frontera_runner-0.2.0/frontera_runner/__main__.py +3 -0
- frontera_runner-0.2.0/frontera_runner/ceros.py +286 -0
- frontera_runner-0.2.0/frontera_runner/cli.py +149 -0
- frontera_runner-0.2.0/frontera_runner/instrumentos.py +478 -0
- frontera_runner-0.2.0/frontera_runner/recibo.py +512 -0
- frontera_runner-0.2.0/frontera_runner/render.py +227 -0
- frontera_runner-0.2.0/frontera_runner/runner.py +336 -0
- frontera_runner-0.2.0/frontera_runner/triaje_frontera.py +138 -0
- frontera_runner-0.2.0/frontera_runner.egg-info/PKG-INFO +487 -0
- frontera_runner-0.2.0/frontera_runner.egg-info/SOURCES.txt +17 -0
- frontera_runner-0.2.0/frontera_runner.egg-info/dependency_links.txt +1 -0
- frontera_runner-0.2.0/frontera_runner.egg-info/entry_points.txt +3 -0
- frontera_runner-0.2.0/frontera_runner.egg-info/top_level.txt +1 -0
- frontera_runner-0.2.0/pyproject.toml +36 -0
- frontera_runner-0.2.0/setup.cfg +4 -0
- frontera_runner-0.2.0/tests/test_frontera.py +1361 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: frontera-runner
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: One composite run of four frontier instruments, one deterministic receipt, one Markdown check per pull request
|
|
5
|
+
Author: Platino Labs
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/alexisromtz-lab/frontera-runner
|
|
8
|
+
Project-URL: Source, https://github.com/alexisromtz-lab/frontera-runner
|
|
9
|
+
Project-URL: Reusable workflow, https://github.com/alexisromtz-lab/frontera-runner/blob/main/.github/workflows/reusable-ceros.yml
|
|
10
|
+
Keywords: ci,pull-request,receipt,audit,determinism
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# frontera-runner
|
|
19
|
+
|
|
20
|
+
One subject in. One sealed receipt out. Four instruments that live in four other repositories,
|
|
21
|
+
called as subprocesses, never imported.
|
|
22
|
+
|
|
23
|
+
The point is not to run four linters. The point is to publish **one** verdict a pull request can
|
|
24
|
+
read, in which an instrument that had nothing to measure says so by name instead of returning a
|
|
25
|
+
green zero.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
frontera-runner <sujeto> # Markdown for a PR check
|
|
29
|
+
frontera-runner <sujeto> --json # the canonical receipt
|
|
30
|
+
frontera-runner diff --base b.json --head h.json # the gate: what the PR changed
|
|
31
|
+
ceros-implicitos <árbol> # where a tree writes a zero it did not measure
|
|
32
|
+
ceros-implicitos --base <base> <head> # the gate for that census: what the change added
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Why this exists
|
|
36
|
+
|
|
37
|
+
Three of the four instruments return `2` when they find no universe: `fiber-ast-lint` with no
|
|
38
|
+
Python analysed, `test-ordinal-ratchet` with no test file parsed, `ts-py-anchor-guard` with
|
|
39
|
+
nothing evaluable. A composite runner that folds `2` into "0 findings" turns *we did not look* into
|
|
40
|
+
*we looked and it is clean* — the exact defect the four instruments were built to refuse, reintroduced
|
|
41
|
+
at the layer that aggregates them.
|
|
42
|
+
|
|
43
|
+
So the runner maps every exit code each instrument can emit, and the two states that mean "no
|
|
44
|
+
measurement" carry a machine-readable reason:
|
|
45
|
+
|
|
46
|
+
| state | meaning | carries `hallazgos`? |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `APLICABLE` | the instrument ran over a universe it saw | yes, an integer |
|
|
49
|
+
| `NO_APLICABLE` | there was nothing to measure, and the reason is on the row | no, `null` |
|
|
50
|
+
| `NO_MEDIDO` | there was something to measure and it was not measured | no, `null` |
|
|
51
|
+
| `NO_EJECUTADO` | the instrument's repository is not where `--raiz` says | no, `null` |
|
|
52
|
+
|
|
53
|
+
## The four instruments
|
|
54
|
+
|
|
55
|
+
Called as `python -m <module> <args>` with the subject as the working directory, and with
|
|
56
|
+
`PYTHONPATH` pointing at the instrument's own repository — a `src/` layout is not optional.
|
|
57
|
+
|
|
58
|
+
| instrument | invocation | exit codes |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| `git-complement-audit` | `-m git_complement_audit . --json` | `0` nothing outside `HEAD` · `1` orphan code or secret risk · `2` invalid repository |
|
|
61
|
+
| `fiber-ast-lint` | `-m fiber_ast_lint.cli . --json` | `0` no candidates · `1` candidates · `2` empty universe · `4` does not reconcile |
|
|
62
|
+
| `test-ordinal-ratchet` | `-m ordinal_ratchet.cli . --json` | `0` nothing grew · `1` new collision or counter · `2` no universe / not comparable |
|
|
63
|
+
| `ts-py-anchor-guard` | `-m ts_py_anchor_guard.anchor_oracle --manifest <m> --json` | `0` conforming · `1` diverging · `2` not measured · `20` bad invocation |
|
|
64
|
+
|
|
65
|
+
`2` is mapped per instrument, not by convention: for `fiber-ast-lint` and `test-ordinal-ratchet`
|
|
66
|
+
it means *no subject* and becomes `NO_APLICABLE`; for the audit and the guard it means *could not
|
|
67
|
+
measure* and becomes `NO_MEDIDO`. An exit code no contract declares is `RC_NO_DECLARADO`, never a
|
|
68
|
+
guess.
|
|
69
|
+
|
|
70
|
+
A run whose instrument exits on a "measured" code without publishing its counters is
|
|
71
|
+
`SALIDA_SIN_HALLAZGOS_DECLARADOS` — not a zero. The reader that turned a missing list into an
|
|
72
|
+
empty one was the first bug this repository found in itself, and the `medido_es_numero` law below
|
|
73
|
+
is what caught it.
|
|
74
|
+
|
|
75
|
+
## Findings are counted from their names, not from a counter
|
|
76
|
+
|
|
77
|
+
Every accepted payload is read twice: once for the number the instrument declares, and once for a
|
|
78
|
+
census of the findings themselves. The census is built from the payload's own detail lists and each
|
|
79
|
+
row that cannot be named is `SALIDA_SIN_IDENTIDADES`; a census whose size disagrees with the
|
|
80
|
+
declared counter is `IDENTIDADES_NO_RECONCILIAN`. Both are `NO_MEDIDO` with a reason, never a
|
|
81
|
+
number somebody typed. `hallazgos` in the receipt is `len(census)` — the identity list is what the
|
|
82
|
+
`diff` subtracts, so it must be the thing that was counted.
|
|
83
|
+
|
|
84
|
+
| instrument | identity of one finding |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `git-complement-audit` | `class|path|root` |
|
|
87
|
+
| `fiber-ast-lint` | `archivo|qualname|familia|forma|poblacion` |
|
|
88
|
+
| `test-ordinal-ratchet` | `kind|path|scope|name` |
|
|
89
|
+
| `ts-py-anchor-guard` | `DIVERGE|par|ancla` (its unit is the **pair**, see below) |
|
|
90
|
+
|
|
91
|
+
Two deliberate omissions: the audit's identity carries no `oid`/`size` (a finding that moved
|
|
92
|
+
object is the same finding at the same path) and the fibre's carries no line number (a finding that
|
|
93
|
+
shifted lines is not a new finding). Line numbers and object ids are precisely what a pull request
|
|
94
|
+
changes without changing the defect.
|
|
95
|
+
|
|
96
|
+
The guard is the exception that shaped the design: it rolls `divergen` up **per pair**, not per
|
|
97
|
+
anchor, so a per-anchor census would fail to reconcile against a correct instrument. Its
|
|
98
|
+
reconciliation is therefore a partition — every pair is named exactly once, and a pair is in the
|
|
99
|
+
diverging set if and only if it is not clean. A pair that reports `rc: 0` while naming a broken
|
|
100
|
+
anchor is `IDENTIDADES_NO_RECONCILIAN`, which is how a self-contradictory payload is caught instead
|
|
101
|
+
of being read as a clean run.
|
|
102
|
+
|
|
103
|
+
## Where the instruments are found: two routes, and a promise
|
|
104
|
+
|
|
105
|
+
| route | when | `procedencia` | `commit` |
|
|
106
|
+
|---|---|---|---|
|
|
107
|
+
| `CLON` | `--raiz` names a directory of sibling checkouts, or they sit next to this repository | `CLON` | measured with `git rev-parse` |
|
|
108
|
+
| `PAQUETE` | no `--raiz`, no sibling, but the module is importable by this interpreter | `PAQUETE` | `null`: an installation has no history to read |
|
|
109
|
+
|
|
110
|
+
`--raiz` is a promise. Passing it means *measure exactly these checkouts*, so a missing sibling is
|
|
111
|
+
`INSTRUMENTO_AUSENTE` and an installed copy is never substituted for the tree that was asked about.
|
|
112
|
+
Omitting it means *find them*, which is the only route a consumer repository has: it has no four
|
|
113
|
+
sibling clones, and it installs the instruments into the environment instead.
|
|
114
|
+
|
|
115
|
+
A pin (`--pines archivo.json`, `{"instrumento": {"commit": …, "version": …}}`) is a **declaration**
|
|
116
|
+
and never a measurement. In `CLON` it is checked against the commit that was read (`VERIFICADO` /
|
|
117
|
+
`DIVERGE`); in `PAQUETE` it cannot be, and the row says `NO_VERIFICABLE` rather than claiming a
|
|
118
|
+
agreement it did not observe.
|
|
119
|
+
|
|
120
|
+
What makes the two routes comparable is the digest: `huella` is taken over the package's `.py`
|
|
121
|
+
files by **relative** path and content, so the same bytes installed under `site-packages/` and
|
|
122
|
+
checked out under `src/` seal identically. Measured on 2026-11-28 over the four instruments at
|
|
123
|
+
`git-complement-audit@1c73546`, `fiber-ast-lint@753a951`, `test-ordinal-ratchet@36e8b27`,
|
|
124
|
+
`ts-py-anchor-guard@02e8fe3`: **four of four huellas equal** between the installed and the checked
|
|
125
|
+
out copy, and the generator's huella equal too. Only `procedencia` and `commit` differ.
|
|
126
|
+
|
|
127
|
+
A tree somebody is writing has no digest. The walk lists `.py` files and then reads them, so a file
|
|
128
|
+
that a build removes in between used to raise `FileNotFoundError` out of the whole receipt — it did,
|
|
129
|
+
once in about 140 full suites, and read as flake. A directory that vanished was worse: `os.walk`
|
|
130
|
+
skips it silently and the digest that follows is a valid `sha256:` of a tree nobody has. The walk is
|
|
131
|
+
retried, and a tree that keeps moving answers `null` — `NO_MEDIDO`, never a number that reads as
|
|
132
|
+
one.
|
|
133
|
+
|
|
134
|
+
## The triage, and the reasons it publishes
|
|
135
|
+
|
|
136
|
+
Before any subprocess, the subject is read once — manifests, languages, test files, whether it is
|
|
137
|
+
a git tree — and each instrument is admitted or refused **by name**:
|
|
138
|
+
|
|
139
|
+
| reason | refused when |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `SIN_ARBOL_GIT` | the subject is not a git work tree (`git-complement-audit`) |
|
|
142
|
+
| `SIN_SUPERFICIE_PYTHON` | no `.py` file, tests included (`fiber-ast-lint`) |
|
|
143
|
+
| `SIN_ARCHIVOS_DE_PRUEBA` | no test file matched (`test-ordinal-ratchet`) |
|
|
144
|
+
| `SIN_SUPERFICIE_TYPESCRIPT` | no `.ts`/`.tsx` (`ts-py-anchor-guard`) |
|
|
145
|
+
| `SIN_MANIFIESTO_DE_ANCLA` | TypeScript but no `ts-py-anchor.json` or equivalent |
|
|
146
|
+
|
|
147
|
+
`--forzar-todos` skips the gate and runs all four. It exists to measure what the gate saves; it is
|
|
148
|
+
not for publishing a check.
|
|
149
|
+
|
|
150
|
+
## The receipt
|
|
151
|
+
|
|
152
|
+
`--json` writes the canonical form: sorted keys, `ensure_ascii=False`, two-space indent, one
|
|
153
|
+
trailing newline, and `sello` = `sha256` over that form without the seal. Every executor carries
|
|
154
|
+
its own identity — `version`, `commit` of its repository (`null` when installed), `huella`, a
|
|
155
|
+
`sha256` over its package's `.py` files by relative path and content, and `procedencia`. Five laws
|
|
156
|
+
are checked over the body (`schema: 2`):
|
|
157
|
+
|
|
158
|
+
| law | what it refuses |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `particion` | applicable + not applicable + not measured + not executed must equal the instrument count |
|
|
161
|
+
| `identidad_de_ejecutores` | an `APLICABLE` row without version and digest, or without a commit unless it is `PAQUETE` |
|
|
162
|
+
| `medido_es_numero` | an `APLICABLE` row whose findings are `null` |
|
|
163
|
+
| `hallazgos_nombrados` | an `APLICABLE` row whose findings are not the size of its own identity list |
|
|
164
|
+
| `estado_sin_medicion_nombra_su_razon` | any state other than `APLICABLE` with an empty reason |
|
|
165
|
+
|
|
166
|
+
A receipt that fails its own seal or its laws exits `3`, and nothing below it is worth reading.
|
|
167
|
+
|
|
168
|
+
### Determinism
|
|
169
|
+
|
|
170
|
+
No timestamp anywhere; `PYTHONHASHSEED=0`; `PYTHONDONTWRITEBYTECODE=1` so the runner never leaves a
|
|
171
|
+
`__pycache__` inside an instrument's checkout; every environment variable not on the allowlist
|
|
172
|
+
dropped; every list sorted; no absolute path in the receipt (the subject's path and `--raiz` are
|
|
173
|
+
masked as `<sujeto>` and `<herramientas>`). Two runs over one tree must produce the same bytes:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
frontera-runner /ruta/sujeto --json --recibo uno.json >/dev/null
|
|
177
|
+
frontera-runner /ruta/sujeto --json --recibo dos.json >/dev/null
|
|
178
|
+
cmp uno.json dos.json && echo "byte-identical"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Masking is what makes the seal portable, not just stable: the same tree copied to
|
|
182
|
+
`/tmp/clon-uno` and to `/tmp/clon-dos-con-nombre-mas-largo` (2 files, 1 test, no `.git`) produced
|
|
183
|
+
one seal, `sha256:d1c706c5e55b5…497`, from both paths.
|
|
184
|
+
|
|
185
|
+
Measured again on 2026-11-28 with the **real** instruments instead of fakes, and with live `.git`
|
|
186
|
+
history on both sides: one subject cloned to `/tmp/inv/a` and to
|
|
187
|
+
`/tmp/inv/una/ruta/bastante/mas/profunda/b`, run in `PAQUETE` mode, produced the byte-identical
|
|
188
|
+
receipt `8b009823e3654804…5e4b8` from both paths, and the same seal again on a second consecutive
|
|
189
|
+
run. Path invariance is a property of the digest, not of the length of the directory name.
|
|
190
|
+
|
|
191
|
+
### Exit codes of the runner
|
|
192
|
+
|
|
193
|
+
| code | meaning |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `0` | at least one instrument measured, all measured clean |
|
|
196
|
+
| `1` | measured, with findings: actionable |
|
|
197
|
+
| `2` | nothing measurable (`SIN_SUPERFICIE`) or a hole in the measurement (`HUECO_DE_MEDICION`) |
|
|
198
|
+
| `3` | the receipt failed its own seal or laws: not a verdict about the subject |
|
|
199
|
+
| `20` | bad invocation |
|
|
200
|
+
|
|
201
|
+
`2` outranks `1` in the sense that an unmeasured row is never read as a clean one; a finding still
|
|
202
|
+
exits `1`.
|
|
203
|
+
|
|
204
|
+
## The differential gate: `diff`
|
|
205
|
+
|
|
206
|
+
A seal nobody reads is decoration. In a pull request the reader is the comparison between the
|
|
207
|
+
receipt of `base.sha` and the receipt of `head.sha`:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
frontera-runner diff --base recibo-base.json --head recibo-head.json --md comentario.md
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The order of the checks is the contract, because each one makes the next meaningless:
|
|
214
|
+
|
|
215
|
+
1. **Both seals are recomputed before a single executor is read.** A body that no longer matches
|
|
216
|
+
its own digest is a document somebody edited; what it says about findings does not matter.
|
|
217
|
+
`SELLO_NO_RECOMPONE`. Both receipts must also close their laws (`LEYES_NO_CIERRAN`) and carry
|
|
218
|
+
the schema this reader knows: two different schemas are `ESQUEMAS_DISTINTOS`, and a pair that
|
|
219
|
+
agrees on an older schema is `RECIBO_NO_COMPARABLE` — a v1 receipt has no census to subtract.
|
|
220
|
+
2. **A measurement that disappeared is a loss, and a loss is never a resolution.** If an instrument
|
|
221
|
+
was `APLICABLE` in base and is not in head — the pull request deleted the anchor manifest, say —
|
|
222
|
+
the row is `PERDIDA_DE_MEDICION` with the count of findings that went unmeasured, and the gate
|
|
223
|
+
exits `2`. Reading that as "0 findings, all fixed" is the false green this repository exists to
|
|
224
|
+
refuse.
|
|
225
|
+
|
|
226
|
+
The same holds when neither side finished: an instrument that answered `NO_MEDIDO` — a timeout,
|
|
227
|
+
a crash, a line nobody can parse — is a hole, not an absence. A row with a hole on either side
|
|
228
|
+
is `MEDICION_NO_HECHA` and the gate exits `2`, because two sides that never measured cannot
|
|
229
|
+
agree that nothing regressed. Both sides `NO_APLICABLE` is the other thing: a measurement of
|
|
230
|
+
absence, and still green.
|
|
231
|
+
3. **An absence that the pull request fills is a surface the pull request creates.** When an
|
|
232
|
+
instrument was `NO_APLICABLE` in base — "nothing of mine to measure" — and is `APLICABLE` in
|
|
233
|
+
head, every finding on that new surface is the pull request's: the row is `SUPERFICIE_NUEVA`,
|
|
234
|
+
`atribuible: true`, and the gate exits `1`. A hole is not the same thing: a base that answered
|
|
235
|
+
`NO_MEDIDO` never measured, so its findings may predate the change and the row stays
|
|
236
|
+
`SIN_BASE_MEDIDA` with attribution withdrawn — green by default, because a pull request that
|
|
237
|
+
adds the first module of a new language should not be taxed for having no history. A gate over
|
|
238
|
+
a frozen route asks for `--estricto-base` and gets `2` on exactly that row instead of a guess.
|
|
239
|
+
The strict column can only add severity — `validar_notas` refuses a `rc_estricto` below the
|
|
240
|
+
note's `rc` or equal to `0`, so a flag that exists to withdraw greens cannot sign one.
|
|
241
|
+
Without the surface branch, adding the first TypeScript file next to a diverging Python port
|
|
242
|
+
would read as `SIN_REGRESION`. <!-- defecto: corrida 46076223056 ·
|
|
243
|
+
arreglo: corrida 46076838093, `REGRESION` RC 1 con `SUPERFICIE_NUEVA` publicado en el PR -->
|
|
244
|
+
4. **A delta produced by different bytes is not about the pull request.** If an executor's
|
|
245
|
+
`version`, `huella` or `procedencia` moved between the two receipts, the row is
|
|
246
|
+
`DELTA_NO_ATRIBUIBLE` and contributes nothing either way. Bumping an instrument is therefore
|
|
247
|
+
never silently green: `2`. Divergence needs two identities to diverge: a side that never ran
|
|
248
|
+
publishes none, so the identity of a `NO_APLICABLE` side is not compared.
|
|
249
|
+
5. **Only then** the multiset difference of the identity lists: `nuevos` (in head, not in base)
|
|
250
|
+
exits `1`; `resueltos` (in base, not in head) is reported and never fires the gate; nothing new
|
|
251
|
+
exits `0`.
|
|
252
|
+
|
|
253
|
+
| code | meaning |
|
|
254
|
+
|---|---|
|
|
255
|
+
| `0` | `SIN_REGRESION` — no finding in head that was not in base |
|
|
256
|
+
| `1` | `REGRESION` — at least one new finding, named, including findings on a surface this PR created |
|
|
257
|
+
| `2` | `PERDIDA_DE_MEDICION`, `MEDICION_NO_HECHA` or `DELTA_NO_ATRIBUIBLE` — the comparison stopped being about the PR; also `SIN_BASE_MEDIDA` under `--estricto-base` |
|
|
258
|
+
| `3` | the receipt could not be read as a receipt: seal, laws or schema |
|
|
259
|
+
| `20` | bad invocation (a receipt path that does not parse) |
|
|
260
|
+
|
|
261
|
+
A finding that was already in base is not a regression, and a finding that appears because an
|
|
262
|
+
instrument got *stricter* is `DELTA_NO_ATRIBUIBLE` rather than a regression — the gate refuses to
|
|
263
|
+
attribute it and says why.
|
|
264
|
+
|
|
265
|
+
### A note is a promise that something reads it
|
|
266
|
+
|
|
267
|
+
The row notes and the exit codes used to be maintained in three places — the branch that wrote the
|
|
268
|
+
note, the loop that counted it, and the function that turned the count into a code — and one note
|
|
269
|
+
was in none of them. `SIN_MEDICION_EN_NINGUNA_DE_LAS_DOS` was written by the classifier, read by
|
|
270
|
+
nobody, and a delta whose only row carried it came out `0 SIN_REGRESION` while an instrument was
|
|
271
|
+
timing out; the summary built for an unreadable receipt was a hand-written list that had already
|
|
272
|
+
lagged the real one by a field.
|
|
273
|
+
|
|
274
|
+
`recibo.NOTAS` is now the only place those live. A note carries its counter, its exit code, its
|
|
275
|
+
precedence and the paragraph the pull-request comment shows; `comparar` builds the summary by
|
|
276
|
+
walking that table, and `salida_de_comparacion` reads the code off it. `_nota()` refuses to write a
|
|
277
|
+
note with no row, so a seventh note cannot be born without a reader, and `validar_notas()` refuses a
|
|
278
|
+
row that forgot a column or invented one — at import, not at read time. `render` no longer compares
|
|
279
|
+
a note against a literal: it asks the table for the paragraph, which is why an eighth note arrives
|
|
280
|
+
explained. The tests that walk the nine state pairs and the whole catalogue only witness what the
|
|
281
|
+
mechanism already enforces.
|
|
282
|
+
|
|
283
|
+
## The portable reader: `ceros-implicitos`
|
|
284
|
+
|
|
285
|
+
The four instruments audit *this* corpus and need four sibling clones to do it. The census needs
|
|
286
|
+
nothing: one tree, one standard library, no configuration. It answers a single question that
|
|
287
|
+
outlives the corpus — **where does a tree write a zero it never measured?** — and it answers it the
|
|
288
|
+
same way on a checkout it has never seen:
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
ceros-implicitos <árbol> [--json] # the census, with its denominator
|
|
292
|
+
ceros-implicitos --base <base> <head> [--json] # the delta: what the change added
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
A finding is a `get(k, 0)` or an `k or 0`: a field that exists, counts zero, and is read
|
|
296
|
+
downstream as *clean*. A zero written by hand is not a measurement, it is an assertion, and the
|
|
297
|
+
consumer cannot tell the two apart. The census publishes `archivos`, `podados` and `ilegibles`
|
|
298
|
+
beside its findings because a `0` without a denominator does not say *none* — it says *not looked*.
|
|
299
|
+
|
|
300
|
+
Two copies of the same tree at different paths and depths census to the same bytes: where a tree
|
|
301
|
+
lives is the observer's property, what it writes is the tree's. Measured on two clones of one
|
|
302
|
+
Python service at depth one and three, and on the foreign trees this package was pointed at while
|
|
303
|
+
it was written — 36 files and 5 findings on one, 56 files and 10 on another, each difference in the
|
|
304
|
+
denominator explained by `podados` and none of it written.
|
|
305
|
+
|
|
306
|
+
### The gate is the difference of two censuses
|
|
307
|
+
|
|
308
|
+
A count is a diagnosis; a pull request needs a verdict. `--base` subtracts the two censuses by
|
|
309
|
+
**class** — file, key, shape — and never by line, because a refactor that moves a line has added
|
|
310
|
+
nothing and must not fail a job:
|
|
311
|
+
|
|
312
|
+
| code | meaning |
|
|
313
|
+
|---|---|
|
|
314
|
+
| `0` | `SIN_CEROS_NUEVOS` — the change adds no zero of a class the base did not already carry |
|
|
315
|
+
| `1` | `CON_CEROS_NUEVOS` — it does, and every new class is named with its file and its lines |
|
|
316
|
+
| `2` | the difference has no minuend or no subtrahend: `SIN_SUPERFICIE_EN_LA_BASE`, `SIN_SUPERFICIE_EN_HEAD`, `HUECO_DE_MEDICION_EN_*` |
|
|
317
|
+
| `20` | bad invocation — a path that is not a directory |
|
|
318
|
+
|
|
319
|
+
The hole outranks the finding here, unlike the single-tree census: if a side could not be read the
|
|
320
|
+
difference is unknown, and an unknown published as `0` is the false green the census exists to
|
|
321
|
+
refuse. A zero that moves from one file to another is a closure *and* an opening, because the file
|
|
322
|
+
is part of what the zero asserts. `--permitidos` accepts the classes someone has declared — a key,
|
|
323
|
+
or a whole expression for the `or 0` form that has no key to name — and applies to both sides.
|
|
324
|
+
|
|
325
|
+
### Use it in your repository
|
|
326
|
+
|
|
327
|
+
It has no dependencies and no assumption about where it is imported from: installed into a clean
|
|
328
|
+
3.11 environment it runs from `/` under `env -i`, and the census of a foreign tree reproduces byte
|
|
329
|
+
for byte the digest produced from inside this repository.
|
|
330
|
+
|
|
331
|
+
The whole act — checkout with full history, the interpreter, the install, the base tree as a
|
|
332
|
+
worktree, the invocation — is published as a reusable workflow. Adoption is one reference:
|
|
333
|
+
|
|
334
|
+
```yaml
|
|
335
|
+
# .github/workflows/ceros.yml — pin the tag, not a branch
|
|
336
|
+
on: [pull_request]
|
|
337
|
+
jobs:
|
|
338
|
+
ceros:
|
|
339
|
+
uses: alexisromtz-lab/frontera-runner/.github/workflows/reusable-ceros.yml@v0.2.0
|
|
340
|
+
with:
|
|
341
|
+
excluir: "bench,tests" # optional: declared scope, not a waiver
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
There is nothing to copy, so there is nothing that can silently diverge from the version that was
|
|
345
|
+
tested. If you would rather own every step, the same act spelled out is five lines of YAML:
|
|
346
|
+
|
|
347
|
+
```yaml
|
|
348
|
+
on: [pull_request]
|
|
349
|
+
jobs:
|
|
350
|
+
ceros:
|
|
351
|
+
runs-on: ubuntu-latest
|
|
352
|
+
steps:
|
|
353
|
+
- uses: actions/checkout@v4
|
|
354
|
+
with: { fetch-depth: 0 }
|
|
355
|
+
- run: python -m pip install --quiet "git+https://github.com/alexisromtz-lab/frontera-runner@v0.2.0"
|
|
356
|
+
- run: git worktree add --detach /tmp/base "${{ github.event.pull_request.base.sha }}"
|
|
357
|
+
- run: ceros-implicitos --base /tmp/base .
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The zeros that predate the pull request are not a problem and not a waiver: the base tree is the
|
|
361
|
+
minuend, so they subtract themselves and the gate measures only what the pull request adds. Nothing
|
|
362
|
+
has to be declared on day one. What a tree sometimes does need is a declared *scope* — if it keeps
|
|
363
|
+
tally dictionaries over a benchmark population, `--excluir bench` measures the product surface and
|
|
364
|
+
says so out loud, which is not the same as excusing by name.
|
|
365
|
+
|
|
366
|
+
### Measured on somebody else's repository
|
|
367
|
+
|
|
368
|
+
Two repositories that are not this one run the gate on every pull request, both through the one-line
|
|
369
|
+
reference and without touching their governed `ci.yml`:
|
|
370
|
+
[fiber-ast-lint](https://github.com/alexisromtz-lab/fiber-ast-lint) (declared scope `bench,tests`)
|
|
371
|
+
and [protocol-core](https://github.com/alexisromtz-lab/protocol-core) (no scope at all — its five
|
|
372
|
+
pre-existing zeros subtract themselves).
|
|
373
|
+
|
|
374
|
+
Green on a clean pull request — `SIN_CEROS_NUEVOS`, RC 0, `nuevos 0`, `permanecen 2` (two call
|
|
375
|
+
tallies that predate the branch and subtract themselves):
|
|
376
|
+
[runs/46106495910](https://github.com/alexisromtz-lab/fiber-ast-lint/actions/runs/46106495910).
|
|
377
|
+
|
|
378
|
+
Red on a probe added on purpose — a module with `d.get("saldo_pendiente", 0)` — while the rest of
|
|
379
|
+
that repository's checks stayed green:
|
|
380
|
+
`CON_CEROS_NUEVOS`, RC 1, `nuevos 1`, and the finding named by file, key, shape and line:
|
|
381
|
+
[runs/46106593465](https://github.com/alexisromtz-lab/fiber-ast-lint/actions/runs/46106593465).
|
|
382
|
+
|
|
383
|
+
Those two runs are the five-step form. The reusable workflow was falsified the same way rather than
|
|
384
|
+
assumed equivalent: the one-line PR went green reporting `permanecen 2` (it subtracted a real base,
|
|
385
|
+
it did not skip the delta), and a probe through the same one line went red with
|
|
386
|
+
`nuevos 1` and the offending row:
|
|
387
|
+
[runs/46120591144](https://github.com/alexisromtz-lab/fiber-ast-lint/actions/runs/46120591144).
|
|
388
|
+
|
|
389
|
+
A green that never turns red has not shown that it measures, so both directions are published — for
|
|
390
|
+
the copy and for the reference.
|
|
391
|
+
|
|
392
|
+
## The age partition travels with the audit row
|
|
393
|
+
|
|
394
|
+
`git-complement-audit` dates every row it reports by the newest ref tip whose tree still holds that
|
|
395
|
+
path with that content, and partitions the refs into `<= 30 d`, `31–90 d`, `> 90 d`. A raw count of
|
|
396
|
+
"refs outside `HEAD`" invites the answer *those are old branches from years ago*, which is not an
|
|
397
|
+
answer to *what is still moving*. The composite receipt carries the partition:
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
paths_fuera_de_head=1 · blobs_fuera_de_head=1 · refs=2 · refs_vivas_30d=2 · refs_recientes_90d=0
|
|
401
|
+
· refs_inactivas=0 · refs_sin_fecha=0 · filas_vivas_30d=1 · filas_recientes_90d=0
|
|
402
|
+
· filas_inactivas=0 · filas_solo_historia=0 · estratos_reconcilian=sí
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
When the instrument does not publish the partition, those keys are `NO_MEDIDO` — never `0`.
|
|
406
|
+
|
|
407
|
+
## Measured, on four hand-built subjects
|
|
408
|
+
|
|
409
|
+
Every number below comes from running the four real instruments from their own checkouts
|
|
410
|
+
(`--raiz /Users/marlene`), twice per subject, on 2026-11-27. The subjects were deleted afterwards.
|
|
411
|
+
|
|
412
|
+
| subject | surface | rc | states | Markdown | two runs |
|
|
413
|
+
|---|---|---|---|---|---|
|
|
414
|
+
| `fs-a` — TS + Python + tests, and one branch left outside `HEAD` | 6 files · py 3 · tests 2 · ts 1 | `1` | 4 applicable, 1 with findings | 3 175 B | byte-identical |
|
|
415
|
+
| `fs-b` — the same tree, nothing outside `HEAD` | 6 files · py 3 · tests 2 · ts 1 | `0` | 4 applicable | 3 167 B | byte-identical |
|
|
416
|
+
| `fs-c` — Python only, not a git tree | 1 file · py 1 · tests 0 · ts 0 | `0` | 1 applicable · 3 `NO_APLICABLE` | 2 087 B | byte-identical |
|
|
417
|
+
| `fs-d` — a git tree with no files | 0 files | `0` | 1 applicable · 3 `NO_APLICABLE` | 2 755 B | byte-identical |
|
|
418
|
+
|
|
419
|
+
`fs-c` and `fs-d` are the case the whole repository is about: without the gate, both exit `2`
|
|
420
|
+
because an instrument that cannot run is a hole. With it, the two refusals are named and the verdict
|
|
421
|
+
is `0`.
|
|
422
|
+
|
|
423
|
+
### What the triage actually saves
|
|
424
|
+
|
|
425
|
+
Median of five runs, same machine, `--json` only, two separate sessions. Wall clock on a shared
|
|
426
|
+
laptop: read the ratio, not the absolute seconds.
|
|
427
|
+
|
|
428
|
+
| subject | triaged | `--forzar-todos` | saved | instruments skipped |
|
|
429
|
+
|---|---|---|---|---|
|
|
430
|
+
| `fs-a` (all four applicable) | 1.488 s | 1.643 s | 9.4 % | 0 |
|
|
431
|
+
| `fs-c` (one applicable) | 0.875 s | 1.536 s | 43.1 % | 3 |
|
|
432
|
+
| `fs-d` (one applicable) | 1.155 s | 1.655 s | 30.2 % | 3 |
|
|
433
|
+
|
|
434
|
+
The same three subjects measured in an earlier session: `fs-a` 0.799 s vs 0.734 s (**−8.9 %**: the
|
|
435
|
+
gate cost 65 ms), `fs-c` 0.195 s vs 0.630 s (69.1 %), `fs-d` 0.466 s vs 0.788 s (40.8 %). `fs-a`
|
|
436
|
+
changes sign between the two sessions, and that is the honest reading: where the gate skips nothing,
|
|
437
|
+
its cost is noise around zero.
|
|
438
|
+
|
|
439
|
+
So the ≥ 40 % half of the hypothesis holds where the hypothesis was aimed — repositories without
|
|
440
|
+
surface, 30–69 % depending on load — and is falsified as a general claim: the saving equals the cost
|
|
441
|
+
of the instruments the gate skips. Three subjects measured before those (a Python tree with tests,
|
|
442
|
+
the audit's own checkout, the ratchet's own checkout) saved 0–8 %.
|
|
443
|
+
|
|
444
|
+
## Tests
|
|
445
|
+
|
|
446
|
+
Standard library only, eighty-three tests, four fake instruments written to a temporary `--raiz` so
|
|
447
|
+
the subprocess boundary is exercised rather than mocked:
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
/opt/homebrew/bin/python3.14 -m unittest discover -s tests
|
|
451
|
+
/opt/homebrew/bin/python3.14 -m frontera_runner --self-test
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
The fakes answer through `<subject>/.fake/<instrument>.json`, because the environment is allowlisted
|
|
455
|
+
and the subject is the only channel the runner leaves open on purpose. The suite covers the triage
|
|
456
|
+
refusals, the entire exit-code mapping including the `2` trap, a crashing instrument, a timeout, a
|
|
457
|
+
missing instrument, seal recomputation and tamper detection, byte identity across two runs,
|
|
458
|
+
`NO_MEDIDO` where the instrument omitted its counters, and the 65 536-character cut. On top of
|
|
459
|
+
that, the `diff` contract (a receipt tampered with in one byte is `3`, a finding already in base is
|
|
460
|
+
not a regression, a deleted measurement is `2` and never "resolved", the guard's per-pair
|
|
461
|
+
partition), the two resolution routes, and path invariance: two clones of one subject at two depths,
|
|
462
|
+
two different `--raiz`, one seal — with the fixtures' commits pinned to a fixed date, because
|
|
463
|
+
otherwise the digest of a fake repository depends on the second it was created in. The package's
|
|
464
|
+
own AST is read too: no field may be given a hand-written zero default, and the same reader is a
|
|
465
|
+
tool —`python -m frontera_runner.ceros <árbol>`— that any repository can point at its own tree. It
|
|
466
|
+
publishes the surface it walked (`archivos`, `podados`, `ilegibles`) in the same object as its
|
|
467
|
+
findings, because a `0` without a denominator says *not looked*, not *none*; a file that does not
|
|
468
|
+
parse is `HUECO_DE_MEDICION` and a tree with no Python at all is `SIN_SUPERFICIE`, both `2`. The
|
|
469
|
+
census is falsified four ways: by a file that writes a zero in front of it, by a legitimate zero
|
|
470
|
+
named in the call, by a zero one directory down that a top-level walk would miss, and by two
|
|
471
|
+
copies of one tree at two depths having to publish one identical object.
|
|
472
|
+
|
|
473
|
+
## Boundaries
|
|
474
|
+
|
|
475
|
+
- **No imports of instrument internals.** Everything is a subprocess with a declared command. An
|
|
476
|
+
instrument that only works from its own working directory fails here instead of passing quietly.
|
|
477
|
+
- **No writes into an instrument's repository.** `PYTHONDONTWRITEBYTECODE=1`, no baseline rewriting,
|
|
478
|
+
nothing but reads.
|
|
479
|
+
- **Its own repository.** This runner is not vendored into any instrument. It finds them two ways
|
|
480
|
+
and never mixes them: `--raiz` names sibling checkouts (default: the parent of this repository),
|
|
481
|
+
and with no `--raiz` an absent sibling falls back to the package installed in this interpreter.
|
|
482
|
+
An explicit `--raiz` that is missing an instrument is a hole, not a fallback.
|
|
483
|
+
- **Zero third-party dependencies.** Standard library only, Python 3.11 or newer (`tomllib`).
|
|
484
|
+
|
|
485
|
+
## License
|
|
486
|
+
|
|
487
|
+
MIT.
|