# S03: Git Commit SHA in Pipeline Version Metadata

**Goal:** Pipeline captures the current git commit SHA at Docker build time, includes it in pipeline version metadata, and the frontend displays it in the version metadata panel.
**Demo:** After this: Running the pipeline captures the current git commit SHA. Viewing a technique page version shows the commit hash in the metadata panel.

## Tasks
- [x] **T01: Added GIT_COMMIT_SHA build arg to Dockerfile.api, compose build args for api/worker, config field, and _get_git_commit_sha() helper — pipeline metadata now includes git_commit_sha key** — Add GIT_COMMIT_SHA build arg to Dockerfile.api, pass it from docker-compose.yml, write it to /app/.git-commit. Add a helper function in stages.py that reads the SHA from the file (Docker) or runs `git rev-parse --short HEAD` (local dev) with fallback to "unknown". Extend `_capture_pipeline_metadata()` to include the `git_commit_sha` key. Add `git_commit_sha` setting to config.py as an additional fallback.

**Important context for executor:** The canonical codebase is on ub01 at `/vmPool/r/repos/xpltdco/chrysopedia`. SSH with `ssh ub01` to edit files and test. The Docker compose stack runs there. The local working directory has .gsd/ planning artifacts only.

Steps:
1. SSH to ub01, edit `docker/Dockerfile.api` — add `ARG GIT_COMMIT_SHA=unknown` and `RUN echo "${GIT_COMMIT_SHA}" > /app/.git-commit` after the `COPY backend/ /app/` line
2. Edit `docker-compose.yml` — add `args: GIT_COMMIT_SHA: ${GIT_COMMIT_SHA:-unknown}` to both `chrysopedia-api` and `chrysopedia-worker` build sections (they already have `build: context: . dockerfile: docker/Dockerfile.api`)
3. Edit `backend/config.py` — add `git_commit_sha: str = "unknown"` field to Settings class
4. Edit `backend/pipeline/stages.py` — add `_get_git_commit_sha()` helper that tries: (a) read `/app/.git-commit` file, (b) run `subprocess.run(['git', 'rev-parse', '--short', 'HEAD'])`, (c) return `get_settings().git_commit_sha`, (d) return `"unknown"`. Add `"git_commit_sha": _get_git_commit_sha()` to the dict returned by `_capture_pipeline_metadata()`
5. Verify: run `python -c "from pipeline.stages import _capture_pipeline_metadata; print(_capture_pipeline_metadata())"` from backend dir (should show git_commit_sha key)
  - Estimate: 30m
  - Files: docker/Dockerfile.api, docker-compose.yml, backend/config.py, backend/pipeline/stages.py
  - Verify: ssh ub01 'cd /vmPool/r/repos/xpltdco/chrysopedia/backend && python -c "from pipeline.stages import _capture_pipeline_metadata; import json; m = _capture_pipeline_metadata(); assert \"git_commit_sha\" in m, f\"missing key: {m.keys()}\"; print(json.dumps(m, indent=2))"'
- [x] **T02: Added "Commit" row to version metadata panel on TechniquePage — renders abbreviated 7-char git SHA using existing hash-value monospace styling, hidden when SHA is "unknown"** — Add a conditional render of `git_commit_sha` in the version metadata panel on TechniquePage.tsx. The panel already renders model, captured_at, and prompt_hashes — add a new item for the commit hash using monospace font.

**Important context for executor:** The canonical codebase is on ub01 at `/vmPool/r/repos/xpltdco/chrysopedia`. SSH with `ssh ub01` to edit files and build. The frontend is at `frontend/` in that repo.

Steps:
1. SSH to ub01, read `frontend/src/pages/TechniquePage.tsx` lines 315-365 to see existing metadata panel structure
2. After the `prompt_hashes` conditional block (around line 358) and before the closing `</div>` of `version-metadata__grid`, add a new conditional block checking `"git_commit_sha" in versionDetail.pipeline_metadata`. Render it as a `version-metadata__item` with key label "Commit" and value in a `<code>` element with monospace font styling (reuse existing `version-metadata__hash-value` class or apply inline). Show first 7 chars: `String(versionDetail.pipeline_metadata.git_commit_sha).slice(0, 7)`
3. Run `cd frontend && npm run build` to verify zero TypeScript errors
  - Estimate: 15m
  - Files: frontend/src/pages/TechniquePage.tsx
  - Verify: ssh ub01 'cd /vmPool/r/repos/xpltdco/chrysopedia/frontend && npm run build 2>&1 | tail -5'
