CodeRabbit Fixes Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Address CodeRabbit findings in ingest container and tests, update test expectations for stable IDs, and confirm CI health.

Architecture: Keep runtime behavior unchanged except for safer configuration defaults and repository loading. Replace brittle path logic with env-configurable or package-resource discovery and centralize repository loading in a helper. Update tests to reflect intended identity contract and improve isolation.

Tech Stack: Python, pytest/pytest-asyncio, SQLAlchemy async, FastAPI DI.

Task 1: Update Ingest Unit Tests

Files:

Step 1: Write the failing test

1
2
3
4
5
6
async def test_ingest_document_url_without_scheme(self, handler, mock_fetcher):
    ...
    result = await handler.execute(command)
    assert result.success is False
    assert "Invalid source URL" in result.error
    assert not mock_fetcher.fetch_called

Step 2: Run test to verify it fails

Run: python -m pytest libs/ingest/application/tests/test_ingest_document_handler.py::TestIngestDocumentHandler::test_ingest_document_url_without_scheme -v Expected: FAIL because fetch_called is not asserted.

Step 3: Write minimal implementation

Step 4: Run test to verify it passes

Run: python -m pytest libs/ingest/application/tests/test_ingest_document_handler.py -v Expected: PASS.

Step 5: Commit

1
2
git add libs/ingest/application/tests/test_ingest_document_handler.py
git commit -m "test: tighten ingest handler fixtures and URL validation"

Task 2: Refactor Container Repository Loading and Config

Files:

Step 1: Write the failing test

No direct test exists. Add a minimal focused test only if behavior regression is likely; otherwise validate with existing tests and just ci.

Step 2: Implement minimal code

Step 3: Run test to verify it passes

Run: python -m pytest libs/ingest/application/tests/test_ingest_document_handler.py -v Expected: PASS.

Step 4: Commit

1
2
git add libs/ingest/application/src/container.py
git commit -m "refactor: harden ingest container wiring"

Task 3: Improve Integration Test Isolation and Expectations

Files:

Step 1: Write the failing test

Add expectations for stable IDs and persisted updated content in test_ingest_document_updates_existing.

Step 2: Run test to verify it fails

Run: python -m pytest libs/ingest/adapters/tests/integration/test_handler_integration.py::TestIngestDocumentIntegration::test_ingest_document_updates_existing -v Expected: FAIL due to missing assertions and session isolation.

Step 3: Write minimal implementation

Step 4: Run test to verify it passes

Run: python -m pytest libs/ingest/adapters/tests/integration/test_handler_integration.py -v Expected: PASS.

Step 5: Commit

1
2
git add libs/ingest/adapters/tests/integration/test_handler_integration.py
git commit -m "test: isolate ingest integration sessions and assert update semantics"

Task 4: Update CodeRabbit Checklist and Verify CI

Files:

Step 1: Check off completed tasks

Mark all completed items as [x].

Step 2: Run full CI

Run: just ci Expected: PASS.

Step 3: Commit

1
2
git add tmp/coderabbit_results.md
git commit -m "chore: check off CodeRabbit tasks"