Metacenta

AI lifecycle · rule ai-notebook-outputs-committed

Jupyter notebooks committed with outputs

A Metacenta review checks this under the rule Notebooks are committed without their outputs. Everything below applies whether or not you ever commission one.

What this rule checks

This rule flags Jupyter notebooks in the repository of 512 KB or more. A code-only notebook is tens of kilobytes, so at that size its outputs are committed with it. We never open the file.

Why it matters

Notebook outputs are whatever the last cell printed, so this is the file most likely to hold real customer rows. They stay in git history, readable by everyone with access, and every diff becomes unreviewable.

How to fix it

Strip outputs from committed notebooks. Strip outputs on commit with nbstripout as a git filter, or jupyter nbconvert --clear-output. Removing them from the working copy does not remove them from history, so clean the history too if they held personal data.

When it is fine to leave

A notebook published as a rendered example, such as a tutorial whose charts are the point, may keep its outputs. Make sure they were generated from synthetic or public data.

What we need to check it

Read-only repository access for the file tree: paths and sizes. If the tree comes back truncated, the rule declines, because a missing notebook cannot be told from an unlisted one.