Skip to content

Tests make the local clone shallow #343

Closed

Description

@neuromechanist

Symptom

Running the test suite in a full local clone turns the clone shallow. pamica/tests/mlx_tests/test_mlx_fit_noop.py (on dev since epic #278) runs git fetch origin <pinned sha> --depth 1 every time the module runs, to reach a historical commit it loads with git show. In a full clone, a --depth 1 fetch writes .git/shallow and cuts local history at that commit. A later automatic git gc can then prune objects behind the boundary: git fsck reported commit-graph entries whose commits could not be read. Epic #324 Phase 7 (test_doscaling_rows.py) copied the same pattern. It was found when the maintainer's clone showed git rev-parse --is-shallow-repository = true. The clone was repaired with git fetch --unshallow origin and git commit-graph write --reachable; fsck is now clean, and every local branch has its full history.

Fix

Tests must never mutate the repository or fetch from the network. Check for the pinned commit with git cat-file -e <sha>^{commit}. If it is missing, fail under CI (the CI jobs check out full history with fetch-depth: 0), and otherwise skip with a message telling the developer how to fetch it. Route every historical-code loader through one shared helper. Epic #324 Phase 8 (#334, PR #342) adds that helper (pamica/tests/pre_change.py), so the fix lands there.

Part of epic #324.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions