Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d2f0e60
chore: quick start phase 7
Ahmath-Gadji May 12, 2026
159fac1
refactor(7A.1): add asyncpg ConnectionManager and metadata-only schema
EnjoyBacon7 May 12, 2026
a035cc7
refactor(7A.4): move Alembic migrations to services/persistence/migra…
EnjoyBacon7 May 12, 2026
8314579
docs(sql-migration): point alembic paths at services/persistence/migr…
EnjoyBacon7 May 12, 2026
3a85bb2
docs(refactoring): log phase 7A.1 decisions
EnjoyBacon7 May 12, 2026
b177f95
refactor(7B): add MilvusVectorStore + log Phase 7B decisions
Ahmath-Gadji May 12, 2026
146c403
refactor(7A.4): nest Postgres alembic under services/persistence/migr…
Ahmath-Gadji May 12, 2026
82f0aab
refactor(7A.4): move Milvus migrations to services/persistence/migrat…
Ahmath-Gadji May 12, 2026
41c0f18
docs(refactoring): log Phase 7A.4 unified migrations namespace decisions
Ahmath-Gadji May 12, 2026
8e5f56a
test(7F): cover MilvusVectorStore — unit (pure logic) + live integration
Ahmath-Gadji May 13, 2026
4951cda
refactor(7A.2): add asyncpg repository implementations
EnjoyBacon7 May 13, 2026
9d93773
refactor(7A.3): add PostgresStore composite over the asyncpg repos
EnjoyBacon7 May 13, 2026
a0e5682
refactor(7E): wire storage adapters through ServiceContainer
EnjoyBacon7 May 13, 2026
d9eb6d0
test(7F): add integration suite for the asyncpg persistence layer
EnjoyBacon7 May 13, 2026
2158512
refactor(7E): wire create_vector_store to MilvusVectorStore
EnjoyBacon7 May 13, 2026
df56f8c
docs(refactoring): reconcile Phase 7B §1 with hybrid_search now on th…
Ahmath-Gadji May 13, 2026
ba6d6bc
chore(format): apply ruff format to phase-7 surface
EnjoyBacon7 May 13, 2026
985c411
refactor(7C): introduce MilvusDB god-object shim delegating to stores
Ahmath-Gadji May 13, 2026
1aa36cf
docs(refactoring): log Phase 7C decision to keep PG provisioning in t…
Ahmath-Gadji May 13, 2026
4f63ade
fix(persistence): delete files explicitly when deleting a partition
Ahmath-Gadji May 13, 2026
260ad1a
fix(workers): await whisper ObjectRef directly instead of ray.get()
Ahmath-Gadji May 13, 2026
d1b20cf
fix(7F): use Loguru logger and guard Alembic upgrade in ConnectionMan…
EnjoyBacon7 May 18, 2026
a12b20a
fix(7C): make PostgresStore.initialize idempotent to stop per-request…
EnjoyBacon7 May 18, 2026
79afed0
refactor(7A.2): split partition memberships into their own repo
EnjoyBacon7 May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Integration tests

on:
push:
branches:
- main
- dev
- "refactor/hexagonal"
- "refactor/phase-**"
pull_request:

jobs:
milvus-integration:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
with:
version: v2.34.0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Cache uv
uses: actions/cache@v4
with:
path: |
~/.cache/uv
key: uv-${{ runner.os }}-3.12-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-3.12-

- name: Install dependencies
run: uv sync

- name: Start Milvus stack
working-directory: tests/integration
run: docker compose up -d --wait --wait-timeout 180

- name: Verify Milvus reachable from host
run: |
for i in {1..30}; do
if curl -sf http://localhost:9091/healthz 2>/dev/null; then
echo "Milvus healthy after $i attempts"
break
fi
echo "Attempt $i/30 - waiting..."
sleep 2
done
curl -sf http://localhost:9091/healthz

- name: Run integration tests
env:
OPENRAG_TEST_VDB_HOST: localhost
OPENRAG_TEST_VDB_PORT: "19530"
run: uv run pytest tests/integration/ -m integration -v --tb=short

