Skip to content

ci: add PR-gate workflow running pytest on every PR#16

Merged
chandrasekharan-zipstack merged 2 commits into
feat/org-migrationfrom
ci/pr-test-gate
May 27, 2026
Merged

ci: add PR-gate workflow running pytest on every PR#16
chandrasekharan-zipstack merged 2 commits into
feat/org-migrationfrom
ci/pr-test-gate

Conversation

@chandrasekharan-zipstack
Copy link
Copy Markdown
Contributor

Summary

Stacked on top of #15. Adds a CI workflow that runs pytest tests/ on every PR and push to main, across Python 3.11 and 3.12.

Existing main.yml only fires on workflow_dispatch (the release path), so unit tests never ran on PRs — the 167-test suite landed via #15 was only validated locally.

Why a new workflow rather than extending main.yml?

main.yml is the release pipeline: bumps version, tags, publishes to PyPI. Adding PR triggers there would entangle gate behaviour with release behaviour. Separate file keeps each one auditable in isolation.

Lint deliberately deferred

uv run ruff check src/ currently reports 10 pre-existing E501 violations on main. Turning lint on here would make this PR fail before it could merge. Cleaning those up + flipping lint on is a follow-up PR (small footprint, line-wraps only).

Test plan

  • PR opens → Lint and Test / lint-and-test (3.11) and (3.12) show up as required checks
  • Both run uv run pytest tests/ and report green (167 passed locally)

🤖 Generated with Claude Code

chandrasekharan-zipstack and others added 2 commits May 27, 2026 14:39
Existing main.yml only fires on workflow_dispatch (release path), so
unit tests never ran on PRs. Add a workflow that runs pytest on every
PR (and pushes to main) across Python 3.11 and 3.12. Lint is left as
a follow-up — src/ currently has 10 pre-existing E501 violations that
would block any gate; cleaning those up is a separate change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@chandrasekharan-zipstack chandrasekharan-zipstack merged commit 4779fb2 into feat/org-migration May 27, 2026
3 checks passed
@chandrasekharan-zipstack chandrasekharan-zipstack deleted the ci/pr-test-gate branch May 27, 2026 09:28
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 27, 2026

Greptile Summary

This PR adds a new test.yml GitHub Actions workflow that gates every PR and push to main by running pytest tests/ across Python 3.11 and 3.12, using a pinned uv version with caching.

  • The new workflow is intentionally separate from main.yml (the release pipeline) to keep gate and release concerns isolated — a sound design choice.
  • Lint is consciously deferred because of pre-existing ruff violations on main; the workflow and job names ("Lint and Test" / lint-and-test) therefore don't match their current contents.
  • uv sync --dev --all-extras is used here vs. uv sync --dev in main.yml, creating a subtle difference in the test environment vs. the published package's dependency set.

Confidence Score: 4/5

Safe to merge — adds a new CI workflow with no risk to existing code or the release pipeline.

The workflow is a straightforward, additive change that correctly separates test gating from the release pipeline. The only concerns are the misleading "Lint and Test" name (no lint step exists yet), the absence of a job timeout, and a minor environment inconsistency between --all-extras here and the bare --dev used in main.yml. None of these affect correctness of the test run today.

.github/workflows/test.yml — the --all-extras vs --dev discrepancy with main.yml is worth a second look if the package has optional extras that could mask missing-dependency failures.

Important Files Changed

Filename Overview
.github/workflows/test.yml New PR-gate CI workflow running pytest across Python 3.11 and 3.12; job is named lint-and-test but contains no lint step, and no job-level timeout is set.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR opened / push to main] --> B{Branch filter}
    B -->|targets main, feat/**, fix/**| C[lint-and-test matrix]
    B -->|other base branches| Z[workflow skipped]
    C --> D[Python 3.11]
    C --> E[Python 3.12]
    D --> F[checkout + setup-python + setup-uv]
    E --> F
    F --> G[uv sync --dev --all-extras]
    G --> H[cp tests/sample.env tests/.env]
    H --> I[uv run pytest tests/ -v]
    I -->|pass| J[✅ Green check]
    I -->|fail| K[❌ PR blocked]
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
.github/workflows/test.yml:9-14
**No job-level timeout set**

Without `timeout-minutes`, a hung test (e.g. a socket that never resolves against the placeholder `API_URL`) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding `timeout-minutes: 10` (or a value appropriate to your 167-test suite) on the job keeps failures fast.

### Issue 2 of 3
.github/workflows/test.yml:1-3
The job is named `lint-and-test` and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to `test` / "Test" to match what the workflow actually does, then rename again when lint is added.

```suggestion
name: Test

on:
```

### Issue 3 of 3
.github/workflows/test.yml:29-30
The `uv sync` command here uses `--all-extras`, but `main.yml` (the release pipeline) uses `uv sync --dev` without `--all-extras`. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.

```suggestion
      - name: Install dependencies
        run: uv sync --dev
```

Reviews (1): Last reviewed commit: "ci: install --all-extras so clone CLI te..." | Re-trigger Greptile

Comment on lines +9 to +14
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No job-level timeout set

Without timeout-minutes, a hung test (e.g. a socket that never resolves against the placeholder API_URL) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding timeout-minutes: 10 (or a value appropriate to your 167-test suite) on the job keeps failures fast.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 9-14

Comment:
**No job-level timeout set**

Without `timeout-minutes`, a hung test (e.g. a socket that never resolves against the placeholder `API_URL`) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding `timeout-minutes: 10` (or a value appropriate to your 167-test suite) on the job keeps failures fast.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

Comment on lines +1 to +3
name: Lint and Test

on:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The job is named lint-and-test and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to test / "Test" to match what the workflow actually does, then rename again when lint is added.

Suggested change
name: Lint and Test
on:
name: Test
on:
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 1-3

Comment:
The job is named `lint-and-test` and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to `test` / "Test" to match what the workflow actually does, then rename again when lint is added.

```suggestion
name: Test

on:
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

Comment on lines +29 to +30
- name: Install dependencies
run: uv sync --dev --all-extras
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The uv sync command here uses --all-extras, but main.yml (the release pipeline) uses uv sync --dev without --all-extras. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.

Suggested change
- name: Install dependencies
run: uv sync --dev --all-extras
- name: Install dependencies
run: uv sync --dev
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 29-30

Comment:
The `uv sync` command here uses `--all-extras`, but `main.yml` (the release pipeline) uses `uv sync --dev` without `--all-extras`. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.

```suggestion
      - name: Install dependencies
        run: uv sync --dev
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant