Skip to content

Footer: full commit SHA in URL, short hash for display#2651

Open
0xharkirat wants to merge 1 commit into
mainfrom
hs/footer-full-commit-sha
Open

Footer: full commit SHA in URL, short hash for display#2651
0xharkirat wants to merge 1 commit into
mainfrom
hs/footer-full-commit-sha

Conversation

@0xharkirat
Copy link
Copy Markdown
Member

@0xharkirat 0xharkirat commented Jun 1, 2026

Summary

Follow-up to #2646. The footer commit link was using the same 7-char short hash for both the displayed label and the GitHub commit URL. Short SHAs in URLs can be ambiguous (GitHub returns 404 if multiple commits share the same 7-char prefix). Probability is vanishingly small in this repo (~250 commits) but the fix costs ~1 line, so worth doing now and propagating to SSW.Website and SSW.People for parity.

Approach

  • Carry the full 40-char SHA through COMMIT_HASH (drop the cut -c1-7 / --short=7 in both setters).
  • Slice for display only — {commitHash.slice(0, 7)} in the JSX. URL uses the full ${commitHash} so it always resolves.
  • Same single env (COMMIT_HASH) — no new variables, no new threading. KISS preserved.

Bonus: the Docker label org.opencontainers.image.build.commit now contains the full SHA, which is what the OCI spec actually expects for revision.

Test plan

  • Local: pnpm dev with COMMIT_HASH=27836617e5b23919c8d98baee3a274045b8f4915 in .env → display shows 2783661, link points to …/commit/27836617e5b23919c8d98baee3a274045b8f4915
  • On preview deploy (will trigger /deploy after merge to test in slot)

Follow-up

Same change will be applied to SSW.Website (open PR #4720) and SSW.People once this merges, to keep all three footers consistent.

🤖 Generated with Claude Code

The footer's commit URL was previously constructed with the same 7-char
hash used for display. GitHub returns 404 if a short SHA in the URL is
ambiguous (multiple commits matching the same 7-char prefix) —
vanishingly rare in this repo but trivially fixable: carry the full
40-char SHA through the env, slice in the JSX for the visible label
only.

- build-artifacts.yml: drop `cut -c1-7` / `--short=7` in both
  COMMIT_HASH setters. The env now carries the full SHA (also matches
  the OCI convention for `org.opencontainers.image.build.commit`, which
  expects the full revision).
- footer.tsx: render `{commitHash.slice(0, 7)}` for the visible label;
  the URL keeps using the full `${commitHash}` so it always resolves.

User-facing: same 7-char text, link always works. Same pattern will
land in SSW.Website and SSW.People to keep all three footers
consistent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0xharkirat 0xharkirat requested a review from tiagov8 June 1, 2026 02:06
0xharkirat added a commit to SSWConsulting/SSW.Website that referenced this pull request Jun 1, 2026
Mirrors the same pattern raised in SSWConsulting/SSW.Rules#2651:
- commitHash now holds the full SHA from NEXT_PUBLIC_GITHUB_SHA
  (was sliced at module level).
- URL keeps using ${commitHash} -> always resolves unambiguously.
- Display label uses {commitHash.slice(0, 7)} -> same visible 7-char
  text, no real-world ambiguity for users.

Address Copilot's review comment (#4720) about short-SHA ambiguity, and
keeps the 3 SSW footers consistent on the same approach.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@0xharkirat 0xharkirat requested a review from Copilot June 1, 2026 02:11
@0xharkirat 0xharkirat requested a review from Freego1783 June 1, 2026 02:12
@0xharkirat
Copy link
Copy Markdown
Member Author

/deploy

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates footer commit handling so the GitHub commit URL uses the full SHA while keeping the footer display compact with a 7-character label.

Changes:

  • Pass the full commit SHA through COMMIT_HASH in the build workflow.
  • Display only the first 7 characters of the commit hash in the footer.
  • Preserve downstream Docker build/env propagation using the same COMMIT_HASH variable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
components/layout/nav/footer.tsx Shortens the visible commit label while keeping the link target as the full hash.
.github/workflows/build-artifacts.yml Stops truncating COMMIT_HASH during build metadata generation and checkout-based refresh.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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