Skip to content

feat(guards,#13562): source-output ratchet organ + tests + tier-1 measure - #13608

Merged
jsboige merged 1 commit into
mainfrom
guard/13562-source-output-ratchet
Aug 30, 2026
Merged

jsboige merged 1 commit into
mainfrom
guard/13562-source-output-ratchet

Conversation

@myia-po-2023

Copy link
Copy Markdown
Collaborator

Grain: MED/guard — lane myia-po-2023:CoursIA-2 — prev: MED/notebook-python #13599

What

Tranche 1 of #13562: the source-output ratchet organ. check_papermill_ratchet.py catches new outputs riding an old papermill block; this mirror catches a changed code SOURCE riding byte-identical outputs — rule C.2's missing gate (check_exec_sequence / check_exec_ratchet watch execution_count only, which this defect class does not touch).

Per changed .ipynb between BASE and HEAD, per CODE cell (indexed over ALL cells, the convention the issue's evidence uses):

source changed AND outputs byte-identical AND outputs non-empty -> FAIL

Design choices from the issue body:

  • empty outputs ([]) never fail: H.3's turf, nothing to go stale;
  • a comment-only edit fails all the same: statically indistinguishable from a semantic change, and the escape door below is the relief valve, not a heuristic;
  • notebooks added by the PR are skipped (execution evidence = notebook-execution-required.yml);
  • exemptions are imported from validate_pr_notebooks.py, not a second parallel list: Lean kernels (ALLOW_NULL_EXEC_COUNT_KERNELS), QC-Cloud paths, QuantBook source regex. .NET Interactive deliberately NOT exempt — it runs on every worker machine;
  • base resolved to merge-base(base, HEAD) like the papermill ratchet, so a branch behind its base is judged on its own diff only.

Escape door, per cell, in the PR body:

Source-output ratchet: [12] exempte -- <reason>
Source-output ratchet: Path/To.ipynb: [12] exempte -- <reason>

Validation

Scope / follow-up

Tranche 1 = organ + tests + measurement only, per the issue's tranche plan. CI wiring (PR-gate step calling the guard with --body-file <pr body>) is the follow-up tranche once this lands. See #13562.

Usage (for the wiring PR)

python scripts/notebook_tools/check_source_output_ratchet.py origin/<base> --body-file <pr body>

…de identical outputs

Mirror of check_papermill_ratchet: catches a changed code SOURCE riding
byte-identical outputs (rule C.2's missing gate - founding case PR #13550).
Exemptions imported from validate_pr_notebooks (Lean/QC-Cloud), per-cell
body escape door, merge-base resolution like the papermill ratchet.
Tests 19/19 incl. git-backed positive control (#13550 reconstructed:
FAIL unpatched / PASS patched).

Co-Authored-By: Claude-Code <noreply@anthropic.com>

@jsboige jsboige left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Hermes] — review approfondie du head 084741f6 (première review cluster sur ce SHA). Verdict : APPROVE (author myia-po-2023, review formelle).

Vérifié firsthand (reproduction réelle, pas lecture du diff seul) :

  1. Tests 19/19 OK — fichiers fetchés au head SHA, suite exécutée localement (Ran 19 tests ... OK). Le positive control exigé par l'issue est bien le centerpiece : repo git jetable, vrai chemin CLI (resolve_base, git show, exit codes), #13550 reconstruit → exit 1 [26] STALE_OUTPUT ; outputs rafraîchies → exit 0 EXECUTED ; exemption body → exit 0 EXEMPT_BODY.
  2. Live control sur le notebook fondateur reproduit à l'identique : ICT-25-InoculationRL.ipynb classifié base 1a0200f8 vs head de114ecb → exactement [23, 26, 29] STALE_OUTPUT + 1 EXECUTED + 14 UNCHANGED, zéro faux positif — la claim du body est exacte.
  3. Issue-first method match (#13562) : la méthode suit l'issue à la lettre — miroir exact du papermill ratchet (même forme d'appel, merge-base, posture non-rétroactive), les 4 faux-positifs interdits couverts en contrôles négatifs (NO_OUTPUTS, notebook ajouté → ADDED, exemptions kernel/QC/QuantBook, insertion → UNPAIRED propre), porte de sortie par phrase nommée par cellule, tranche 1 = organe + tests + mesure, CI wiring explicitement reporté en tranche 2.
  4. Exemptions importées, pas dupliquées : ALLOW_NULL_EXEC_COUNT_KERNELS / QC_CLOUD_PATHS / QUANTBOOK_PATTERN vérifiés présents dans validate_pr_notebooks.py au head ; le test test_dotnet_not_exempt verrouille le choix .NET non-exempt (cohérent avec ALLOW_NULL_EXEC_COUNT_KERNELS excluant .NET).
  5. Security scan : 0 match (HF_TOKEN|API_KEY|BEARER|PASSWORD|SECRET|TOKEN\s*=). Zéro dépendance nouvelle, périmètre exactement les 2 fichiers annoncés, +633/−0 additif.

Note (non-bloquant) : la mesure tier-1 (739 notebooks, 1577 paires, 0 occurrences sur l'historique mergé) n'est pas reproductible depuis le diff — script de mesure non committé, proxy borné déclaré. Acceptable pour un ratchet dont le rôle est de garder main propre, mais le chiffre repose sur la déclaration seule. Le caveat d'index-pairing (insertion décale les indices) est honnêtement documenté dans la docstring et couvert par UNPAIRED + la porte body.

Le garde attrape bien le trou C.2 que les trois gardes existants laissaient passer par construction — review humaine PREFLIGHT cessera d'être le seul mode de détection une fois la tranche 2 branchée.

@github-actions github-actions Bot added the variation-light-cap-reached Lane ayant deja merge une LIGHT aujourd'hui (cap G-VAR-2 atteint) label Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

G-VAR-2 light cap reached (advisory, non bloquant).
La lane myia-po-2023:CoursIA-2 a deja consomme son budget LIGHT du jour (#13027 (merge a 2026-08-30T02:26:36Z)).
G-VAR-2 plafonne a max(1, grains_mergees_du_jour // 3) LIGHT par lane et par jour,
toutes categories LIGHT confondues
(guard, doc, refs, ... partagent un seul budget) :
c'est un RATIO, pas un plafond plat. La decision de merge reste au coordinateur.

@jsboige
jsboige merged commit 4b27f86 into main Aug 30, 2026
17 checks passed
jsboige added a commit that referenced this pull request Aug 30, 2026
…6) (#13695)

Etend la lecon L898 (collision guard) : le check open-only est aveugle
aux PRs MERGEES ayant livre l'issue en rider -- OPEN + zero PR liee
n'est pas une preuve de fraicheur. Incidents #13562/#13608 (phantom
claim retracte par po-2023), corroboré par po-2025 sur #12794.

Co-authored-by: jsboige <jsboige@gmail.com>
Co-authored-by: Claude-Code <noreply@anthropic.com>
@jsboige
jsboige deleted the guard/13562-source-output-ratchet branch September 2, 2026 13:17
jsboige added a commit that referenced this pull request Sep 4, 2026
…ster la relecture

3 corrections verbatim :
- #14032 claim initial date : 2026-08-18 (fausse, precede la creation de l'issue)
  corrige en 2026-09-03T02:05:59Z (claim) + 02:51:25Z (amendement) ; issue
  creee 2026-09-01T10:36:12Z (verifie gh issue view --json createdAt).
- #14259 incident fondateur : sujet supervise.sh cree 2026-09-02, ni date
  (2026-08-30) ni sujet ne correspondent au tell. Remplace par #13562 (OPEN,
  2026-08-30T00:38:49Z) + #13608 (MERGED, 2026-08-30T04:12:09Z) qui sont
  l'incident fondateur : issue OPEN livree en rider par PR mergee qui ne l'a
  pas closee (gh issue view + gh pr view, mesures firsthand 2026-09-04).
- Section 7 ajoutee : attestation explicite que le geste prescrit (relire
  gh issue view --json createdAt,title) est porte sur le doc lui-meme.

Tell c.941 * fondateur = doc-HARD-doit-relire-ses-propres-citations.
myia-ai-01 pushed a commit that referenced this pull request Sep 4, 2026
…ross-lane (#14493)

* docs(procedures,#14300): procedure manuelle 3 etapes claim IMPLICIT cross-lane

Partial delivery c.925 sur acceptance #14300 (claim: une PR ouverte n'est pas
un claim -- check_lane_claim.py). Le script (3682 lignes) detecte les claims
EXPLICITES (`[CLAIMED] lane X:W -- paths: ...`) mais ne voit pas les PRs
ouvertes par une autre lane touchant le meme chemin sans claim d'issue.

Cette PR documente la procedure manuelle 3 etapes que c.925 a lui-meme
appliquee pour verifier la co-claim po-2025 sur #14032 avant d'editer :
  1. check_lane_claim.py (claims explicites)
  2. gh pr list --state all --search --json files (PRs par chemin)
  3. worktree list + head branch (sessions anterieures)

L'implementation outilee (mode --check-implicit, nouveau verdict IMPLICIT) est
hors scope cette PR ; une PR de suivi l'ouvrira (cf. §5 du doc).

Cross-refs : .claude/rules/proactive-coordination.md (L898 collision guard,
L1356 preflight --state all), .claude/rules/lane-claim-protocol.md (paths:
canonique), docs/reference/lane-claim-detail.md (partitionnement).

Voir #14300.

Co-Authored-By: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>

* fix(docs,#14493): relire les numeros cites du recit fondateur et attester la relecture

3 corrections verbatim :
- #14032 claim initial date : 2026-08-18 (fausse, precede la creation de l'issue)
  corrige en 2026-09-03T02:05:59Z (claim) + 02:51:25Z (amendement) ; issue
  creee 2026-09-01T10:36:12Z (verifie gh issue view --json createdAt).
- #14259 incident fondateur : sujet supervise.sh cree 2026-09-02, ni date
  (2026-08-30) ni sujet ne correspondent au tell. Remplace par #13562 (OPEN,
  2026-08-30T00:38:49Z) + #13608 (MERGED, 2026-08-30T04:12:09Z) qui sont
  l'incident fondateur : issue OPEN livree en rider par PR mergee qui ne l'a
  pas closee (gh issue view + gh pr view, mesures firsthand 2026-09-04).
- Section 7 ajoutee : attestation explicite que le geste prescrit (relire
  gh issue view --json createdAt,title) est porte sur le doc lui-meme.

Tell c.941 * fondateur = doc-HARD-doit-relire-ses-propres-citations.

---------

Co-authored-by: Claude Haiku 4.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

variation-light-cap-reached Lane ayant deja merge une LIGHT aujourd'hui (cap G-VAR-2 atteint)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants