Conversation
Remove upstream CI/release/docs-deploy workflows that depend on Vertex AI, Cohere, PyPI, npm secrets and multi-platform builds we don't need. Replace with a lightweight CI (lint, pure unit tests, package build, slim Docker build validation) and a release workflow that pushes slim images to ghcr.io/franchb on v* tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe pull request consolidates GitHub Actions workflows by introducing a new streamlined CI pipeline in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
.github/workflows/release.yml (2)
44-52: Redundantlatesttag —latest=auto+type=raw,value=latestboth producelatest-slim.The
flavor: latest=autoalready generates alatest-slimtag for semver-tagged pushes. The explicittype=raw,value=lateston line 52 will also producelatest-slim(due to the suffix). The metadata action deduplicates, so it's not broken, but the raw entry is unnecessary.♻️ Remove redundant raw latest tag
tags: | type=semver,pattern={{version}},value=${{ steps.get_version.outputs.VERSION }} type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version.outputs.VERSION }} type=semver,pattern={{major}},value=${{ steps.get_version.outputs.VERSION }} - type=raw,value=latest🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 44 - 52, The workflow currently uses both flavor: latest=auto (which produces latest-slim due to suffix) and an explicit tags entry type=raw,value=latest that duplicates that same latest-slim tag; remove the redundant raw tag line (the tags entry "type=raw,value=latest") so only flavor: latest=auto generates the latest-slim tag, leaving the semver tag lines and flavor/suffix intact.
54-66: Release builds lack layer caching — each tag push rebuilds from scratch.Without
cache-from/cache-to, every release rebuild pulls and builds all layers. For a slim image this is likely tolerable, but adding GHA cache is low effort and speeds up subsequent builds.♻️ Optional: add GHA build cache
- name: Build and push uses: docker/build-push-action@v6 with: context: . file: docker/standalone/Dockerfile target: ${{ matrix.target }} build-args: | INCLUDE_LOCAL_MODELS=false PRELOAD_ML_MODELS=false push: true platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release.yml around lines 54 - 66, The Build and push step using docker/build-push-action@v6 has no layer caching configured so each tag rebuilds from scratch; add cache inputs to the step by including cache-from and cache-to entries under the same "with" for the "Build and push" step (the step that uses docker/build-push-action@v6) — e.g. add cache-from: type=gha,ref=${{ github.ref }} (or github.sha) and cache-to: type=gha,mode=max,ref=${{ github.ref }} to enable GitHub Actions layer caching and speed up subsequent matrix.target builds while keeping push, tags and platforms as-is..github/workflows/ci.yml (2)
73-87: Hardcoded test file list will silently skip new tests.Explicitly listing test files means any new pure-unit-test file added under
tests/won't run in CI until someone remembers to update this workflow. If the intent is to run only a known-safe subset (no external deps), consider using a pytest marker (e.g.,@pytest.mark.unit) instead, which is self-documenting and automatically picks up new tests.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 73 - 87, The CI job "Run unit tests" currently hardcodes a file list in the pytest invocation (the "uv run pytest" command), which will silently skip any newly added tests; update the workflow so pytest uses discovery or a marker instead of an explicit file list — either remove the explicit filenames so the command runs `pytest -v --timeout 120 -n auto --dist loadgroup` to discover all tests under tests/, or switch to using a pytest marker (e.g., require `@pytest.mark.unit` on true unit tests and run pytest with `-m unit`) and update the "Run unit tests" step accordingly to ensure new unit tests are picked up automatically.
43-46: Fragile directory navigation with chainedcdcommands.The relative
cd ../navigation couples each line to the previous working directory. If a directory is renamed or reordered, it silently breaks. Consider using absolute paths from$GITHUB_WORKSPACEor separaterunblocks with explicitworking-directory.♻️ Suggested improvement
- name: Install Python dependencies run: | - cd hindsight-api && uv sync --frozen --index-strategy unsafe-best-match - cd ../hindsight-dev && uv sync --frozen --index-strategy unsafe-best-match - cd ../hindsight-embed && uv sync --frozen --index-strategy unsafe-best-match + for dir in hindsight-api hindsight-dev hindsight-embed; do + pushd "$dir" + uv sync --frozen --index-strategy unsafe-best-match + popd + done🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 43 - 46, Replace fragile chained relative cd commands (the three lines that start with "cd hindsight-api && uv sync --frozen --index-strategy unsafe-best-match", "cd ../hindsight-dev && uv sync --frozen --index-strategy unsafe-best-match", and "cd ../hindsight-embed && uv sync --frozen --index-strategy unsafe-best-match") with either: 1) explicit paths using $GITHUB_WORKSPACE (e.g. "$GITHUB_WORKSPACE/hindsight-api" etc.) in the same run block, or 2) split into separate run steps that use the actions/checkout-provided working-directory key pointing at hindsight-api, hindsight-dev, and hindsight-embed respectively; update each step to call "uv sync --frozen --index-strategy unsafe-best-match" without relying on chained cd ../ navigation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 89-107: The build-api job is missing the UV_INDEX environment
variable needed to resolve torch, so add UV_INDEX with the value
"pytorch=https://download.pytorch.org/whl/cpu" to the build-api job's
environment (apply it at the job level or to the steps that run uv, e.g., before
the "Install uv" or "Build hindsight-api" steps) so that the uv build command in
the Build hindsight-api step can fetch PyTorch; reference the build-api job name
and the UV_INDEX env var when making the change.
---
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 73-87: The CI job "Run unit tests" currently hardcodes a file list
in the pytest invocation (the "uv run pytest" command), which will silently skip
any newly added tests; update the workflow so pytest uses discovery or a marker
instead of an explicit file list — either remove the explicit filenames so the
command runs `pytest -v --timeout 120 -n auto --dist loadgroup` to discover all
tests under tests/, or switch to using a pytest marker (e.g., require
`@pytest.mark.unit` on true unit tests and run pytest with `-m unit`) and update
the "Run unit tests" step accordingly to ensure new unit tests are picked up
automatically.
- Around line 43-46: Replace fragile chained relative cd commands (the three
lines that start with "cd hindsight-api && uv sync --frozen --index-strategy
unsafe-best-match", "cd ../hindsight-dev && uv sync --frozen --index-strategy
unsafe-best-match", and "cd ../hindsight-embed && uv sync --frozen
--index-strategy unsafe-best-match") with either: 1) explicit paths using
$GITHUB_WORKSPACE (e.g. "$GITHUB_WORKSPACE/hindsight-api" etc.) in the same run
block, or 2) split into separate run steps that use the
actions/checkout-provided working-directory key pointing at hindsight-api,
hindsight-dev, and hindsight-embed respectively; update each step to call "uv
sync --frozen --index-strategy unsafe-best-match" without relying on chained cd
../ navigation.
In @.github/workflows/release.yml:
- Around line 44-52: The workflow currently uses both flavor: latest=auto (which
produces latest-slim due to suffix) and an explicit tags entry
type=raw,value=latest that duplicates that same latest-slim tag; remove the
redundant raw tag line (the tags entry "type=raw,value=latest") so only flavor:
latest=auto generates the latest-slim tag, leaving the semver tag lines and
flavor/suffix intact.
- Around line 54-66: The Build and push step using docker/build-push-action@v6
has no layer caching configured so each tag rebuilds from scratch; add cache
inputs to the step by including cache-from and cache-to entries under the same
"with" for the "Build and push" step (the step that uses
docker/build-push-action@v6) — e.g. add cache-from: type=gha,ref=${{ github.ref
}} (or github.sha) and cache-to: type=gha,mode=max,ref=${{ github.ref }} to
enable GitHub Actions layer caching and speed up subsequent matrix.target builds
while keeping push, tags and platforms as-is.
| build-api: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| - name: Build hindsight-api | ||
| working-directory: ./hindsight-api | ||
| run: uv build |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if hindsight-api has PyTorch-related dependency
echo "=== Checking hindsight-api/pyproject.toml for PyTorch dependencies ==="
if [ -f "hindsight-api/pyproject.toml" ]; then
cat hindsight-api/pyproject.toml | grep -iE 'torch|pytorch'
else
echo "hindsight-api/pyproject.toml not found"
fiRepository: franchb/hindsight
Length of output: 266
🏁 Script executed:
#!/bin/bash
# Check the entire CI workflow to see UV_INDEX usage in all jobs
echo "=== Checking CI workflow for UV_INDEX environment variable ==="
cat .github/workflows/ci.yml | grep -A 5 -B 5 "UV_INDEX"Repository: franchb/hindsight
Length of output: 527
🏁 Script executed:
#!/bin/bash
# Get the structure of the workflow file around build-api, lint, and unit-tests jobs
echo "=== Checking workflow structure ==="
cat .github/workflows/ci.ymlRepository: franchb/hindsight
Length of output: 3621
Add missing UV_INDEX env var to build-api job
The build-api job is missing the UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu environment variable that both lint and unit-tests jobs define. Since hindsight-api has a torch dependency (torch>=2.6.0), the uv build command will fail to resolve it without the PyTorch index configured.
Proposed fix
build-api:
runs-on: ubuntu-latest
+ env:
+ UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu
steps:
- uses: actions/checkout@v4📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| build-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Build hindsight-api | |
| working-directory: ./hindsight-api | |
| run: uv build | |
| build-api: | |
| runs-on: ubuntu-latest | |
| env: | |
| UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| - name: Build hindsight-api | |
| working-directory: ./hindsight-api | |
| run: uv build |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/ci.yml around lines 89 - 107, The build-api job is missing
the UV_INDEX environment variable needed to resolve torch, so add UV_INDEX with
the value "pytorch=https://download.pytorch.org/whl/cpu" to the build-api job's
environment (apply it at the job level or to the steps that run uv, e.g., before
the "Install uv" or "Build hindsight-api" steps) so that the uv build command in
the Build hindsight-api step can fetch PyTorch; reference the build-api job name
and the UV_INDEX env var when making the change.
Summary
ci.ymlwith 4 jobs: lint, pure unit tests, package build, slim Docker build validationrelease.ymlthat pushes slim-only images (hindsight-api,hindsight) toghcr.io/franchb/onv*tagsTest plan
v0.0.1-testand verify images appear atghcr.io/franchb/hindsight-api:0.0.1-test-slimandghcr.io/franchb/hindsight:0.0.1-test-slim🤖 Generated with Claude Code
Summary by CodeRabbit