Skip to content

docs: fix docstring parameter names in three components - #12204

Draft
iridescentWen wants to merge 1 commit into
deepset-ai:mainfrom
iridescentWen:docs/fix-docstring-param-mismatches
Draft

docs: fix docstring parameter names in three components#12204
iridescentWen wants to merge 1 commit into
deepset-ai:mainfrom
iridescentWen:docs/fix-docstring-param-mismatches

Conversation

@iridescentWen

Copy link
Copy Markdown

Related Issues

None — no prior issue. This is a docstring-only correction found while reading the code; happy to open one if you'd prefer that order.

Proposed Changes:

Three docstrings disagreed with their own signatures. I found these by walking every function in haystack/ with ast and diffing the :param names against the actual parameters.

1. LinkContentFetcher.__init__request_headers was undocumented (haystack/components/fetchers/link_content.py)

The signature takes request_headers: dict[str, str] | None = None and it is a real, functional parameter — _get_headers() merges self.request_headers into the outgoing headers. Every other init parameter is documented, so this one being absent reads as an omission rather than a deliberate choice. Added an entry describing it, including its precedence, which I took from the existing comment in _get_headers:

# client defaults -> component defaults -> user-provided -> rotating UA
base = dict(self._client.headers) if self._client is not None else {}
return _merge_headers(
    base, REQUEST_HEADERS, self.request_headers, {"User-Agent": self.user_agents[...]}
)

2. Sum.run — wrong parameter name (haystack/testing/sample_components/sum.py)

Documents :param value:; the parameter is values: Variadic[int]. One-character fix.

3. Threshold.run — missing parameter (haystack/testing/sample_components/threshold.py)

Takes value and threshold, documented only threshold. Added value.

3 files, +4/-1. Docstrings only — no executable line changed.

How did you test it?

No new tests: nothing executable changed, so there is no behavior to assert on. I ran the existing suites instead.

$ hatch run test:unit
5794 passed, 8 skipped, 322 deselected, 6 warnings in 33.98s

$ hatch run test:types
Success: no issues found in 382 source files

$ hatch run fmt
All checks passed!
273 files left unchanged

I also re-ran the ast walk after the change: the three functions now have no documented-but-nonexistent params and no undocumented ones.

Notes for the reviewer

On the release note: I did not add one. Per CONTRIBUTING, "Pull requests with changes limited to tests, code comments or docstrings ... can be labeled with ignore-for-release-notes by a maintainer in order to bypass the CI check." This PR is entirely docstrings, so I believe it qualifies — but only a maintainer can apply that label, so the release-note CI check will fail until someone does. Say the word if you'd rather I add a reno note instead and I'll push one.

Four near-misses I deliberately left alone. My scan also flagged these, and I checked each against the source and concluded they are correct as written — noting them so you know they were considered, not missed:

  • ContextRelevanceEvaluator.run / run_async and FaithfulnessEvaluator.run / run_async document questions/contexts/predicted_answers while the signature is **inputs. Those names come from self.inputs in __init__, so documenting the real keyword names is more useful to a caller than documenting **inputs.
  • LLM.run / run_async document messages, which lives in **kwargs. The code says why (# messages is intentionally omitted from the signature so the framework can treat it as required or optional depending on init configuration), and the docstring already says "Passed via **kwargs."

Three typos I did not touch. codespell finds troughthrough, DocmentationDocumentation, and alogrithmalgorithm in releasenotes/notes/*.yaml. Those are notes for already-shipped releases, so I left them as historical record rather than rewriting them here. Let me know if you'd like a separate PR.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes. — N/A, no related issue.
  • I have added unit tests and updated the docstrings. — docstrings updated; no tests, see above.
  • I've used one of the conventional commit types for my PR title (docs:).
  • I have documented my code.
  • I have added a release note file — requesting ignore-for-release-notes instead, see Notes for the reviewer.
  • I have run pre-commit hooks and fixed any issue. — hatch run fmt clean, no files changed.

I used an AI assistant (Claude Code) to help write and verify this change. I have reviewed every line and run the tests above myself.

Three docstrings did not match their signatures:

- `LinkContentFetcher.__init__` accepts `request_headers` (used in
  `_get_headers()`) but never documented it, while documenting every
  other init parameter.
- `Sum.run` documents `:param value:`; the parameter is `values`.
- `Threshold.run` takes `value` and `threshold` but only documented
  `threshold`.

Docstrings only, no behavior change.
@iridescentWen
iridescentWen requested a review from a team as a code owner July 31, 2026 04:30
@iridescentWen
iridescentWen requested review from sjrl and removed request for a team July 31, 2026 04:30
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

@iridescentWen is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@HaystackBot

Copy link
Copy Markdown
Contributor

Hi @iridescentWen, thanks a lot for your contribution! 🙏

We noticed that the Contributor License Agreement (CLA) check (license/cla) hasn't passed yet, so we've temporarily moved this PR to draft and paused the review assignment.

To get your PR reviewed, please sign the CLA via the link in the license/cla check below (or in the CLA bot comment). As soon as the check turns green, this PR will automatically be marked ready for review again and a reviewer will be re-assigned.

@HaystackBot
HaystackBot removed the request for review from sjrl July 31, 2026 06:22
@HaystackBot HaystackBot added the cla-pending PR is in draft until the contributor signs the CLA label Jul 31, 2026
@HaystackBot
HaystackBot marked this pull request as draft July 31, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-pending PR is in draft until the contributor signs the CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants