Skip to content

Show commit mismatch warning in rwx results#389

Merged
robinaugh merged 1 commit intomainfrom
jason/results-git-status-warning
Mar 2, 2026
Merged

Show commit mismatch warning in rwx results#389
robinaugh merged 1 commit intomainfrom
jason/results-git-status-warning

Conversation

@robinaugh
Copy link
Contributor

@robinaugh robinaugh commented Mar 2, 2026

Summary

  • When rwx results infers a run from the current branch, compares the local HEAD against the commit SHA the run was built from
  • If they differ, prints a note: Note: you're currently on commit a1b2c3d but the most recent run on this branch was for commit b2c3d4e
  • Only shown in non-JSON mode and only when the run ID is inferred (not explicitly provided)
  • Adds commit_sha field to RunStatusResult API response (nullable)

Test plan

  • go build ./cmd/rwx compiles
  • go test ./internal/... ./cmd/... passes
  • Manual: rwx results on a branch where HEAD matches the run's commit — no warning shown
  • Manual: rwx results on a branch where HEAD differs from the run's commit — warning shown
  • Manual: rwx results <run-id> — no warning shown (explicit ID skips check)
  • Manual: rwx results --output json — no warning shown (JSON mode)
  • Manual: server returns null commit_sha — no warning shown

@robinaugh robinaugh self-assigned this Mar 2, 2026
@robinaugh robinaugh force-pushed the jason/results-git-status-warning branch 2 times, most recently from d7645eb to a68dd19 Compare March 2, 2026 19:44
@robinaugh robinaugh marked this pull request as ready for review March 2, 2026 19:46
jmsanders
jmsanders previously approved these changes Mar 2, 2026
if len(shortCommit) > 7 {
shortCommit = shortCommit[:7]
}
return fmt.Sprintf("Note: you're currently on commit %s but the most recent run on this branch was for commit %s", shortHead, shortCommit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use "Note:" consistently elsewhere? I see it in just one other info message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, though Warning: felt a bit too strong here. 🤷

if len(shortCommit) > 7 {
shortCommit = shortCommit[:7]
}
return fmt.Sprintf("Note: you're currently on commit %s but the most recent run on this branch was for commit %s", shortHead, shortCommit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we sort of brushed it off at standup, but I do think it could be a bit confusing if you've:

  • kicked off a run that gets git patched
  • committed
  • now the most recent results will show this note even if it's the same code

I think this is fine as is but let's keep an eye on how it feels when we actually use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah very interesting

When `rwx results` infers a run from the current branch, compare the
local HEAD against the commit SHA the server reports the run was built
from. If they differ, print a note so the user knows the results may
not reflect their current working tree.
@robinaugh robinaugh force-pushed the jason/results-git-status-warning branch from a68dd19 to c6ebf1d Compare March 2, 2026 19:58
@robinaugh robinaugh requested a review from jmsanders March 2, 2026 20:02
@robinaugh robinaugh merged commit 2011c85 into main Mar 2, 2026
1 check passed
@robinaugh robinaugh deleted the jason/results-git-status-warning branch March 2, 2026 20:19
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.

2 participants