Skip to content

Read output log without mutating the output repository - #124

Merged
schmoelder merged 2 commits into
mainfrom
non-mutating-output-log
Aug 13, 2026
Merged

Read output log without mutating the output repository#124
schmoelder merged 2 commits into
mainfrom
non-mutating-output-log

Conversation

@schmoelder

Copy link
Copy Markdown
Contributor

OutputRepo.output_log used to read the run history by resetting the output repository and checking out its main branch. That made a read operation change local Git state, and in the worst case it could discard uncommitted work in the output repository.

This PR changes log reading to read log.tsv directly from the local main ref. Reading the output log no longer checks out main, resets the working tree, updates refs, fetches, pulls, or pushes. The write path remains separate: update_output_main_logs() still intentionally checks out output main, updates log.tsv and run_history, commits them, and returns to the result branch.

The tests cover that reading the log leaves the output repository on the same branch, preserves uncommitted files, still lists recorded result branches, and works for a fresh repository without a log.

This is not intended as a breaking change. It removes an unintended side effect from a read property. Code that accidentally relied on output_repo.output_log also cleaning the output repository or switching it to main would behave differently, but that behavior was the bug.

Reading the run history used to hard-reset the output repository and check out its main branch, so merely enumerating candidate result branches could discard uncommitted work. The log is now read from the main branch ref instead. Matching a case that declares no environment no longer loads the recorded environment either, since run_history only exists on the main branch and the comparison was a no-op regardless.
@schmoelder
schmoelder merged commit 3acc027 into main Aug 13, 2026
5 checks passed
@schmoelder
schmoelder deleted the non-mutating-output-log branch August 13, 2026 09:54
schmoelder added a commit that referenced this pull request Aug 13, 2026
Reading the run history used to hard-reset the output repository and check out its main branch, so merely enumerating candidate result branches could discard uncommitted work. The log is now read from the main branch ref instead. Matching a case that declares no environment no longer loads the recorded environment either, since run_history only exists on the main branch and the comparison was a no-op regardless.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant