Skip to content

fix(notebooks): assign valid string id to cells with "id": null (nbformat 4.5) - #8325

Merged
jsboige merged 1 commit into
mainfrom
fix/nbformat-id-null-cells
Jul 24, 2026
Merged

jsboige merged 1 commit into
mainfrom
fix/nbformat-id-null-cells

Conversation

@myia-po-2023

Copy link
Copy Markdown
Collaborator

Summary

5 notebooks each carried one cell with an explicit "id": null — invalid under nbformat 4.5, which requires a string cell identifier.

Consequence (the real bug): nbformat.validate() raises on a null cell id, which silently skipped the whole notebook in the batch H.3 validator (scripts/notebook_tools/validate_pr_notebooks.py). Infer-2's 27 cells (and the others) were not under validation coverage at all.

The fix

Assign a unique string id "fixed-id-null" to the lone null-id cell in each notebook — consistent with the notebook convention (every other cell already carries a string id):

Notebook null-id cell other cells w/ string id
Probas/Infer/Infer-2-Gaussian-Mixtures cell 84 85/85
Probas/Infer/Infer-11-Topic-Models cell 55 56/56
Probas/Infer/Infer-12-Modeles-Hierarchiques cell 18 19/19
Probas/PyMC/PyMC-11-Topic-Models cell 34 35/35
QuantConnect/projects/LongShortHarvest-QC/research cell 0 31/31

Byte-stable: one literal replacement per file ("id": null, → "id": "fixed-id-null",). No source or output touched — pure nbformat-schema metadata.

Verification

  • nbformat.validate() now PASSES on all 5 (was raising ValidationError before).
  • Batch H.3 validator (validate_pr_notebooks.py) now INCLUDES all 5 and PASSes — restoring coverage that was silently missing:
    Notebook PR Validation: 5/5 passed
      PASS Infer-2-Gaussian-Mixtures.ipynb (27 cells)
      PASS Infer-11-Topic-Models.ipynb (56 cells)
      PASS Infer-12-Modeles-Hierarchiques.ipynb (19 cells)
      PASS PyMC-11-Topic-Models.ipynb (35 cells)
      PASS LongShortHarvest-QC/research.ipynb (31 cells)
    
  • id uniqueness: no duplicate within any notebook; fixed-id-null appears exactly once each.

Diff scope

5 files, +5/−5 (one line per file). The discovered vein came out of the Infer-2 cost-FM investigation (#8323): Infer-2 was dropped from that PR precisely because its pre-existing id:null cell skipped it in batch validation. This PR fixes the underlying defect so Infer-2 (and the 4 others) are covered going forward.

Scope guard

nbformat-schema defect only. No Closes #N (no tracking issue); this is correctness hygiene discovered incidentally.

…rmat 4.5)

5 notebooks carried one cell with an explicit "id": null — invalid under
nbformat 4.5, which requires a string cell identifier. nbformat.validate()
raises on these cells, which silently skipped the whole notebook in the
batch H.3 validator (scripts/notebook_tools/validate_pr_notebooks.py):
e.g. Infer-2's 27 cells were not under validation coverage.

Assign a unique string id "fixed-id-null" to the lone null-id cell in each
notebook — consistent with the notebook convention (every other cell already
carries a string id: Infer-2 85/85, Infer-11 56/56, Infer-12 19/19,
PyMC-11 35/35, QC-research 31/31). Byte-stable: one literal replacement per
file; no source or output touched.

Verified:
- nbformat.validate() PASSES on all 5 (was raising before).
- Batch H.3 validator now INCLUDES all 5 and PASSes (Infer-2 27 cells,
  Infer-11 56, Infer-12 19, PyMC-11 35, QC-research 31).

Scope: nbformat-schema defect only. No code cell source or output changed.

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

Copy link
Copy Markdown
Contributor

Notebook PR Validation: PASS

  • Notebooks checked: 5
  • Code cells validated: 83
  • Result: All passed

Checks: H.1 (no errors), H.3 (execution_count), C.1 (no banned patterns)
Non-Python kernels (.NET/Lean): C.1 + errors only (execution_count advisory)
QuantConnect notebooks: C.1 + errors only (require QC Cloud for execution)