- name: Show logs on failure
if: failure()
working-directory: tests/integration
run: |
echo "=== Milvus Logs ==="
docker compose logs milvus --tail=200
echo "=== etcd Logs ==="
docker compose logs etcd --tail=50
echo "=== minio Logs ==="
docker compose logs minio --tail=50

- name: Cleanup
if: always()
working-directory: tests/integration
run: docker compose down -v
495 changes: 495 additions & 0 deletions REFACTORING_DECISION_LOG.md

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions docs/content/docs/documentation/milvus_migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ docker compose ps milvus
<TabItem label="GPU">
```bash
docker compose run --no-deps --rm --build --entrypoint "" openrag \
uv run python scripts/migrations/milvus/migrate.py --dry-run
uv run python services/persistence/migrations/milvus/migrate.py --dry-run
```
</TabItem>
<TabItem label="CPU">
```bash
docker compose --profile cpu run --no-deps --rm --build --entrypoint "" openrag-cpu \
uv run python scripts/migrations/milvus/migrate.py --dry-run
uv run python services/persistence/migrations/milvus/migrate.py --dry-run
```
</TabItem>
</Tabs>
Expand All @@ -158,13 +158,13 @@ Review the output to confirm which migrations are pending and what changes they
<TabItem label="GPU">
```bash
docker compose run --no-deps --rm --entrypoint "" openrag \
uv run python scripts/migrations/milvus/migrate.py
uv run python services/persistence/migrations/milvus/migrate.py
```
</TabItem>
<TabItem label="CPU">
```bash
docker compose --profile cpu run --no-deps --rm --entrypoint "" openrag-cpu \
uv run python scripts/migrations/milvus/migrate.py
uv run python services/persistence/migrations/milvus/migrate.py
```
</TabItem>
</Tabs>
Expand Down Expand Up @@ -198,22 +198,22 @@ To upgrade or downgrade to a specific schema version rather than the latest:
```bash
# Upgrade to version 2 only
docker compose run --no-deps --rm --entrypoint "" openrag \
uv run python scripts/migrations/milvus/migrate.py --target 2
uv run python services/persistence/migrations/milvus/migrate.py --target 2

# Downgrade to version 0 (resets version stamp and drops indexes)
docker compose run --no-deps --rm --entrypoint "" openrag \
uv run python scripts/migrations/milvus/migrate.py --downgrade --target 0
uv run python services/persistence/migrations/milvus/migrate.py --downgrade --target 0
```
</TabItem>
<TabItem label="CPU">
```bash
# Upgrade to version 2 only
docker compose --profile cpu run --no-deps --rm --entrypoint "" openrag-cpu \
uv run python scripts/migrations/milvus/migrate.py --target 2
uv run python services/persistence/migrations/milvus/migrate.py --target 2

# Downgrade to version 0 (resets version stamp and drops indexes)
docker compose --profile cpu run --no-deps --rm --entrypoint "" openrag-cpu \
uv run python scripts/migrations/milvus/migrate.py --downgrade --target 0
uv run python services/persistence/migrations/milvus/migrate.py --downgrade --target 0
```
</TabItem>
</Tabs>
Expand All @@ -226,13 +226,13 @@ Milvus does not support dropping fields. A downgrade only removes indexes and re
<TabItem label="GPU">
```bash
docker compose run --no-deps --rm --entrypoint "" openrag \
uv run python scripts/migrations/milvus/migrate.py --downgrade
uv run python services/persistence/migrations/milvus/migrate.py --downgrade
```
</TabItem>
<TabItem label="CPU">
```bash
docker compose --profile cpu run --no-deps --rm --entrypoint "" openrag-cpu \
uv run python scripts/migrations/milvus/migrate.py --downgrade
uv run python services/persistence/migrations/milvus/migrate.py --downgrade
```
</TabItem>
</Tabs>
Expand All @@ -243,14 +243,14 @@ To fully remove the fields you would need to recreate the collection from scratc

## Adding a New Migration Script

Migration scripts live in `openrag/scripts/migrations/milvus/`. The runner discovers them automatically — no registration step required.
Migration scripts live in `openrag/services/persistence/migrations/milvus/`. The runner discovers them automatically — no registration step required.

