You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
motief/docs/plans/2026-04-24-001-fix-ci-test-...

127 lines
4.0 KiB

---
title: "fix: CI test workflow references missing requirements.txt"
type: fix
status: active
date: 2026-04-24
---
# Fix: CI Test Workflow
## Overview
The scheduled CI workflow `.github/workflows/mindmodel-schedule.yml` attempts `pip install -r requirements.txt`, but this file does not exist. The project uses `uv` with `pyproject.toml` and `uv.lock`. This workflow fails silently (`|| true`) and never actually runs tests meaningfully.
## Problem Frame
- Python 3.11 is hardcoded in the workflow; the project requires >=3.13
- `requirements.txt` is missing; dependencies are in `pyproject.toml`
- No pytest gate on push/PR — regressions are only caught locally
- The mindmodel validator runs regardless, masking the test failure
## Requirements Trace
- R1. CI must install dependencies correctly using the project's package manager
- R2. CI must run pytest on push and PR to main
- R3. CI must use Python >=3.13 matching pyproject.toml
- R4. CI must fail visibly when tests fail (no `|| true` masking)
## Scope Boundaries
**Included:**
- Fix existing mindmodel-schedule.yml
- Add new pytest workflow for push/PR
**Excluded:**
- Changing test code or test dependencies
- Adding new tests
- Changing the mindmodel validator logic
## Key Technical Decisions
- **Use `uv` in CI** — matches local development and pyproject.toml. Use `astral-sh/setup-uv` action.
- **Separate workflows** — keep mindmodel schedule weekly, add pytest on push/PR
- **Fail fast** — remove `|| true` from pytest step
## Implementation Units
- [ ] U1. **Fix mindmodel-schedule.yml to use uv**
**Goal:** Make the scheduled workflow install deps and run tests correctly.
**Requirements:** R1, R3, R4
**Dependencies:** None
**Files:**
- Modify: `.github/workflows/mindmodel-schedule.yml`
**Approach:**
- Replace `actions/setup-python@v4` + `pip install` with `astral-sh/setup-uv@v5`
- Use `uv sync` to install from `pyproject.toml`/`uv.lock`
- Change Python version to 3.13
- Remove `|| true` from pytest step
- Keep mindmodel validator as-is
**Execution note:** Test-first — write a workflow validation test that checks the YAML parses correctly and references valid files.
**Test scenarios:**
- Happy path: Workflow YAML is valid GitHub Actions syntax
- Error path: pytest step fails if tests fail (no `|| true`)
- Integration: `uv sync` installs the same lockfile as local dev
**Verification:**
- `python -c "import yaml; yaml.safe_load(open('.github/workflows/mindmodel-schedule.yml'))"` passes
- Workflow runs successfully on next schedule trigger
---
- [ ] U2. **Add pytest workflow for push/PR**
**Goal:** Run tests on every push and PR to main.
**Requirements:** R2, R3, R4
**Dependencies:** None
**Files:**
- Create: `.github/workflows/pytest.yml`
**Approach:**
- Trigger on `push` to `main` and `pull_request` to `main`
- Use `astral-sh/setup-uv@v5` with Python 3.13
- Run `uv run pytest tests/ -q`
- Cache uv dependencies between runs
**Execution note:** Test-first — write a test that verifies the new workflow file exists and has required fields.
**Test scenarios:**
- Happy path: Workflow triggers on push to main
- Happy path: Workflow triggers on PR to main
- Error path: pytest fails → workflow fails
- Edge case: Caching speeds up repeated runs
**Verification:**
- New workflow appears in repo Actions tab
- Pushing this plan branch triggers the workflow
- All tests pass in CI
---
## Risks & Dependencies
| Risk | Mitigation |
|------|------------|
| uv action not available or fails | Pin to known good version; test on fork first |
| Tests fail in CI but pass locally | Likely env difference; debug in CI logs |
| Gitea runner differences | Use standard ubuntu-latest; no Gitea-specific actions |
## Documentation / Operational Notes
- Update ARCHITECTURE.md CI section if it mentions the old workflow
- Note in AGENTS.md that CI runs on GitHub Actions (not Gitea CI)
## Sources & References
- Existing workflow: `.github/workflows/mindmodel-schedule.yml`
- Package manager: `pyproject.toml`, `uv.lock`
- uv GitHub Action: https://github.com/astral-sh/setup-uv