Skip to content

[AGV.2+P0.5] VultronRetriever client + corpus ingestion + tests - #69

Merged
vgtray merged 1 commit into
mainfrom
feat/vgtray-retriever
Jul 4, 2026
Merged

[AGV.2+P0.5] VultronRetriever client + corpus ingestion + tests#69
vgtray merged 1 commit into
mainfrom
feat/vgtray-retriever

Conversation

@vgtray

@vgtray vgtray commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #25, closes #5

Module (agents/common/retriever.py)

  • Async client on /v1/vector_store (endpoints discovered live, quirks documented in module docstring: collection id derived/truncated from name, /search returns no score and ignores top_k → applied client-side, doc_id/section joined via lazy items cache)
  • Idempotent ingest: (doc_id, section) + SHA-256 content hash packed in item description — unchanged→skip, modified→delete+insert
  • ingest_manifest(path): JSON [{doc_id,title,section,path_or_text}], file-or-literal, zero /data dependency (fixtures: 2 realistic telecom docs)
  • Returns frozen-contract shapes: RetrievedRef / Citation imported from contracts (never redefined)

Real smoke (#5, executed then cleaned up)

Collection created, 2 docs ingested (2nd run: skipped=2), query 'rectifier undervoltage' → top hit doc_id='eltek-flatpack2-om-manual' section='3.2 DC Undervoltage Alarm', ~200ms warm / 0.9-1.5s cold. Smoke collections deleted.

Tests

41 green (14 retriever via stateful httpx.MockTransport fake — zero real sockets — + 27 contract non-regression). -W error clean. httpx 0.28.1 pinned (requirements.txt included here, shared with the upcoming vultr client PR).

Known minor (non-blocking, tracked): delete_collection() creates-then-deletes when absent (cleanup best-effort path).

@vgtray
vgtray requested a review from aminssutt as a code owner July 4, 2026 13:02
Copilot AI review requested due to automatic review settings July 4, 2026 13:02
@vgtray
vgtray merged commit 2676b28 into main Jul 4, 2026
1 check passed
@vgtray
vgtray deleted the feat/vgtray-retriever branch July 4, 2026 13:03

Copilot AI 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.

Pull request overview

This PR introduces the new shared retrieval layer for Arc by adding an async VultronRetriever client for Vultr’s Vector Store API, along with idempotent corpus ingestion via a JSON manifest and a fully mocked (no-network) test suite to validate the contract-level outputs required by issues #5 and #25.

Changes:

  • Added VultronRetriever async client with collection management, idempotent ingest keyed by (doc_id, section), client-side top_k, and RetrievedRef/Citation contract outputs.
  • Added ingest_manifest() plus realistic telecom fixtures to support corpus ingestion without /data dependencies.
  • Added stateful httpx.MockTransport-backed tests covering collection ID handling, ingest idempotency, query behavior, and manifest file-vs-literal resolution.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
agents/common/retriever.py New async retriever client implementing Vultr Vector Store collection management, ingestion, querying, and citation projection.
agents/common/tests/test_retriever.py Comprehensive unit tests using a stateful in-process FakeVultr API via httpx.MockTransport.
agents/common/tests/init.py Declares the agents/common test package and documents the “no real network calls” approach.
agents/common/requirements.txt Pins runtime dependency (httpx) for the retriever client.
agents/common/requirements-dev.txt Pins dev/test dependencies (pytest, pytest-asyncio) for the new test suite.
agents/common/fixtures/manifest.json Sample corpus manifest for ingestion tests/smoke usage.
agents/common/fixtures/rectifier_flatpack2.txt Fixture document chunk for corpus ingestion.
agents/common/fixtures/safety_dc_power_-48v.txt Fixture document chunk for corpus ingestion.
agents/common/init.py Initializes agents.common as a package (empty).
agents/init.py Initializes agents as a package (empty).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +202 to +209
async def delete_collection(self) -> None:
"""Delete the collection (best-effort; used for smoke cleanup)."""
cid = await self.ensure_collection()
resp = await self._client.delete(f"{_VECTOR_STORE}/{cid}")
if resp.status_code not in (204, 404):
resp.raise_for_status()
self._collection_id = None
self._meta_cache.clear()
Comment on lines +92 to +93
def _content_hash(text: str) -> str:
return hashlib.sha256(text.encode("utf-8")).hexdigest()[:16]
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.

[AGV.2] Retriever module + corpus ingestion [P0.5] VultronRetriever smoke test

2 participants