DefangLabs / DefangLabs/docs-chatbot

app/test_rag_system.py is not run in CI and has pre-existing bugs that make the suite error at setup

Open
#136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1
Forks
1
Avg merge
14h 50m
Merged PRs (30d)
21

Description

Noticed while working on #110 (PR #135): `.github/workflows/build.yaml` only runs `ruff check`/`ruff format --check` - no test step ever executes `app/test_rag_system.py` (or the other `test_*.py` files in `app/`).

The suite also has bugs that predate my change and would make it error out immediately if it were run:

  • `setUpClass` calls `cls.rag_system.rebuild_embeddings()` with no argument, but the method requires a `knowledge_base` argument.
  • `test_compute_document_scores` calls `self.rag_system.doc_about_embeddings()` as a function, but it's an attribute (a tensor), not a method.
  • `test_cache_check_rebuild_embeddings_on_error` patches `self.rag_system.rebuild_embeddings` to a fake before capturing the "real" method to call from inside the fake, so `real_rebuild_embeddings` actually ends up bound to the fake itself - calling it recurses into itself indefinitely.

None of this blocks anything today because the suite simply never runs, but it means the tests provide no actual safety net. Worth fixing the bugs and wiring `pytest`/`unittest` into `build.yaml` in a follow-up.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/workflows/build.yaml and app/test_rag_system.py. Run the test file locally to reproduce the setup and test errors, then inspect rebuild_embeddings, doc_about_embeddings, and the cache test's patching order. Done means the app tests run successfully in CI and provide a working safety net.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.