Skip to content

test: add coverage for v4 ingestion pipeline - #318

Open
fizae47-arch wants to merge 1 commit into
kubeflow:mainfrom
fizae47-arch:test/issue-259-v4-ingest-tests
Open

fizae47-arch wants to merge 1 commit into
kubeflow:mainfrom
fizae47-arch:test/issue-259-v4-ingest-tests

Conversation

@fizae47-arch

Copy link
Copy Markdown

Summary

Adds automated test coverage for the v4 ingestion pipeline as requested in #259.

Changes

  • Added test_hugo_ingest.py covering YAML/TOML frontmatter parsing, BOM handling, malformed frontmatter, and HTML table conversion including rowspan/colspan.
  • Added test_canonical_rag_ingest.py covering canonical document metadata, section paths, chunking, release dates, and document types.
  • Added test_milvus_store.py covering schema/index definitions, embedding preparation, validation, and store safety checks.
  • Added required test dependencies to requirements-test.txt.

Validation

Ran:

pytest -q tests/test_hugo_ingest.py tests/test_canonical_rag_ingest.py tests/test_milvus_store.py --tb=short

Result: 98 passed

Milvus store operations are tested with a fake client. Schema structure is checked using PyMilvus objects. No live Milvus server integration test was run.

Closes #259

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tarekabouzeid for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for content ingestion, including frontmatter and HTML table handling.
    • Added checks for document parsing, chunking, metadata, and Unicode-preserving output.
    • Added validation of search-index storage workflows, including record creation, updates, and rebuild safeguards.
    • These checks help verify expected behavior across common content formats and storage scenarios.

The change adds tests for canonical RAG ingestion, Hugo ingestion helpers, and Milvus storage. It also pins pymilvus and toml in the test requirements.

Changes: V4 ingestion test coverage

Layer / File(s) Summary
Canonical RAG serialization and parsing
tests/test_canonical_rag_ingest.py
Tests cover data serialization, Markdown parsing, chunking, metadata inference, record construction, parse-and-chunk results, and Unicode-preserving JSONL output.
Hugo ingestion helpers
tests/test_hugo_ingest.py, requirements-test.txt
Tests cover YAML and TOML frontmatter parsing and HTML-table conversion. The test requirements add pinned toml.
Milvus validation and storage
tests/test_milvus_store.py, requirements-test.txt
Tests cover validation, embedding, schema and index construction, storage operations, and clean-rebuild gates. The test requirements add pinned pymilvus.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Suggested reviewers: santhoshtoorpu, kmr-rohit, franciscojavierarceo

Merge Risk: Minimal · up to 5f186

This change adds regression tests for the v4 ingestion pipeline and pins two test-only dependencies, with no production behavior change. No merge-blocking risk was found. The tests use a fake Milvus client, so live-server behavior remains untested.

Security architecture risk: Minimal · up to 5f186

The PR adds ingestion and storage tests. The new dependencies are installed for tests, not by the inspected release image builds, and the storage tests use a fake client rather than a live database.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #259 asks for tests of the v4 ingest path. Coverage at head, by file:

