Skip to content

chore(notebooks,#14209): clôture str->list — 53 cellules restantes sur 14 notebooks, garde byte-identity corpus entier #10050

chore(notebooks,#14209): clôture str->list — 53 cellules restantes sur 14 notebooks, garde byte-identity corpus entier

chore(notebooks,#14209): clôture str->list — 53 cellules restantes sur 14 notebooks, garde byte-identity corpus entier #10050

Workflow file for this run

name: Cell-order gate
# Purpose
# -------
# Per-PR REGRESSION gate for cell ordering / enchainement (Epic #3240).
# For every notebook changed by the PR, compare its HIGH cell-ordering findings
# (scripts/notebook_tools/scan_cell_ordering.py) between the base revision and
# the PR revision and FAIL only on a regression -- a HIGH finding introduced by
# the PR. Pre-existing findings in legacy notebooks (tracked under #3240) do NOT
# block unrelated PRs. A new notebook (no base) must be clean.
#
# Convention: .claude/rules/notebook-conventions.md ("Enchainement et ordre
# canonique des cellules"). Skill: /check-cell-order.
on:
pull_request:
branches: [ main ]
paths:
- 'MyIA.AI.Notebooks/**/*.ipynb'
- 'scripts/notebook_tools/scan_cell_ordering.py'
- 'scripts/notebook_tools/cell_order_ci.py'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: cell-order-gate-${{ github.ref }}
cancel-in-progress: true
jobs:
cell-order:
name: "No cell-ordering regression in changed notebooks"
# Route vers la jambe Linux auto-hebergee (#13378 tranche 1, decision ai-01
# 2026-09-01) : garde Python pur, sans secret ni usage du GITHUB_TOKEN. La garde
# same-repo ci-dessous saute les PRs de fork (pr_gate.py compte `skipped` comme
# OK) : aucun code de fork n'atteint le runner. Retour arriere = revert de la PR.
runs-on: [self-hosted, coursia-ephemeral, coursia-linux]
if: github.event.pull_request.head.repo.full_name == null || github.event.pull_request.head.repo.full_name == github.repository
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
filter: blob:none
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Gate changed notebooks
run: |
set -uo pipefail
BASE="origin/${{ github.base_ref }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "::notice title=Cell-order gate::Manual dispatch — nothing to diff."
exit 0
fi
CHANGED=$(git diff --name-only "$BASE"...HEAD -- 'MyIA.AI.Notebooks/**/*.ipynb' || true)
if [ -z "$CHANGED" ]; then
echo "::notice title=Cell-order gate::No notebooks changed — clean."
exit 0
fi
tmp=$(mktemp -d)
fail=0
echo "## Cell-order gate" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
while IFS= read -r nb; do
[ -z "$nb" ] && continue
# Skip notebooks deleted by the PR.
[ -f "$nb" ] || continue
basef="NONE"
if git cat-file -e "$BASE:$nb" 2>/dev/null; then
basef="$tmp/base.ipynb"
git show "$BASE:$nb" > "$basef" 2>/dev/null || basef="NONE"
fi
# `&& rc=0 || rc=$?` is load-bearing under `bash -e`: a bare `out=$(cmd)`
# that exits non-zero aborts the step before `rc=$?` is read, making the
# rc=1/rc=2 branches below dead code and the failure anonymous (#8884 motif).
# NOT `|| true` (that makes $? read 0 from `true` and permanently disarms the gate).
out=$(python scripts/notebook_tools/cell_order_ci.py --base "$basef" --head "$nb") && rc=0 || rc=$?
if [ $rc -ne 0 ]; then
echo "::error title=Cell-order regression::$nb introduces new HIGH cell-ordering finding(s)."
echo "$out"
echo "<details><summary><code>$nb</code></summary>" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "$out" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "</details>" >> "$GITHUB_STEP_SUMMARY"
fail=1
else
echo " OK $nb"
fi
done <<< "$CHANGED"
if [ "$fail" -ne 0 ]; then
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "Ground-truth each finding (the signal is not a verdict, rule G.1), then re-order with \`NotebookEdit\` (bottom-up) and re-execute (C.2). See the \`/check-cell-order\` skill." >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
echo "::notice title=Cell-order gate::No ordering regression in changed notebooks."