Repository navigation
ci: replace starter workflow with real gates (#75) #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
|
||
| # CI gates for raglogs. Enforces what the project actually cares about: | ||
| # ruff lint, unit tests with a src/core coverage floor, and integration tests | ||
| # against a real Postgres+pgvector service — across the supported Python range. | ||
| name: CI | ||
|
|
||
| on: | ||
|
|
@@ -11,54 +11,87 @@ on: | |
| paths-ignore: | ||
| - "**/*.md" | ||
| - "CODEOWNERS" | ||
| - "Makefile" | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "CODEOWNERS" | ||
| - "Makefile" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ["3.10", "3.12"] | ||
| services: | ||
| postgres: | ||
| image: pgvector/pgvector:pg16 | ||
| env: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| POSTGRES_DB: raglogs | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd "pg_isready -U postgres" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| env: | ||
| DB_URL: postgresql+psycopg://postgres:postgres@localhost:5432/raglogs | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[dev]" | ||
| - name: Lint (ruff) | ||
| run: make lint | ||
| - name: Unit tests (with src/core coverage floor) | ||
| # Floor starts at the current level (~87%); ratchet upward over time, | ||
| # never set an aspirational number that turns main red. | ||
| run: pytest tests/unit/ --cov=src/core --cov-report=term-missing --cov-fail-under=85 | ||
| - name: Integration tests (real Postgres + pgvector) | ||
| run: make test-int | ||
|
|
||
| openapi: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e ".[dev]" | ||
| - name: Export OpenAPI | ||
| run: PYTHONPATH=. python scripts/export_openapi.py | ||
| - name: Upload OpenAPI artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: openapi.json | ||
| path: clients/openapi.json | ||
|
|
||
| docker: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: "3.10" | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install flake8 pytest | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
| - name: Lint with flake8 | ||
| run: | | ||
| # stop the build if there are Python syntax errors or undefined names | ||
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
| - name: Test with pytest | ||
| run: | | ||
| pytest | ||
| - name: Export OpenAPI | ||
| run: | | ||
| PYTHONPATH=. python scripts/export_openapi.py | ||
| - name: Upload OpenAPI artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: openapi.json | ||
| path: clients/openapi.json | ||
| - uses: actions/checkout@v7 | ||
| - name: Docker build smoke test | ||
| run: docker build -t raglogs:ci . | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING — the
Fix: copy the readme alongside the manifest before installing, e.g. |
||
|
|
||
| publish-openapi-release: | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| needs: build | ||
| needs: openapi | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,9 @@ def db_session(): | |
| with engine.connect() as conn: | ||
| conn.execute(text("CREATE EXTENSION IF NOT EXISTS vector")) | ||
| conn.commit() | ||
| # Clean slate so tests stay isolated when they share one database | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING (last one) — I traced it on a clean DB (so it's not the isolation issue you just fixed). Root cause:
Fix is test-only: make the 5 messages distinct so they don't dedup, e.g. embed the loop index: '"message": "Stripe webhook signature verification failed #%d",' % i(iterate With this, the |
||
| # (e.g. a single Postgres service across the whole CI run). | ||
| Base.metadata.drop_all(engine) | ||
| Base.metadata.create_all(engine) | ||
|
|
||
| with get_db() as db: | ||
|
|
@@ -50,19 +53,22 @@ def test_cloudwatch_ingest_then_explain(db_session): | |
| client.create_log_stream(logGroupName="/aws/lambda/my-service", logStreamName="stream-1") | ||
|
|
||
| now_ms = int(datetime.now(tz=timezone.utc).timestamp() * 1000) | ||
| # Distinct messages per event: identical content would be collapsed by | ||
| # the ingest content-dedup (see test_ingest_dedup), leaving one row and | ||
| # defeating this test's point — that all five persist with a timestamp. | ||
| client.put_log_events( | ||
| logGroupName="/aws/lambda/my-service", | ||
| logStreamName="stream-1", | ||
| logEvents=[ | ||
| { | ||
| "timestamp": now_ms, | ||
| "timestamp": now_ms + i * 1000, | ||
| "message": ( | ||
| '{"level": "error", "message": ' | ||
| '"Stripe webhook signature verification failed", ' | ||
| f'"Stripe webhook signature verification failed (attempt {i})", ' | ||
| '"service": "billing-worker"}' | ||
| ), | ||
| } | ||
| for _ in range(5) | ||
| for i in range(5) | ||
| ], | ||
| ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKING — this step is red on the PR's own CI run (
test (3.10)andtest (3.12)): 2 failed, 20 passed. The new gate is working exactly as intended — it runs the integration suite against real Postgres for the first time — and it immediately surfaces two genuine failures. Both must be fixed before this can merge green, otherwise merging makesmain's required checks red from day one.test_ingest_dedup.py::test_reingest_identical_lines_keeps_single_row— CONFIRMED test-isolation bug.assert 397 == 1. The assertion countsLogEntryglobally (select(func.count()).select_from(LogEntry)), not scoped to the job/file it just ingested. In a shared CI database, rows fromtest_full_flow(which ingests the wholesample_incidentcorpus) and others are still present, so the global count is 397. Scope the count to the ingested job (or fingerprint), or run the test in a rolled-back transaction / truncate between tests. (The dedup logic may well be fine — the test is what's wrong.)test_cloudwatch_ingest.py::test_cloudwatch_ingest_then_explain— LIKELY a real bug.assert 1 == 5: the query is job-scoped (ingestion_job_id == job.id,timestamp IS NOT NULL), so only 1 of 5 CloudWatch rows persisted with a timestamp. The test's own comment says this guards the CloudWatch-event-timestamp →LogEntry.timestampfallback (rows previously persisted null and were invisible to windowed queries). Please confirm whether the adapter fallback regressed or the fixture/expectation is off — but as it stands the contract the test documents is violated.Note these never ran locally — the PR description shows only
pytest tests/unit/was run — so CI is the first place they execute. That's the whole point of the PR, and it earned its keep on the first run.