- tests/test_hugo_ingest.py (read at head): covers parse_frontmatter for YAML, TOML, no frontmatter, empty content, invalid…
Confirm that a test exercises parse_canonical_document with title, description, and weight frontmatter keys. Cite the test file and test name. If no such test exists, add one to test_canonical_rag_ingest.py or test_hugo_ingest.py. Re-assess…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title "test: add coverage for v4 ingestion pipeline" matches the main change. The PR adds three test modules for the v4 ingestion path (Hugo frontmatter and HTML table tests, canonical RAG ingest …
Description check Passed The description states the purpose (automated test coverage for the v4 ingestion pipeline, per #259). It lists each added test file with its covered areas, the added test dependencies, the pytest comm…
Out of Scope Changes check Passed All changes support the #259 objectives. The three new test modules test the named v4 production modules. requirements-test.txt adds pymilvus, which the Milvus tests use, and toml, which is a test dep…
Full details: Title check

Explanation

The title "test: add coverage for v4 ingestion pipeline" matches the main change. The PR adds three test modules for the v4 ingestion path (Hugo frontmatter and HTML table tests, canonical RAG ingest tests, and Milvus store tests) plus test dependencies in requirements-test.txt. It is concise, has no file lists or emojis, and states the primary intent.

Full details: Description check

Explanation

The description states the purpose (automated test coverage for the v4 ingestion pipeline, per #259). It lists each added test file with its covered areas, the added test dependencies, the pytest command and result (98 passed), and the limits of testing (fake Milvus client, no live server run). It relates directly to the changeset.

Full details: Out of Scope Changes check

Explanation

All changes support the #259 objectives. The three new test modules test the named v4 production modules. requirements-test.txt adds pymilvus, which the Milvus tests use, and toml, which is a test dependency. No unrelated production code changes appear in the summary or in the diffed files.

Full details: Linked Issues check

Explanation

Issue #259 asks for tests of the v4 ingest path. Coverage at head, by file:

  • tests/test_hugo_ingest.py (read at head): covers parse_frontmatter for YAML, TOML, no frontmatter, empty content, invalid frontmatter, and UTF-8 BOM. Covers process_html_table for no-table no-op, simple table conversion, rowspan/colspan expansion, and surrounding content. These items are met.
  • Not shown: the issue requires tests for the title, description, and weight keys read by parse_canonical_document. test_hugo_ingest.py does not test parse_canonical_document. The PR summary does not show that test_canonical_rag_ingest.py covers those keys either. The canonical test summary mentions frontmatter and section paths, which may partly overlap.
  • tests/test_canonical_rag_ingest.py: summary reports section paths, chunking, release dates, and document types. Met per summary.
  • tests/test_milvus_store.py: summary reports schema/index construction and clean-rebuild confirmation and lock gates. Met per summary. No live Milvus test, which the issue does not require.
  • requirements-test.txt (diff read): adds pymilvus==2.6.14 and toml==0.10.2. python-frontmatter, html-table-rescuer, and markdownify were already present on base. beautifulsoup4 is not listed, but markdownify depends on it, so it installs transitively.

Resolution

Confirm that a test exercises parse_canonical_document with title, description, and weight frontmatter keys. Cite the test file and test name. If no such test exists, add one to test_canonical_rag_ingest.py or test_hugo_ingest.py. Re-assess after that evidence is available.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1aba4c5 and 5f1862e.

Files selected for processing: 4

  • requirements-test.txt
  • tests/test_canonical_rag_ingest.py
  • tests/test_hugo_ingest.py
  • tests/test_milvus_store.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@divyanshkulshrestha23 divyanshkulshrestha23 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran the full suite locally (Windows, Python 3.12) and 5 tests in test_milvus_store.py fail: TestV4Schema (4) and TestV4IndexParams::test_builds_dense_and_sparse_indexes. They pass when the file runs alone, so it's test-order pollution, not Windows-specific (reproduced on Linux too):

pytest tests/test_milvus_store.py                            # 58 passed
pytest tests/test_flo_tracing.py tests/test_milvus_store.py  # 5 failed

Cause: tests/test_flo_tracing.py:11 does sys.modules.setdefault("pymilvus", MagicMock()). It's collected before test_milvus_store.py, so the real pymilvus added to requirements-test.txt here never gets imported and the schema/index builders return MagicMocks.

Fix that works locally (full suite: 0 failures) is to only mock when pymilvus is missing, the same pattern #319 uses:

try:
    import pymilvus  # noqa: F401
except ImportError:
    sys.modules["pymilvus"] = MagicMock()

Happy to open a separate small PR for test_flo_tracing.py if you'd rather keep this one focused.

Also, related cleanup: three of the four skipped tests in tests/test_docs_pipeline.py look covered here now (legacy schema - test_rejects_existing_collection_with_incompatible_schema, chunk replacement - test_updates_existing_collection_by_deleting_old_document_chunks, embedding dimension - test_rejects_invalid_embedding_dimension). test_docs_cleaner_preserves_markdown_link_adjacent_yaml (line 138) doesn't seem to have an equivalent for the canonical ingest path. Can follow up on that once this lands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v4 ingest path has no tests: test files named in #249's test plan were never committed

2 participants