### Naming convention

Files must follow the pattern `N.short_description.py`, where `N` is the **target schema version** as a positive integer:

```
openrag/scripts/migrations/milvus/
openrag/services/persistence/migrations/milvus/
1.add_temporal_fields.py ← brings the schema to version 1
2.your_new_migration.py ← brings the schema to version 2
migrate.py ← generic runner (do not rename)
Expand Down
16 changes: 8 additions & 8 deletions docs/content/docs/documentation/sql_migration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Replace **`<revision_message>`** with your descriptive message before running th
docker compose up -d rdb
docker compose \
run --no-deps --build --rm \
--entrypoint "uv run alembic -c /app/openrag/scripts/migrations/alembic/alembic.ini revision --autogenerate -m '<revision_message>'" \
--entrypoint "uv run alembic -c /app/openrag/services/persistence/migrations/alembic/alembic.ini revision --autogenerate -m '<revision_message>'" \
openrag
```

It will create a new migration script in the `openrag/scripts/migrations/alembic/versions/` directory.
It will create a new migration script in the `openrag/services/persistence/migrations/alembic/versions/` directory.

### Step 2: Apply the Migration

Expand All @@ -52,7 +52,7 @@ Rebuilds the image to ensure the migration runs against the exact code being dep
docker compose up -d rdb
docker compose \
run --no-deps --build --rm \
--entrypoint "uv run alembic -c /app/openrag/scripts/migrations/alembic/alembic.ini upgrade head" \
--entrypoint "uv run alembic -c /app/openrag/services/persistence/migrations/alembic/alembic.ini upgrade head" \
openrag; docker compose down
```

Expand All @@ -62,7 +62,7 @@ If the stack is already running, skip the rebuild:

```bash title="Apply migrations (exec)"
docker compose exec openrag \
uv run alembic -c /app/openrag/scripts/migrations/alembic/alembic.ini upgrade head
uv run alembic -c /app/openrag/services/persistence/migrations/alembic/alembic.ini upgrade head
```

#### Option C: Local (development)
Expand All @@ -71,14 +71,14 @@ Run alembic directly with your local venv — no Docker needed:

```bash title="Apply migrations (local)"
DATABASE_URL=postgresql://user:pass@localhost:5432/openrag \
uv run alembic -c openrag/scripts/migrations/alembic/alembic.ini upgrade head
uv run alembic -c openrag/services/persistence/migrations/alembic/alembic.ini upgrade head
```

:::tip[Quick alternative: run inside a running container]
If your stack is already running, you can apply migrations directly without rebuilding:
```bash title="Apply migrations via exec"
docker compose exec -w /app/openrag openrag \
/app/.venv/bin/alembic -c scripts/migrations/alembic/alembic.ini upgrade head
/app/.venv/bin/alembic -c services/persistence/migrations/alembic/alembic.ini upgrade head
```
:::

Expand Down Expand Up @@ -108,7 +108,7 @@ This usually happens when two or more migration scripts are created independentl
```bash title="Merge Alembic heads"
docker compose up -d rdb
docker compose run --no-deps --build --rm \
--entrypoint "uv run alembic -c /app/openrag/scripts/migrations/alembic/alembic.ini merge -m 'merge heads' <head1> <head2>" \
--entrypoint "uv run alembic -c /app/openrag/services/persistence/migrations/alembic/alembic.ini merge -m 'merge heads' <head1> <head2>" \
openrag
```
This will generate a new migration script that merges the two branches.
Expand All @@ -118,7 +118,7 @@ This usually happens when two or more migration scripts are created independentl
```bash title="Apply migrations after merge"
docker compose up -d rdb
docker compose run --no-deps --build --rm \
--entrypoint "uv run alembic -c /app/openrag/scripts/migrations/alembic/alembic.ini upgrade head" \
--entrypoint "uv run alembic -c /app/openrag/services/persistence/migrations/alembic/alembic.ini upgrade head" \
openrag; docker compose down
```

Expand Down
Loading
Loading