Store git commit SHA in reports.revision - #653
Merged
Merged
Conversation
Full 40-hex git commit SHAs will be stored in the same column as SVN revision numbers. The varchar_pattern_ops index keeps prefix searches by short SHA on an index scan in PostgreSQL. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
scan_recent_ltsv now saves the full SHA extracted from ltsv instead of leaving revision nil for git-era reports. Report#sha1 prefers the revision column and falls back to ltsv extraction for old rows. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The r prefix is now applied only to numeric SVN revisions. A 40-hex revision is truncated to 11 characters like the previous sha1 display. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fills revision for existing rows by extracting the full commit SHA from ltsv. Intended to run once on Heroku after the column migration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reports built from git have no
revisionvalue. The commit SHA is extracted from theltsvcolumn with a regexp on every access, and the revision is not searchable by commit. This changesreports.revisionfrom integer to string so that SVN revision numbers and full 40-hex commit SHAs share one column.Report.scan_recent_ltsvnow stores the full SHA,Report#sha1prefers the column and falls back toltsvextraction for old rows, and the index page shows the first 11 characters linked to the GitHub commit. The migration adds avarchar_pattern_opsindex so prefix searches by short SHA stay on an index scan in PostgreSQL. Existing rows can be backfilled once withheroku run rake reports:backfill_revision. Note that/reports.jsonnow returnsrevisionas a string.Generated with Claude Code