Skip to content

test_git_learning mutates worktree branches during pre-push runs #266

@EtanHey

Description

@EtanHey

Summary

tests/test_git_learning.py appears to create real commits in the active repository context when the full pre-push suite runs from a git worktree. Because worktrees share the git object database with the parent repo, those fixture commits can leak into the feature branch under test.

Evidence

  • In /private/tmp/brainlayer-phaseb-b2, a pre-push run regrew stray commits after a hard reset:
    • 320fcb63 feat: add app bootstrap
    • 75c7589f fix: handle startup failure
  • The same 10-test slice passed cleanly on a fresh clean clone at 464a04f7 and did not mutate HEAD.
  • The commit subjects match fixture data embedded in tests/test_git_learning.py.

Why this matters

  • Worktree-based publication flows can end up with test-fixture commits silently attached to the branch being pushed.
  • This makes pre-push results environment-dependent and breaks the assumption that a green clean clone and a green worktree mean the same thing.

Suspected fix

  • Run the git-learning fixture against an isolated temp repo / temp GIT_DIR, not the live checkout.
  • Audit the test for any implicit cwd assumptions.

Nice-to-have

  • Add a regression test that proves the active repo HEAD does not change after the git-learning test runs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions