Skip to content

search: recover empty versioned queries with one known prompt symbol - #139

Merged
ayhammouda merged 1 commit into
mainfrom
agent/63-unique-known-symbol-fallback
Oct 5, 2026
Merged

ayhammouda merged 1 commit into
mainfrom
agent/63-unique-known-symbol-fallback

Conversation

@ayhammouda

@ayhammouda ayhammouda commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Refs #63.

User problem and scope

Natural-language questions naming one indexed stdlib symbol can return no results despite canonical documentation being available offline. Original lookup/FTS behavior runs first; only empty explicit-version auto searches may use exactly one distinct known prompt symbol. Multiple known symbols stay ambiguous. Existing kinds, no-version/nonempty behavior and result budgets remain unchanged. No corpus-aware routing, schema, dependency, ingestion or tool-contract changes.

Acceptance evidence

  • Focused regressions cover punctuation, repeated/unknown/multiple identifiers, version membership, numeric versions, explicit kinds, absent version and original nonempty results.
  • Developer locked lint/type/doctor/corpus/regression checks passed; 571 tests passed.
  • Retained-index before/after: 8 to 34 retrieval hits at five across 65 frozen cases (+26/-0), all 69 direct citation resolutions and all 16 original nonempty result objects preserved. Corpus and baseline unchanged.
  • Mandatory broker prepublication independent review approved the exact published head 84277ae against main b3e4c9f; pdctl publish exited 0 on 2026-10-05.
  • Exact-head pdctl verify succeeded: independent verdict. Fresh pinned CPython 3.11.15/3.12.13/3.13.13 complete-index evaluation independently reproduced 8 → 34 hits (+26), all 69 citations, unchanged previously nonempty results, passing latency/budget gates.
  • All eleven hosted checks passed on the exact published head (2026-10-05 00:39 UTC), including six Python/OS jobs, installed-package smoke, product regression, dependency audit, Analyze and CodeQL.
  • Review triaged: one integration skipped, completed actual CodeRabbit review found no actionable blockers; zero threads. Docstring suggestion is advisory. Owner merge decision.

The 8-to-34 measurements above are developer evidence on the retained historical patch-release index, with incomplete historical build provenance; they are not generated-answer accuracy, competitive or general latency claims. See #63 for the recorded decision and limitations.

Why this approach / owner review

Measured misses were predominantly candidate-generation failures. A narrow empty-result fallback preserves successful existing search behavior and explicitly notes which prompt symbol supplied the results. Vision owner static review found no blocking issues. No forbidden-territory expansion or existing-test weakening. CodeRabbit completed with no actionable findings; it does not replace independent verification.

Outcome review

Review on 2026-10-17. Rework/remove if independent source-pinned reproduction fails, hits/citations or version isolation regress, or user feedback shows misleading fallback results. Merged through SHA-matched pdctl merge on 2026-10-05 as 10740c7d259ae8e7aa4fd8d9346f5cf3aa7acb5b; all five main workflows passed (CI, Product quality, Security Audit, CodeQL, Scorecard). Not released.

Summary by CodeRabbit

  • New Features
    • When an automatic search finds no results for a specified version, a unique, recognized dotted identifier in the query can now return matching symbols from that version.
    • Searches with ambiguous or unrecognized identifiers, or without a specified version, continue to return no results. Existing results are unchanged.

@coderabbiteu

coderabbiteu Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration
  • Configuration used: Repository: ayhammouda/python-docs-mcp-server/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3c0c3d0f-c440-4243-b21f-add5cb68022a
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ayhammouda/python-docs-mcp-server/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2e94672-0d28-47c6-911a-94471372a23b
📥 Commits

Reviewing files that changed from the base of the PR and between b3e4c9f and 84277ae.

⛔ Files ignored due to path filters (1)
  • README.md is excluded by none and included by none
📒 Files selected for processing (2)
  • src/mcp_server_python_docs/services/search.py
  • tests/test_search_symbol_fallback.py

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


📝 Walkthrough

Walkthrough

When an auto search returns no results and a version is resolved, SearchService.search checks for one known dotted identifier in that version’s symbol inventory. If found, it performs an exact lookup and returns matching results with a fallback note.

Changes

Symbol search fallback

Layer / File(s) Summary
Implement and validate symbol fallback
src/mcp_server_python_docs/services/search.py, tests/test_search_symbol_fallback.py
An empty auto search with a resolved version can fall back to an exact lookup when the query contains exactly one known dotted identifier for that version. Tests cover successful fallback, excluded cases, lookup order, and preservation of nonempty results.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 84277

The fallback has no identified merge-blocking issue; it is ready for normal merge checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 84277

The recovery path is narrowly gated and preserves requested-version filtering and result limits. No introduced security issue was identified. Assurance remains limited by incomplete security coverage and pending independent validation.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — A caller can cause additional reads and receive previously unrecovered matches from the existing indexed documentation for its resolved version. The changed path supplies no write operation, executable action, new credential, or external destination.

Trust Boundaries and Controls

  • observed — Attacker-controlled query text is interpreted as candidate names, not SQL syntax. Inventory checks bind both name and resolved version, and the subsequent lookup independently applies version filtering and the result limit. The unchanged public handler forwards those inputs without adding authority.

Resilience and Maintainability Implications

  • observed — Successful search paths assign resolution telemetry before returning; exceptions are logged without resolution telemetry and re-raised. The shared telemetry field and its consumer predate this PR and do not determine returned hits or access authority. Isolation under overlapping calls remains unproven, but no PR-specific security failure was established.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: recovering empty versioned searches with one known prompt symbol.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@ayhammouda

Copy link
Copy Markdown
Owner Author

Vision — automated project maintainer

Independent verification (temporary credential): success

Head: 84277aea0168d4fdf721b20cfb8cde807b1c9256; main: b3e4c9ff143aa3c1b729552a6e7fce5118f62fbc.

{
  "head_sha": "84277aea0168d4fdf721b20cfb8cde807b1c9256",
  "base_sha": "b3e4c9ff143aa3c1b729552a6e7fce5118f62fbc",
  "approved": true,
  "summary": "Independent review found a product-relevant, version-scoped fallback with no dependency, schema, workflow, corpus, baseline, or tool-contract changes. On a freshly built 1,603-document index from pinned CPython 3.11.15, 3.12.13, and 3.13.13 sources, the frozen 65-case evaluation improved from 8 to 34 hits (+26), retained all 69 citations, changed no previously nonempty results, and passed the latency and budget gates. The owner's evidence named a different head and was not used as acceptance evidence. Hosted CI for this exact head has no checks yet and remains pending for publication and merge.",
  "commands": [
    {
      "command": "git clone --no-checkout --depth=1 https://github.com/ayhammouda/python-docs-mcp-server.git repo",
      "exit_code": 0
    },
    {
      "command": "git fetch --depth=1 origin 84277aea0168d4fdf721b20cfb8cde807b1c9256 b3e4c9ff143aa3c1b729552a6e7fce5118f62fbc",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv sync --locked --dev",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked ruff check src/ tests/ benchmarks/ ops/ .github/scripts/",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked pyright src/ benchmarks/",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked pytest --tb=short -q",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked python -m benchmarks validate-corpus --corpus docs/benchmarks/corpus.yml --schema docs/benchmarks/corpus.schema.json",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked python-docs-mcp-server build-index --versions 3.11,3.12,3.13",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked python-docs-mcp-server doctor",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv run --locked python -m benchmarks.regression --output /tmp/pd-regression.json",
      "exit_code": 0
    },
    {
      "command": "PYTHONPATH=. /usr/local/bin/uv run --locked python /tmp/pd-verify-corpus.py",
      "exit_code": 0
    },
    {
      "command": "/usr/local/bin/uv build",
      "exit_code": 0
    },
    {
      "command": "git diff --check b3e4c9ff143aa3c1b729552a6e7fce5118f62fbc 84277aea0168d4fdf721b20cfb8cde807b1c9256",
      "exit_code": 0
    },
    {
      "command": "git rev-parse HEAD",
      "exit_code": 0
    }
  ],
  "blockers": []
}

@ayhammouda

Copy link
Copy Markdown
Owner Author

Vision — automated project maintainer

Merge decision for exact head 84277aea0168d4fdf721b20cfb8cde807b1c9256 against main b3e4c9ff143aa3c1b729552a6e7fce5118f62fbc:

  • pdctl verify succeeded and recorded independent acceptance: search: recover empty versioned queries with one known prompt symbol #139 (comment). Merge authority remains the root-owned SHA/base-matched receipt, not this comment.
  • Independent fresh pinned CPython 3.11.15/3.12.13/3.13.13 index reproduction: 1,603 documents, frozen 65 cases 8 → 34 retrieval hits (+26), all 69 citations retained, no previously nonempty results changed, latency/budget gates passed. These are retrieval-task results, not generated-answer accuracy or competitor results. The verifier correctly distinguished the developer commit from the broker-published head.
  • All 11 current exact-head GitHub checks now pass. This supersedes the prepublication verdict's then-pending hosted-CI observation. Fresh lint/type/tests/corpus/build/index checks are listed with exit codes in the independent evidence.
  • Owner static review confirms unchanged public contracts and original search paths, prompt-only identifier extraction, version-scoped bound SQL, ambiguity rejection, and explicit fallback note. No dependency, schema, workflow, corpus or baseline changes.
  • CodeRabbit's completed review found no actionable blockers; there are no review threads. Its docstring-coverage suggestion is advisory, not a required CI failure. Shared telemetry concurrency is pre-existing and not used for result selection; MCP v2 concurrency remains a separately scoped migration in build(deps): bump mcp from 1.28.1 to 2.1.1 #123.

Proceeding only through pdctl merge with the exact head. Outcome review: 2026-10-17, including user feedback and the frozen tasks; revisit/narrow on any retrieval/citation loss, wrong-version result, changed nonempty result, or misleading fallback selection. This is not a release announcement. #138 remains independently blocked and unmerged.

@ayhammouda
ayhammouda merged commit 10740c7 into main Oct 5, 2026
12 checks passed
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.

1 participant