fix(trace): re-record rebased commits from their trailer

Merged
JI
8h ago
+510-21

A rebase that runs outside the clone with the Chainloop Trace hooks (for example the GitHub "Update branch" button, or a rebase in another clone) gives the branch commits new SHAs that have no commit record. The next pre-push then dropped the old records as orphans and sent none of the rebased commits, so the session lost their files and AI line attribution, or was not sent at all.

Before the orphan filter, the push now records each commit of the branch that carries a Chainloop-Trace-Sessions trailer and has no record. It keeps only the trailer sessions that have a local session record, because the commit author controls the trailer text. Merge commits are skipped, as in post-commit, and existing records are not changed. The next push then sends all the commits of the session with their new SHAs, with or without a new commit.

The git client gets a CommitInfo method to read the message and committer date of any commit. The Trace README feature table documents the new behavior.

This is the client part of PFM-8286. A rebase on GitHub that is not followed by a push from a clone with the hooks still needs the server-side fix.

Fixes #3838

AI disclosure: this change was produced with the assistance of Claude Code.

šŸ¤– Generated with Claude Code