ai-test-loop 1.2.4__tar.gz → 1.4.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.
Files changed (28) hide show
  1. {ai_test_loop-1.2.4/ai_test_loop.egg-info → ai_test_loop-1.4.0}/PKG-INFO +93 -194
  2. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/README.md +92 -193
  3. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/__init__.py +1 -1
  4. ai_test_loop-1.4.0/ai_test_loop/probes/hygiene.py +86 -0
  5. ai_test_loop-1.4.0/ai_test_loop/probes/hygiene_guard.py +178 -0
  6. ai_test_loop-1.4.0/ai_test_loop/probes/jogo.py +133 -0
  7. ai_test_loop-1.4.0/ai_test_loop/scripts/action_guard.py +114 -0
  8. ai_test_loop-1.4.0/ai_test_loop/scripts/bakeoff.py +226 -0
  9. ai_test_loop-1.4.0/ai_test_loop/scripts/game_guard.py +356 -0
  10. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/scripts/gate_core.py +11 -2
  11. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/scripts/loop_runner.py +379 -21
  12. ai_test_loop-1.4.0/ai_test_loop/scripts/regression_ledger.py +166 -0
  13. ai_test_loop-1.4.0/ai_test_loop/scripts/release_critic.py +366 -0
  14. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/scripts/repo_probe.py +310 -7
  15. ai_test_loop-1.4.0/ai_test_loop/scripts/sync_copies.py +101 -0
  16. ai_test_loop-1.4.0/ai_test_loop/scripts/vistoria.py +108 -0
  17. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0/ai_test_loop.egg-info}/PKG-INFO +93 -194
  18. ai_test_loop-1.4.0/ai_test_loop.egg-info/SOURCES.txt +25 -0
  19. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/pyproject.toml +1 -1
  20. ai_test_loop-1.2.4/ai_test_loop.egg-info/SOURCES.txt +0 -15
  21. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/LICENSE +0 -0
  22. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/MANIFEST.in +0 -0
  23. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/__main__.py +0 -0
  24. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop/scripts/__init__.py +0 -0
  25. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop.egg-info/dependency_links.txt +0 -0
  26. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop.egg-info/entry_points.txt +0 -0
  27. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/ai_test_loop.egg-info/top_level.txt +0 -0
  28. {ai_test_loop-1.2.4 → ai_test_loop-1.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-test-loop
3
- Version: 1.2.4
3
+ Version: 1.4.0
4
4
  Summary: Deterministic critic for AI agents: runs weighted checks for real, scores 0-100 and blocks the delivery when it should.
5
5
  Author: Samuel Medeiros
6
6
  License: MIT
@@ -21,6 +21,8 @@ Dynamic: license-file
21
21
 
22
22
  # ai-test-loop
23
23
 
24
+ *[Português](README.pt-BR.md)*
25
+
24
26
  **Your agent grades its own homework.** This makes that impossible: a critic script runs real checks,
25
27
  scores the artifact 0–100, and a fail-closed gate blocks delivery below the threshold.
26
28
 
@@ -41,7 +43,7 @@ when the agent is about to declare work done:
41
43
  npx ai-test-loop --repo https://github.com/you/your-project
42
44
  ```
43
45
 
44
- Real output from a project that had no config at all:
46
+ Real output from a project that had no config at all (the CLI prints in Portuguese, pt-BR, today — an English output mode is not shipped yet):
45
47
 
46
48
  ```
47
49
  PASS testes automáticos (npm) w=40.0 3.93s 8 passed
@@ -288,233 +290,130 @@ Telemetry never blocks and never waits: if the network is down the CLI runs exac
288
290
  Throwaway exploration, spike branches, and one-line answers where the cost of the loop exceeds the
289
291
  cost of being wrong. It is for artifacts a human will rely on.
290
292
 
291
- ## Files
292
-
293
- | Path | What |
294
- |---|---|
295
- | `bin/cli.js` | the `npx` entry point (wrapper + telemetry) |
296
- | `scripts/loop_runner.js` | the deterministic critic, Node port — zero dependencies |
297
- | `scripts/loop_runner.py` | the same critic in Python (used by the pip package) |
298
- | `scripts/selftest.js` | 22 assertions covering every way a check can fail — `npm test` |
299
- | `SKILL.md` | the loop, the scoring rules, the fail-closed gate — drop it in your agent's skills dir |
300
- | `references/reviewer-prompt.md` | independent-review prompt, strict JSON output |
301
- | `references/scoring-rubric.md` | starting weights |
302
- | `templates/loop.example.json` | config with the usual check set |
303
-
304
- `npm test` runs the selftest. It needs nothing but node.
293
+ ## Game projects (Unity, Godot, Unreal)
305
294
 
306
- ## Get the full pack
307
-
308
- This repo is the free, complete tool. The store has the ready-made packs for the cases where
309
- writing the checks is the slow part — CI gates, visual regression, MCP servers, MLOps guards:
310
-
311
- - Free download / e-mail delivery: **https://skills.seu.pet/gratis/ai-test-loop?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
312
- - Full pack: **https://skills.seu.pet/en/p/pack-completo?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
313
- - Catalog: **https://skills.seu.pet/?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
314
- - Want it installed and wired into your repo: **https://skills.seu.pet/servico?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
315
-
316
- ## License
317
-
318
- MIT — see `LICENSE`. Use it commercially, fork it, ship it.
319
-
320
- ---
321
-
322
- ### Em português
323
-
324
- O loop de teste para agentes: o construtor não assina o próprio trabalho. Um crítico roda checagens
325
- de verdade, dá nota 0–100 e barra a entrega abaixo do limite.
295
+ A game repo is the case this tool used to miss completely: no `package.json`, no
296
+ `pyproject.toml`, so the quick mode answered "nothing ran" — on the artifact where
297
+ quality breaks the most. Measured on the Super Hero Royale streams (Dec 2026).
326
298
 
327
299
  ```bash
328
- npx ai-test-loop --config loop.json # não precisa de Python
300
+ npx ai-test-loop --repo . --vistoria
329
301
  ```
330
302
 
331
- Sem chave de API, sem dependência, sem chamada de modelo. Versão com entrega por e-mail e os packs
332
- prontos: https://skills.seu.pet/gratis/ai-test-loop?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop
333
-
334
- ## Integridade do runner e do contrato (v1.1.2, 12/11/2026)
335
-
336
- O gate era decorativo porque **quem escreve o config é quem é avaliado**. Quatro
337
- furos medidos por exploit e fechados nesta versão:
338
-
339
- ### 1. O crítico não pode ser editável pelo réu
303
+ ```
304
+ ┌────────────────────────────────────────────────┐
305
+ NOTA 15/100 ( Precisa de 85 ) → REPROVADO
340
306
 
341
- `config_sha256` congela a régua, não o código que lê a régua. O agente pode
342
- reescrever `score()` para `return 100.0` e o hash de config não percebe.
343
- Agora o runner publica `runner: {version, py_sha256, js_sha256}` no relatório e
344
- comparar com o hash esperado é papel do orquestrador, que vive **fora** do repo:
307
+ 1. nenhum laço sem freio — Print.cs:4 captura em Update()
308
+ 2. log com exceção/crash: Logs/Editor.log:1
309
+ 3. .gitignore não ignora: Library, Temp, Logs
345
310
 
346
- ```bash
347
- python3 ~/.hermes/scripts/roger-runner-pin.py pin --by "<quem>"
348
- python3 ~/.hermes/scripts/roger-runner-pin.py check # exit 3 se divergir
349
- ROGER_RUNNER_PY_SHA256=$(python3 ~/.hermes/scripts/roger-runner-pin.py env --key py) \
350
- ./loop_runner.py --config loop.json
311
+ Não deu para verificar (1): compilação do jogo (dotnet)
312
+ └────────────────────────────────────────────────┘
351
313
  ```
352
314
 
353
- Hash divergente → `GATE=blocked`, exit 3, `motivo=runner_drift`. O caso legítimo
354
- exige `--approve-runner --approve-runner-reason "<por quê>"` — aceitar sem motivo
355
- não é aceitar.
315
+ What the game profile checks, without the engine installed:
356
316
 
357
- ### 2. O fingerprint deriva do schema
317
+ | Check | Catches |
318
+ |---|---|
319
+ | `dotnet build` on the solution | the "remendo" that does not compile |
320
+ | EditMode tests (`dotnet test`) | only when a test project exists |
321
+ | `unity-project` | `ProjectVersion.txt` missing / unpinned |
322
+ | `unity-gitignore` | `Library/`, `Temp/`, `Logs/` about to be committed |
323
+ | `unity-untracked` | cache already committed (blows up every scan) |
324
+ | `elprint-guard` | `CaptureScreenshot`/`Debug.Log` inside `Update()` or `while(true)` without throttle — the tool that burned a monthly token budget live |
325
+ | `log-limpo` | exception or crash recorded in `Logs/` |
358
326
 
359
- Lista literal de campos atrasa o próximo adendo: `strict_tests`, `min_passed` e
360
- `allow_skipped` chegaram depois e ficaram **fora** do hash. O hash agora deriva de
361
- `TOP_LEVEL_KEYS`/`CHECK_KEYS`, e `tests/test_fingerprint_schema.py` falha quando o
362
- loader conhece uma chave que o schema não cobre. Foi esse teste que encontrou
363
- `cwd` fora do hash.
327
+ What it cannot judge (PlayMode tests, scene screenshots, in-engine profiling) is
328
+ reported as "could not check" with the reason — never as failure, never as pass.
364
329
 
365
- ### 3. `--approve` não é auto-serviço
330
+ ## Regression ledger — the bug that comes back
366
331
 
367
- O ID de aprovação é **derivado do drift** (`sha256(expected+actual)[:8]`) e
368
- `--approve-by <nome>` é obrigatório. O state guarda `approval_snapshot` com o
369
- drift e a config do momento — sem ele auditar depois é impossível.
332
+ The measured failure this fixes: the agent says "fixed it", the defect is back the
333
+ next day, and the report treats both runs the same. `--baseline` gives each
334
+ failure a stable signature (line numbers, timings and counts do NOT create a new
335
+ one) and a failure that returns becomes a **blocking gap**, not a score deduction:
370
336
 
371
337
  ```bash
372
- # o bloqueio imprime o id correto:
373
- GATE=blocked — motivo=config_drift: regua alterada sem aprovacao (a1b2 -> c3d4);
374
- reexecute com --approve 7f3a91cc --approve-by <nome>
338
+ npx ai-test-loop --repo . --vistoria # round 1: novas=1 recorrentes=0
339
+ npx ai-test-loop --repo . --vistoria # round 2: GATE=blocked — regressão
340
+ npx ai-test-loop --repo . --reset-baseline # new cycle (not a lie: it resets)
375
341
  ```
376
342
 
377
- ### 4. `blocking_gaps` bloqueia (exit 3), não desconta
378
-
379
- Lista de regex case-insensitive no topo do config. Gap que casa invalida a
380
- entrega mesmo com score acima do threshold. Regex inválido bloqueia
381
- (fail-closed): padrão mal escrito não vira porta aberta.
382
-
383
- ### Contagem de testes: JUnit XML manda
384
-
385
- `junit_xml: "<arquivo>"` no check torna a contagem autoritativa — escrita pelo
386
- framework, independe de `-q`/`-v`. O parser por linha de progresso (`.sxXFE`)
387
- continua como fallback informativo, porque `-v` imprime nome de teste e cega o
388
- parser. Saída mentirosa ("5 passed") perde para o XML real.
389
-
390
- ---
391
-
392
- # MIGRAÇÃO 1.1.x → 1.2.0 (breaking para configs antigos)
393
-
394
- **O que mudou:** `required: true` sem `severity` deixou de ser aceito. Antes o
395
- check era "bloqueante ou pontuável" a depender de quem lia o config — ambiguidade
396
- que o próprio agente avaliado podia explorar. Agora é **erro de carga**.
397
-
398
- **Quem é afetado:** qualquer config com `required: true` e sem `severity`. Se a
399
- sua instalação atualiza por `pip` ou `npx` e não tinha `severity`, a próxima
400
- execução termina com:
401
-
402
343
  ```
403
- [loop_runner] invalid config: check 'nome': required=true sem severity
404
- [loop_runner] para corrigir automaticamente: loop_runner.py --config <arquivo> --migrate-config
344
+ REGRESSOES: novas=0 recorrentes=1 corrigidas=0 em_aberto=1
405
345
  ```
406
346
 
407
- **Como migrar (um comando, com backup automático):**
408
-
409
- ```bash
410
- # 1. ver o que mudaria, sem tocar em nada
411
- loop_runner.py --config seu-loop.json --migrate-config --dry-run
412
-
413
- # 2. aplicar (grava seu-loop.json.bak-pre-migrate antes)
414
- loop_runner.py --config seu-loop.json --migrate-config
415
-
416
- # Node/npx
417
- npx ai-test-loop --config seu-loop.json --migrate-config
418
- ```
419
-
420
- A regra da migração assume a intenção original: `required: true` significava
421
- "quero isso bloqueando", então vira `severity: "block"`. Se a intenção era só
422
- pontuar, troque para `severity: "score"` depois — o importante é que a decisão
423
- seja explícita em vez de depender do leitor.
424
-
425
- `strict_tests: true` também completa `allow_skipped: false` nos checks que não
426
- declaram o campo (era o efeito implícito até a 1.1.2).
427
-
428
- **Idempotente:** rodar de novo imprime "nada a migrar".
347
+ ## Budget and the action contract
429
348
 
430
- ---
431
-
432
- # Mapa de severidade por classe de falha (v1.2.0)
433
-
434
- Gap que vira desconto de ponto é gap que ninguém corrige. A varredura dos **62
435
- critics** extraiu **257 gaps literais** de `gaps.append(...)` e classificou cada
436
- um por classe de falha. Padrão que não casa nenhum gap real é teatro e foi
437
- removido na validação.
349
+ - `--budget-s 300`: a round that runs out of time reports the unrun checks as
350
+ "could not check" and prints `PARTIAL=n`. It never converts a timeout into a
351
+ project failure, and it never spends the whole night without telling you.
352
+ - `ATL_ACTION_LOG=<file>`: every file changed in the repo must be cited in an
353
+ `AÇÃO:` line of the worker's report — the "closed the game without saying a word"
354
+ case. An action declared without any path also fails, listing the files.
438
355
 
439
- **Bloqueiam (exit 3):** segredo · seguranca · antifraude · testes · build ·
440
- cobertura · deploy · dados · ui · generico
356
+ `npx ai-test-loop --help` lists all flags. The full test suite (222 assertions:
357
+ game mode, ledger, budget, action contract, card, bake-off, parity) runs with
358
+ `python3 tests/ -q` in the repo.
441
359
 
442
- **Não bloqueiam:** estilo (reversível em segundos) · infra (tem watchdog próprio;
443
- bloquear aqui duplica o alarme no canal errado) · ambiente (`NÃO VERIFICÁVEL` é
444
- ausência de prova, não prova de falha)
445
360
 
446
- ## Precedência
361
+ ## Automatic, and honest about what it cannot judge (02/12/2026)
447
362
 
448
- O primeiro padrão que casar decide. Sem ordem, `test/front-audit.mjs ausente —
449
- sem medição no navegador` casaria `testes` (bloqueia) e `ambiente` (aviso), e o
450
- gap escaparia do bloqueio.
363
+ Nothing to configure for the usual stacks — and when a stack is new, Roger says
364
+ what it can and cannot measure instead of guessing:
451
365
 
452
366
  ```
453
- 1. segredo 2. seguranca 3. antifraude 4. testes
454
- 5. build 6. cobertura 7. deploy 8. dados
455
- 9. ui 10. generico 11. estilo 12. infra 13. ambiente
367
+ $ npx ai-test-loop --repo ./engine-nova
368
+ FAIL README presente w=15
369
+ FAIL nenhum segredo versionado w=25
370
+ ...
371
+ Não deu para verificar: testes automáticos (nenhuma suíte detectada)
456
372
  ```
457
373
 
458
- ## Resultado medido
459
-
460
- Antes: 3 critics bloqueavam, 59 descontavam ponto. Gap de credencial vazada em
461
- arquivo versionado valia −5 num rubric de 100.
462
-
463
- Depois: 199 padrões bloqueantes nas 53 configs; 257/257 gaps classificados,
464
- 0 órfãos. Verificação contra o orquestrador real — 12/12 casos no veredito
465
- esperado (8 bloqueiam, 4 passam).
466
-
467
- Mapa versionado em `~/.hermes/profiles/ajudante/state/mapa-severidade-62-critics.json`;
468
- `tests/test_severidade_mapa.py` falha se uma classe bloqueante ficar sem gap real
469
- (regex morto = trava decorativa).
374
+ Detect in three layers: project markers, then the CONTENT of the code, then a
375
+ command that actually exists on the machine. New stacks enter as a file in
376
+ `probes/` (`probes/jogo.py` for Unity/Godot/Unreal, `probes/hygiene.py` as the
377
+ floor that runs everywhere) — never as an edit to the runner, and never as a
378
+ config you have to write.
470
379
 
471
- ## Mutation testing do gate (v1.2.0)
380
+ `tests/test_probes.py` proves the extension point: drop a file in `probes/` and
381
+ it shows up in the scan, and the Node mirror returns the same check list.
472
382
 
473
- **Score medido: 78,1%** (353 de 452 mutantes mortos, piso 70% no CI).
474
-
475
- O alvo é `scripts/gate_core.py` — as funções que **decidem bloqueio**
476
- (`score`, os dois fingerprints, `drift_approval_id`, `migrate_config`,
477
- `validate_config`, `parse_junit_xml`, `parse_test_counts`). Elas foram extraídas do
478
- `loop_runner.py` em 12/11/2026 por um motivo medido: o runner tem 864 linhas e o
479
- mutmut expande o módulo inline para 21 MB — compilar o arquivo mutado levava mais de
480
- 180s e a rodada de 1827 mutantes nunca terminava.
481
-
482
- Por que isso importa mais que o meta-gate: o meta-gate do §10 prova que **um caso**
483
- passa. Mutation testing prova que a suíte **pega regressão**.
484
-
485
- ### Rodar localmente
486
-
487
- ```bash
488
- pip install mutmut pytest
489
- mutmut run # ~20s, 452 mutantes
490
- mutmut results # lista os sobreviventes
491
- mutmut export-cicd-stats # killed/survived/total em JSON
492
- ```
383
+ ## Files
493
384
 
494
- No CI (`.github/workflows/loop.yml`, job `mutation`, `needs: critic`) o piso é 70%,
495
- e o job também falha se nenhum mutante for gerado — alvo removido é medição
496
- ausente, não aprovação.
385
+ | Path | What |
386
+ |---|---|
387
+ | `bin/cli.js` | the `npx` entry point (wrapper + telemetry) |
388
+ | `scripts/loop_runner.js` | the deterministic critic, Node port — zero dependencies |
389
+ | `scripts/loop_runner.py` | the same critic in Python (used by the pip package) |
390
+ | `probes/` | stack registry: `jogo` (Unity/Godot/Unreal) and `hygiene` (the floor for any stack) |
391
+ | `scripts/repo_probe.{py,js}` | quick mode: detects the project, builds the checks |
392
+ | `scripts/game_guard.{py,js}` | game-project guards (Unity cache, El Print, log) |
393
+ | `scripts/regression_ledger.{py,js}` | `--baseline` ledger of failures that return |
394
+ | `scripts/action_guard.{py,js}` | every change must be declared in an `AÇÃO:` line |
395
+ | `scripts/vistoria.{py,js}` | the 10-line card, pt-BR, no jargon |
396
+ | `scripts/bakeoff.py` | N builders, same ruler, comparative score (pip only) |
397
+ | `scripts/selftest.js` | 22 assertions covering every way a check can fail — `npm test` |
398
+ | `SKILL.md` | the loop, the scoring rules, the fail-closed gate — drop it in your agent's skills dir |
399
+ | `references/reviewer-prompt.md` | independent-review prompt, strict JSON output |
400
+ | `references/scoring-rubric.md` | starting weights |
401
+ | `templates/loop.example.json` | config with the usual check set |
497
402
 
498
- ### Três armadilhas que custaram rodadas
403
+ `npm test` runs the selftest. It needs nothing but node. The repo suite
404
+ (`python3 tests/ -q`) adds the game mode, the regression ledger, the action
405
+ contract, the card and the Py/Node parity tests.
499
406
 
500
- 1. **Teste que chama o runner por `subprocess` não mata mutante.** 9 dos 10 arquivos
501
- de teste executam `loop_runner.py` como processo; dentro de `mutants/` o runner
502
- não acha a config do mutmut, sai com erro de ambiente e o mutante morre por
503
- crash. Todos parecem mortos e o score mede o sandbox, não os testes. Só
504
- `pytest_add_cli_args_test_selection` com os arquivos que **importam** o módulo.
505
- 2. **Import tem de ser qualificado** (`from scripts.gate_core import ...`). Com
506
- `import gate_core` bare, as trampolines saem como `gate_core.x_...` contra
507
- `scripts.gate_core.x_...` esperadas e o mutmut aborta.
508
- 3. **`do_not_mutate = ["mutants/*"]` é obrigatório** — sem ele o mutmut copia a
509
- própria árvore mutada dentro de si e a geração não termina.
407
+ ## Get the full pack
510
408
 
511
- ### Dois bugs que a mutação revelou
409
+ This repo is the free, complete tool. The store has the ready-made packs for the cases where
410
+ writing the checks is the slow part — CI gates, visual regression, MCP servers, MLOps guards:
512
411
 
513
- Os mutantes sobreviventes em `parse_test_counts` não eram só falta de cobertura:
412
+ - Free download / e-mail delivery: **https://skills.seu.pet/gratis/ai-test-loop?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
413
+ - Full pack: **https://skills.seu.pet/en/p/pack-completo?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
414
+ - Catalog: **https://skills.seu.pet/?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
415
+ - Want it installed and wired into your repo: **https://skills.seu.pet/servico?utm_source=pypi&utm_medium=readme&utm_campaign=ai-test-loop**
514
416
 
515
- - `Tests: 2 skipped, 10 passed, 12 total` (jest/vitest) era contado **duas vezes**
516
- — pelo parser específico e pelo regex genérico — virando `passed: 21`;
517
- - `Test Suites: 1 passed` era somado como teste, inflando `passed` de 10 para 11.
417
+ ## License
518
418
 
519
- Nos dois casos o efeito era o mesmo: `min_passed` passava com **menos testes reais**
520
- do que o exigido. Corrigido, com regressão em `tests/test_gate_parsing.py` (39 testes).
419
+ MIT — see `LICENSE`. Use it commercially, fork it, ship it.