Skip to content

[BUG] Save-file provenance records the caller's git repository instead of the Ptera Software installation #192

@camUrban

Description

@camUrban

Bug Description

_get_provenance and _log_load_warnings shell out to git rev-parse HEAD and git status --porcelain without a working-directory argument, so they resolve against the user's process working directory rather than the Ptera Software installation. For a pip-installed user running a script inside their own git repository (a common research workflow), every saved file records that repository's commit and dirty state as if they described the Ptera Software code, and load can then emit misleading warnings (a commit mismatch or a dirty-tree notice) about the user's own unrelated repository. Users running outside any git repository instead get a "Git is not available" warning on every save, even though null provenance is the expected state for an installed package.

Location(s): pterasoftware/_serialization.py (_get_provenance, _log_load_warnings).

Expected Behavior

The provenance fields should describe the Ptera Software code that wrote the file. Resolving git against the package source directory (for example, passing a cwd derived from __file__ to both subprocess calls) makes the fields correct for a development checkout and cleanly null for installed users. The save-time "Git is not available" warning should be demoted or dropped, since null is the expected state for every installed user, and the load-time commit and dirty-tree warnings should then only ever fire when the provenance genuinely describes the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions