Skip to content

test(ci): make document-upload tests hermetic, remove #210 quarantine#211

Merged
Jose-Gael-Cruz-Lopez merged 1 commit into
mainfrom
fix/hermetic-document-tests
Jun 12, 2026
Merged

test(ci): make document-upload tests hermetic, remove #210 quarantine#211
Jose-Gael-Cruz-Lopez merged 1 commit into
mainfrom
fix/hermetic-document-tests

Conversation

@Jose-Gael-Cruz-Lopez

Copy link
Copy Markdown
Member

What

Restores real CI coverage for the document-upload pipeline by making its tests hermetic, then removes the #210 quarantine from ci.yml.

Why

Standing up CI (#162) revealed the entire test_documents_routes module (22 tests) + test_graph_service::test_skips_self_edges were failing on a clean toolchain — never caught because there was no CI. Root cause: the upload legacy pipeline calls apply_graph_updatedb.connection.table() → the single shared httpx.Client, escaping each test's per-route table mock and hitting the network.

How

  • conftest.py: new autouse _hermetic_supabase_client fixture replaces db.connection._client with a stub returning benign empty responses — a shared safety net so no test can make a real Supabase call, regardless of which service bypasses per-test mocks. (Not per-test stubs.)
  • test_graph_service.py: guard the mocks["graph_edges"] lookup in test_skips_self_edges — the factory creates table mocks lazily, so when the self-edge is correctly skipped graph_edges is never accessed and the bare lookup raised KeyError, masking the real assert_not_called.
  • ci.yml: removed --ignore=tests/test_documents_routes.py and the --deselect for the graph test. Only the heavy OCR integration tests remain excluded (manual evals workflow).

Verified

Full gated suite with the quarantine removed: 614 passed (was 555 with 23 quarantined). All 22 document tests + the graph test genuinely run and PASS — not skipped, not xfail. No regression in the db-wrapper/storage tests (the new autouse mock is overridden by their own per-test mocks).

Closes #210

The whole test_documents_routes module + test_graph_service::test_skips_self_edges
were quarantined from CI under #210. Root cause: the document-upload legacy
pipeline calls apply_graph_update -> db.connection.table() -> the single shared
httpx client, escaping each test's per-route `table` mock and hitting the
network (ConnectError in CI). Add an autouse conftest fixture that replaces
db.connection._client with a benign stub returning empty responses, so no test
can make a real Supabase call — services that bypass per-test mocks now no-op
instead of connecting. Separately fix test_skips_self_edges, where a lazily
created mock key (graph_edges, never accessed when the self-edge is skipped)
raised KeyError and masked the real assertion. Remove the CI quarantine; all 22
document tests + the graph test now run and pass (gated suite: 614 passed).
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Jose-Gael-Cruz-Lopez, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 26 minutes and 7 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3efdf40a-8f6a-4d9e-a346-91ee3c8f1a89

📥 Commits

Reviewing files that changed from the base of the PR and between 7091e6b and f85845f.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • backend/tests/conftest.py
  • backend/tests/test_graph_service.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hermetic-document-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jose-Gael-Cruz-Lopez Jose-Gael-Cruz-Lopez merged commit c2692ae into main Jun 12, 2026
5 checks passed
@Jose-Gael-Cruz-Lopez Jose-Gael-Cruz-Lopez deleted the fix/hermetic-document-tests branch June 12, 2026 05:14
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.

Backend tests not hermetic: entire test_documents_routes module + graph self-edges make unmocked network calls (quarantined from CI)

1 participant