Skip to content

bug(tests): showcase gates do not consume the current MCP citation contract #321

Todo

Description

@GunaPalanivel

Area

tests

What happened

On main 1aba4c5, both showcase gates reject a valid structured citation from the current MCP result.

run_mcp_search prints a FastMCP ToolResult, but score_retrieval expects a JSON markdown_summary containing **Source:** lines. Current citations.py removes URLs from model-facing text and keeps them in structured_content.citations.

Gate 2 reads the structured citations, but source_urls_in_event still requires Source lines, so it also calls the valid citation unbacked. Serializing the result to JSON alone does not resolve the mismatch.

Expected behavior

The existing evaluator should accept expected source URLs from the current tool's structured citation metadata. Missing sources and citations without tool-result provenance must still fail; URLs in answer prose must not count as source proof. Gate 2 should remain blocked until Gate 1 passes.

Reproduction

Local, from the repository root at 1aba4c5, with the repository's FastMCP 3.4.2 pin. Save this as repro_showcase.py and run uv run --no-project --with fastmcp==3.4.2 python repro_showcase.py. It imports the actual formatter and evaluator; no cluster, model or database is required.

"""Portable formatter-to-showcase-gates reproduction; run from repository root."""
import json
import sys

sys.path[:0] = ["docs-agent-mcp/mcp-server", "tests/eval"]
from citations import format_docs_hits, search_tool_result
import run_showcase_eval as ev

url = "https://www.kubeflow.org/docs/components/katib/"
body, citations = format_docs_hits([
    {"distance": 0.9, "entity": {"content_text": "Katib evidence", "citation_url": url}}
])
result = search_tool_result(body, citations)
row = {"expected_source_urls": [url], "must_appear_in_answer": ["Katib"]}
wire = {"content": [x.model_dump(mode="json") for x in result.content],
        "structuredContent": result.structured_content}
print("Gate 1, printed result:", ev.score_retrieval(row, str(result)).passed)
print("Gate 1, wire JSON:", ev.score_retrieval(row, json.dumps(wire)).passed)
print("Gate 2, structured URLs:", sorted(ev.structured_citation_urls(wire)))
print("Gate 2, source URLs:", sorted(ev.source_urls_in_event(wire)))
print("Gate 2, unbacked:", sorted(ev.structured_citation_urls(wire) - ev.source_urls_in_event(wire)))
print("Legacy control:", ev.score_retrieval(row, f"**Source:** {url}\nKatib").passed)

Actual output:

Gate 1, printed result: False
Gate 1, wire JSON: False
Gate 2, structured URLs: ['https://www.kubeflow.org/docs/components/katib/']
Gate 2, source URLs: []
Gate 2, unbacked: ['https://www.kubeflow.org/docs/components/katib/']
Legacy control: True

The current showcase/citation fixture suites still pass (16 tests); they cover the earlier Source-line contract. A separate local subprocess probe through the actual server function produced the same Gate 1 failure with its retrieval backend supplied locally. These are interface reproductions, not live Milvus or deployed-agent validation.

Suspected files

  • tests/eval/run_showcase_eval.py: run_mcp_search, score_retrieval, source_urls_in_event and the Gate 2 provenance check.
  • tests/test_showcase_eval.py: add current-producer regression cases alongside the existing negative controls.

I am happy to take this on as a focused correction to the evaluator from #240. I would explicitly serialize the tool result, score its structured source metadata across both gates, and cover valid, missing-source and error cases without changing the production citation contract. No retrieval change or re-ingest is proposed; deployed showcase validation would still need operator access.

Activity

  1. fizae47-arch commented on Dec 2, 2026

    @fizae47-arch

    /assign

  2. fizae47-arch commented on Dec 2, 2026

    @fizae47-arch

    I'm working on issue #321 and will open a PR with the fix soon.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions