---
id: T01
parent: S03
milestone: M006
provides: []
requires: []
affects: []
key_files: ["docker/Dockerfile.api", "docker-compose.yml", "backend/config.py", "backend/pipeline/stages.py"]
key_decisions: ["Resolution order for git SHA: .git-commit file → git rev-parse → config/env → unknown"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "Ran _capture_pipeline_metadata() inside chrysopedia-api container — assertion passed, git_commit_sha key present with expected "unknown" fallback value. Also verified _get_git_commit_sha() standalone returns "unknown" in container (no .git-commit file, no git binary)."
completed_at: 2026-03-30T11:24:18.222Z
blocker_discovered: false
---

# 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

> 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

## What Happened
---
id: T01
parent: S03
milestone: M006
key_files:
  - docker/Dockerfile.api
  - docker-compose.yml
  - backend/config.py
  - backend/pipeline/stages.py
key_decisions:
  - Resolution order for git SHA: .git-commit file → git rev-parse → config/env → unknown
duration: ""
verification_result: passed
completed_at: 2026-03-30T11:24:18.223Z
blocker_discovered: false
---

# 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

**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**

## What Happened

Edited four files on ub01: Dockerfile.api (ARG + RUN echo to .git-commit), docker-compose.yml (build args for api and worker), config.py (git_commit_sha Settings field), and stages.py (_get_git_commit_sha() helper with 4-tier fallback + git_commit_sha in _capture_pipeline_metadata() return dict). Verified by copying updated files into running container and confirming git_commit_sha key is present in metadata output.

## Verification

Ran _capture_pipeline_metadata() inside chrysopedia-api container — assertion passed, git_commit_sha key present with expected "unknown" fallback value. Also verified _get_git_commit_sha() standalone returns "unknown" in container (no .git-commit file, no git binary).

## Verification Evidence

| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `docker exec chrysopedia-api python -c "from pipeline.stages import _capture_pipeline_metadata; import json; m = _capture_pipeline_metadata(); assert 'git_commit_sha' in m; print(json.dumps(m, indent=2))"` | 0 | ✅ pass | 3000ms |
| 2 | `docker exec chrysopedia-api python -c "from pipeline.stages import _get_git_commit_sha; print(repr(_get_git_commit_sha()))"` | 0 | ✅ pass | 2000ms |


## Deviations

Verification ran inside Docker container instead of directly on host because Celery deps aren't installed on host Python.

## Known Issues

Running containers still use old image — need docker compose build to bake SHA into .git-commit. Expected; rebuild happens after slice completes.

## Files Created/Modified

- `docker/Dockerfile.api`
- `docker-compose.yml`
- `backend/config.py`
- `backend/pipeline/stages.py`


## Deviations
Verification ran inside Docker container instead of directly on host because Celery deps aren't installed on host Python.

## Known Issues
Running containers still use old image — need docker compose build to bake SHA into .git-commit. Expected; rebuild happens after slice completes.
