# S03: Git Commit SHA in Pipeline Version Metadata — UAT

**Milestone:** M006
**Written:** 2026-03-30T11:26:49.606Z

## UAT: Git Commit SHA in Pipeline Version Metadata

### Preconditions
- Chrysopedia stack running on ub01 (`docker ps --filter name=chrysopedia` shows all services)
- At least one technique page exists with version data (from a prior pipeline run)
- Access to ub01 via SSH

### Test 1: Backend — SHA present in pipeline metadata
**Steps:**
1. SSH to ub01
2. Run: `docker exec chrysopedia-api python -c "from pipeline.stages import _capture_pipeline_metadata; import json; m = _capture_pipeline_metadata(); print(json.dumps(m, indent=2))"`
3. Verify output contains `"git_commit_sha"` key

**Expected:** Key is present. Value is `"unknown"` on current containers (pre-rebuild) or a 7+ char hex string after rebuild.

### Test 2: Backend — SHA resolution fallback chain
**Steps:**
1. Run: `docker exec chrysopedia-api python -c "from pipeline.stages import _get_git_commit_sha; print(repr(_get_git_commit_sha()))"`
2. Verify returns a string (not None, not an exception)

**Expected:** Returns `'unknown'` in current container (no .git-commit file, no git binary). After `docker compose build --build-arg GIT_COMMIT_SHA=$(git rev-parse --short HEAD)`, returns the actual short SHA.

### Test 3: Frontend — Build succeeds with commit SHA rendering code
**Steps:**
1. SSH to ub01
2. Run: `cd /vmPool/r/repos/xpltdco/chrysopedia/frontend && npm run build`
3. Verify exit code 0, no TypeScript errors

**Expected:** Clean build, zero errors.

### Test 4: Frontend — Commit row hidden when SHA is "unknown"
**Steps:**
1. Open http://ub01:8096 in browser
2. Navigate to any technique page with version history
3. Expand a version's metadata panel
4. Look for a "Commit" row

**Expected:** No "Commit" row visible (current containers have "unknown" SHA, which is filtered out).

### Test 5: Frontend — Commit row visible after rebuild with real SHA
**Precondition:** Rebuild images with SHA: `cd /vmPool/r/repos/xpltdco/chrysopedia && GIT_COMMIT_SHA=$(git rev-parse --short HEAD) docker compose build chrysopedia-api && docker compose up -d`
**Steps:**
1. Re-run the pipeline on any video (or wait for next scheduled run)
2. Navigate to the resulting technique page's version metadata panel
3. Look for a "Commit" row

**Expected:** "Commit" row shows a 7-character hex string (e.g., `a1b2c3d`), rendered in monospace font matching the prompt hash styling.

### Edge Cases
- **No version data:** Technique pages without version history don't show the metadata panel at all — no crash expected.
- **SHA longer than 7 chars:** Display truncates to first 7 characters regardless of full SHA length.
- **Empty string SHA:** Treated same as any non-"unknown" value — would show empty code tag. Low risk since the fallback chain always produces either a real SHA or "unknown".
