Skip to content

test: cover file metadata preservation - #102

Open
HarperZ9 wants to merge 2 commits into
Codelab-Davis:mainfrom
HarperZ9:codex/anchor-issue77-metadata-tests
Open

HarperZ9 wants to merge 2 commits into
Codelab-Davis:mainfrom
HarperZ9:codex/anchor-issue77-metadata-tests

Conversation

@HarperZ9

@HarperZ9 HarperZ9 commented Sep 4, 2026 •

Copy link
Copy Markdown

Pull Request

Summary

Adds deterministic integration tests that exercise Anchor.ingest_file with the existing text and Markdown fixtures and document extractor metadata that is currently dropped before storage. The strict xfails are limited to known missing metadata fields so unrelated crashes, wrong values, and partially missing offsets still fail normally.

Linked context

Closes #77
Supersedes #101
Related to #68

This PR consolidates my earlier overlapping PR #101. It is distinct from #68, which merged the Markdown extractor implementation and dependency changes; this PR changes only tests/integration/test_ingestion_pipeline.py and adds no extractor, API, dependency, fixture, prompt, or production-code changes.

PR Size

  • Small (< 100 LOC delta)
  • Medium (100-499 LOC delta)
  • Large (500-999 LOC delta)
  • XL (1000+ LOC delta — must have been pre-discussed in an issue)

PR Type

  • Bug fix
  • New feature
  • Prompt change (prompt label required; eval results required below)
  • Test
  • Docs
  • Refactor / chore

Context / Motivation

Extractor unit tests alone do not cover the public file-ingestion path into storage. The previous integration coverage called Ingestor directly, so it could not detect metadata dropped between extractor output and MemoryStore.add. Issue #77 asks for pipeline-level proof using offline text and Markdown fixtures, with xfails where existing fields are currently lost.

Changes

  • Run the existing .txt and .md fixtures through the real Anchor.ingest_file path using an offline deterministic model and FakeMemoryStore.
  • Verify source path, generated questions, timezone-aware timestamp, stored content, chunk count, and retrieval for both fixtures.
  • Verify the extractor contract before ingestion: text source_format, character offsets, line offsets, and Markdown heading metadata.
  • Add strict xfails for the known missing stored metadata fields: text source_format, text offsets, Markdown source_format, and Markdown heading.
  • Limit the expected failures to MissingDocumentMetadata so wrong present values, partially missing offsets, and unrelated crashes remain ordinary failures.

No production code, public API, fixture, dependency, prompt, or model changes are included.

How to test

Current re-verification at PR head 8e4859f151a0572fbcd4d4d72b5c97259f0f8421, using the existing Anchor virtual-environment Python on Windows:

  1. python -m pytest tests/integration/test_ingestion_pipeline.py -q -rxX

Result:

...xxxx...                                                               [100%]
6 passed, 4 xfailed in 0.22s

I did not re-run the repository-wide pytest suite, Ruff, Mypy, pre-commit, or dependency audit for this body update, so this body does not claim current repo-wide green checks.

Prompt Change Eval Results

Not applicable: this PR changes no prompts and introduces no model calls.

Checklist

  • I ran the relevant local checks.
  • I updated documentation or confirmed no docs changes were needed.
  • I linked related issues or pull requests and confirmed this is not duplicate work.
  • This change stays within the stated scope of the PR.

Notes for reviewers

These tests document current metadata loss; they do not repair ingestion. Strict xfails become suite-failing XPASS results when the corresponding fields begin reaching storage with the expected values. Incorrect present values, partially missing offsets, and unrelated failures remain ordinary failures.

AI assistance disclosure: Codex assisted with drafting, refining, and verifying this test-only change. The final body was prepared from live PR/template/workflow reads and a fresh narrow test run before submission.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: c526c206-cde7-4933-b7f5-34417dabedde


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.

@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Potentially related open or recent pull requests:

If one of these replaces this PR, a maintainer can close this with /superseded-by #123.

@github-actions github-actions Bot added needs: compliance The author or reporter needs to fix template or policy gaps. area: tests Automated tests and test infrastructure. needs: linked-context A pull request needs a linked issue or related pull request. needs: duplicate-review Automation found similar existing work that needs maintainer review. and removed needs: compliance The author or reporter needs to fix template or policy gaps. needs: linked-context A pull request needs a linked issue or related pull request. labels Sep 4, 2026
@HarperZ9 HarperZ9 mentioned this pull request Sep 7, 2026
14 tasks
@github-actions github-actions Bot added needs: compliance The author or reporter needs to fix template or policy gaps. and removed needs: compliance The author or reporter needs to fix template or policy gaps. labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tests Automated tests and test infrastructure. needs: duplicate-review Automation found similar existing work that needs maintainer review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[task] Preserve document metadata in ingestion pipeline tests

1 participant