@github-actions

Copy link
Copy Markdown
Contributor

Golden-Set Execution (H.7 P3)

✅ 8/8 notebooks passed (certified reproducible)

Notebook Status Time
2.1-Workflow-ML.ipynb ✅ SUCCESS 4.9s
2.2-Descente-de-gradient.ipynb ✅ SUCCESS 4.3s
2.3-Regression-lineaire-logistique.ipynb ✅ SUCCESS 3.8s
2.4-Arbres-Forets-Ensembles.ipynb ✅ SUCCESS 4.9s
Search-1-StateSpace.ipynb ✅ SUCCESS 4.0s
SL-1-LogicalLearning.ipynb ✅ SUCCESS 2.9s
rl_4_multi_armed_bandits.ipynb ✅ SUCCESS 26.3s
GameTheory-4c-NashExistence-Python.ipynb ✅ SUCCESS 3.6s

Pinned lockfile: scripts/notebook_tools/golden_set.lock.txt (H.7 P3, axe A #4208)

@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] ✅ Diff: 5x id: null -> id: fixed-id-null sur cellules markdown ## References (Infer-2/11/12, PyMC-11, QC research). Fix mecanique conforme nbformat 4.5. CI golden-set 8/8 PASS, H.1/H.3 valides. Aucune fuite, pas de contenu semantique touche. LGTM.

@jsboige
jsboige merged commit cfecdd0 into main Jul 24, 2026
28 of 29 checks passed
jsboige added a commit that referenced this pull request Jul 24, 2026
…clear fleet-red gate) (#8372)

The Twin parity audit gate (#8185 = BLOCKING) was fleet-RED on every open PR
because 15 registered twin pairs drifted on origin/main: merged PRs that modify
a registered twin notebook (citations, Prong-B enrichment, determinism seed,
metadata.cost rollout, nbformat cell-id fix) did not rebaseline their
last_audit.{python,csharp}_sha, so the recorded SHA lagged the merged blob.

G.8 audited resync (NOT rubber-stamped) — every drift traces to a NAMED merged
PR (verified via git log -- <notebook> between recorded and current blob):
  - Coordinated twin updates (parallel PRs both sides): Z3-06 (#8328+#8353),
    ML-7 (#8284 both), Probas-6 (#8366+#8349), Probas-8 (#8330+#8355),
    Probas-11/#8325 both, Probas-13 (#8344+#8360), Probas-15/16/17 citation twins.
  - Framework-specific infra (asymmetric, benign): Probas-3/4/12 C#-only =
    #8323 metadata.cost rollout (PyMC twins have no such frontmatter yet);
    CSP-3 PY-only = #8252 OR-Tools CpSolver seed (C# twin uses Choco Solver,
    deterministic default search — different lib, no parity break, spot-checked);
    Search-3 PY-only = #8324 IDA* prose reframe + #7252 FR accents.
Independently re-confirms the G.1 firsthand claim (jsboige c.03:58, po-2023
c.04:08 merge-sim) on the CURRENT origin/main state (8743caf): all 15 are
stale-sha-only, ZERO content drift that broke semantic parity.

Surgical method (NOT check_twin_parity.py --update): --update yaml.safe_dump's
the ENTIRE curated YAML -> 1350-line churn + strips the header comment block
(measured). Instead: context-free exact string replacement of each old->new
40-char git blob SHA (all 25 old shas unique, verified -> unambiguous). Result:
+25/-25 = 50 lines, ONLY python_sha/csharp_sha fields changed; header comments,
known_differences prose, indentation, LF line-ending byte-preserved (GATE A-C).

Proof: check_twin_parity.py --check -> OK=39 DRIFT=0 exit 0 (CI-green).

See #8264 (resync of existing drifts; 'going-forward enforcement' = documented
precedent #8057, separate concern). See #8057, #8185.

Co-authored-by: Claude <noreply@anthropic.com>
@jsboige
jsboige deleted the fix/nbformat-id-null-cells branch September 2, 2026 13:17
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.

2 participants