Skip to content

Integration test test_sql_context_filters_catalog_and_preserves_rank fails with ACL dependency object #28

Description

@doctorjia

Environment

CONTEXTHUB_INTEGRATION=1 pytest \
  tests/test_integration_propagation.py \
  tests/test_integration_collaboration.py \
  tests/test_integration_visibility.py \
  tests/test_datalake.py \
  -v

Observed behavior

Out of 39 tests, 38 pass and 1 fails: tests/test_datalake.py::test_sql_context_filters_catalog_and_preserves_rank.

Relevant failure trace:

E   AttributeError: 'Depends' object has no attribute 'check_read_access'

This happens inside search_sql_context in src/contexthub/api/routers/datalake.py when calling:

decision = await acl.check_read_access(db, uri, ctx)

From the test, search_sql_context is invoked directly with:

resp = await search_sql_context(
    SqlContextRequest(query="orders by user", catalog="mock", top_k=2),
    ctx=query_agent_ctx,
    db=acme_session,
    retrieval=_StubRetrieval(),
)

Since the test does not provide acl and masking, the default FastAPI Depends(...) objects are used instead of real ACLService / MaskingService instances, leading to the AttributeError.

Expected behavior

Given the 7b description in the setup guide, running the database integration tests with CONTEXTHUB_INTEGRATION=1 should result in all tests passing. [github](https://github.com/The-AI-Framework-and-Data-Tech-Lab-HK/ContextHub/blob/main/docs/setup/local-setup&end2end-verification-guide-zh.md)

Steps to reproduce

  1. Follow docs/setup/local-setup&end2end-verification-guide-zh.md to: [github](https://github.com/The-AI-Framework-and-Data-Tech-Lab-HK/ContextHub/blob/main/docs/setup/local-setup&end2end-verification-guide-zh.md)

    • Install PostgreSQL + pgvector
    • Create contexthub database and user
    • Set up Python venv and install dependencies (pip install -e ".[dev]", pip install greenlet, etc.)
    • Run migrations (alembic upgrade head)
    • Ensure PostgreSQL is running and health checks pass
  2. From repo root, in the activated venv, run: [github](https://github.com/The-AI-Framework-and-Data-Tech-Lab-HK/ContextHub/blob/main/docs/setup/local-setup&end2end-verification-guide-zh.md)

    CONTEXTHUB_INTEGRATION=1 pytest \
      tests/test_integration_propagation.py \
      tests/test_integration_collaboration.py \
      tests/test_integration_visibility.py \
      tests/test_datalake.py \
      -v
  3. Observe that only tests/test_datalake.py::test_sql_context_filters_catalog_and_preserves_rank fails with AttributeError: 'Depends' object has no attribute 'check_read_access'.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions