Skip to content

ci: execute pytest once on the coverage leg (W1-3) - #475

Merged
cdeust merged 3 commits into
mainfrom
ci/green-single-pytest
Sep 6, 2026
Merged

ci: execute pytest once on the coverage leg (W1-3)#475
cdeust merged 3 commits into
mainfrom
ci/green-single-pytest

Conversation

@cdeust

@cdeust cdeust commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Symptôme

W1-3 / F14 : la jambe Python 3.12 exécutait toute la suite deux fois,
dont une seconde fois pour produire la couverture. PR empilée sur #471.

Cause racine

Deux étapes pytest distinctes étaient actives quand run-extended-checks
valait true.

Changement

Une seule invocation pytest construit ses arguments dans un tableau Bash.
La jambe étendue conserve les rapports XML/terminal et le seuil existant de
82 %, sourcé dans le workflow. Les autres jambes gardent leurs arguments.
Le contrôle du contrat MCP, la collecte sans exécution servant au compteur
de tests, le badge et l'upload de couverture restent actifs.

Preuve

Au commit 03e884a3, gates locaux ordonnés verts : Ruff 1 416 fichiers,
craftsmanship et Pyright zéro diagnostic ; tests scripts 825 passed,
5 skipped, 280 subtests ; suite complète 7 572 passed, 221 skipped,
280 subtests en 145,65 s. Les skips PostgreSQL locaux sont explicites
(endpoint isolé indisponible localhost:1), aucune base de production utilisée.
Charge initiale 3,32 / 10 cœurs, 66 GiB libres avant/après.

Six sondes Bash contre l'action réelle vérifient une seule invocation,
les arguments avec/sans couverture, les entrées non booléennes et la
propagation d'un échec pytest. Log local :
/private/tmp/cortex-green-w1-3-gates.log.

uv sync --locked --no-default-groups --extra dev --extra sqlite --group lint
.venv/bin/ruff check
.venv/bin/ruff format --check
.venv/bin/python scripts/check_craftsmanship.py
uv sync --locked --no-default-groups --extra dev --extra postgresql --extra sqlite --extra codebase --extra otel --group typecheck --group lint
.venv/bin/python -m pyright mcp_server/
export CORTEX_TEST_DATABASE_URL=postgresql://localhost:1/cortex_green_isolated
export CORTEX_MEMORY_STORE_BACKEND=sqlite DATABASE_URL=
export HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 CORTEX_RERANKER_OFFLINE=1
.venv/bin/python -m pytest tests_py/scripts/ -q --tb=short
.venv/bin/python -m pytest -q --tb=short

Deux runs après au même SHA 03e884a3 sont verts :
34037347199 et
34038092818.

Mesure Python 3.12 Médiane des autres jambes
Avant, run34035713474 1 097 s 535 s
Avant, run34036866480 1 104 s 515 s
Après, run34037347199 656 s 491 s
Après, run34038092818 663 s 545 s

La moyenne Python 3.12 passe de 1 100,5 s à 659,5 s : 441 s de moins
(40,07 %), sur ces deux observations avant/après. Ce n'est pas une mesure
d'énergie ; charge/cache du runner ne sont pas contrôlés expérimentalement.
Chaque run après produit coverage-report (84 673 octets), atteint 85,34 %
de couverture et valide le compteur/badge (badges OK, 5 contrôlés).
Les logs montrent une seule invocation pytest avec couverture.
Archives locales : /private/tmp/cortex-green-w1-3-after{1,2}-jobs.jsonl,
cortex-green-w1-3-after1-python312.log, cortex-green-w1-3-after2.log.

Conformité

Un seul fichier modifié, aucune baseline ajoutée, aucun import ou mécanisme
mémoire modifié. Le seuil et les contrôles existants sont conservés.
La collecte --collect-only ne lance aucun test.

Candidats issues

La durée relative Python 3.12 / autres jambes dépend aussi de l'instrumentation
de couverture et des caches ; les deux mesures seront publiées sans attribuer
toute variation au changement.

Runbook

Le propriétaire décide de la fusion. Aucune opération de production.

@cdeust
cdeust changed the base branch from ci/green-path-filters to main September 6, 2026 21:52
@cdeust
cdeust merged commit e8d1c99 into main Sep 6, 2026
28 checks passed
pull Bot pushed a commit to asleekgeek/Cortex that referenced this pull request Sep 8, 2026
Thirteen merged PRs (cdeust#475-cdeust#487, cdeust#506) and a full SCI-grounded energy
harness under benchmarks/energy/ had no mention anywhere in the README.
A reader had no way to know the programme existed, which also meant no
way to hold it to its own evidence rule.

The section states what the harness measures and, at equal length, what
it does not: its own README opens by saying the fixtures do not measure
device energy and do not establish an energy improvement, the carbon
factors are mandatory operator inputs with no defaults, and the boundary
is the sensor's CPU+GPU+ANE estimate excluding memory, storage, screen
and power-supply losses.

No energy figure is published, and the section says why: no energy
results are committed to this repository, because a number measured on
one operator's machine, region and duty cycle is not a property of the
software. The demand-reduction paragraph is explicitly labelled a design
rationale rather than a measurement, since no end-to-end token-savings
or CO2 figure has been measured.

The one quantitative claim is the already-committed hook boot constant
(~0.05s vs ~0.6s registry import, measured 2026-07-28), cited to its
call sites in mcp_server/hooks/auto_recall.py.

check_doc_claims.py exits 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StMBvNd7eVJGtpnC2zNsx1
@cdeust
cdeust deleted the ci/green-single-pytest branch September 8, 2026 16:01
pull Bot pushed a commit to asleekgeek/Cortex that referenced this pull request Sep 8, 2026
Root cause of the cdeust#509 -> cdeust#510 incident. The `changes` filter classifies
'*.md' out of `code`:

    code:
      - '**'
      - '!{*.md,docs/**/*.md,...}'

so a README-only PR sets code=false and every test job is skipped. But
part of that suite takes documentation as its INPUT:
tests_py/scripts/test_codex_plugin_contract.py reads README.md and
asserts on the canonical published identities (the hypermnesia-mcp-viz
anchor, the viz/spec migration strings).

The guards were therefore switched OFF exactly when their subject
changed. cdeust#509 was a README-only diff, every test job skipped, it merged
green, and the push to main went red on that test across five jobs (run
34238410970 — 7663 passed, 1 failed). cdeust#510 fixed the symptom; this fixes
the reason it could reach main at all.

Adds `docs` to test-sqlite's predicate only, not to the 3.10-3.13 matrix:
test-sqlite already runs THE FULL SUITE in one ~5-minute job, so it
covers the doc-contract tests at the smallest cost that closes the gap.
Waking the whole matrix on every prose edit would undo cdeust#475-cdeust#481.

scripts/check_ci_gate_results.py mirrors ci.yml's predicates — its own
check_policy docstring requires the workflow and the executable policy to
stay "in exact agreement". Changing only the workflow would have left two
sources of truth disagreeing about when test-sqlite may skip, so
_required_jobs gains the same condition and both files carry the same
note. Caught by re-reading the diff, not by CI.

Its two docs-only tests are updated to the new policy, and the first is
turned into a named regression test that asserts skipping test-sqlite on
a docs-only PR is NOT justified — the exact hole cdeust#509 fell through.

Verified: actionlint 1.7.12 (the pinned version) clean on ci.yml;
check_ci_gate_complete.py OK; both gate test files 38 passed, 159
subtests; craftsmanship, ruff check, ruff format, doc-claims all clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01StMBvNd7eVJGtpnC2zNsx1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant