Skip to content

Store git commit SHA in reports.revision - #653

Merged
hsbt merged 4 commits into
masterfrom
claude/revision-string-sha
Jul 27, 2026
Merged

Store git commit SHA in reports.revision#653
hsbt merged 4 commits into
masterfrom
claude/revision-string-sha

Conversation

@hsbt

@hsbt hsbt commented Jul 27, 2026

Copy link
Copy Markdown
Member

Reports built from git have no revision value. The commit SHA is extracted from the ltsv column with a regexp on every access, and the revision is not searchable by commit. This changes reports.revision from integer to string so that SVN revision numbers and full 40-hex commit SHAs share one column. Report.scan_recent_ltsv now stores the full SHA, Report#sha1 prefers the column and falls back to ltsv extraction for old rows, and the index page shows the first 11 characters linked to the GitHub commit. The migration adds a varchar_pattern_ops index so prefix searches by short SHA stay on an index scan in PostgreSQL. Existing rows can be backfilled once with heroku run rake reports:backfill_revision. Note that /reports.json now returns revision as a string.

Generated with Claude Code

hsbt and others added 4 commits July 27, 2026 14:33
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>
@hsbt
hsbt merged commit 9a188cb into master Jul 27, 2026
2 checks passed
@hsbt
hsbt deleted the claude/revision-string-sha branch July 27, 2026 07:17
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