Skip to content

fix: knowledge truncation, CI concurrency test coverage, changelog housekeeping - #411

Merged
neuromechanist merged 5 commits into
developfrom
fix/knowledge-truncation-ci-tests
Sep 19, 2026
Merged

neuromechanist merged 5 commits into
developfrom
fix/knowledge-truncation-ci-tests

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Summary

Addresses a subset of the PR #403 review findings (the release PR merging develop into main), split from two other fix PRs covering security/config and citation-placement findings.

  • Important Update broken HED documentation source URLs #6: create_get_full_docstring_tool's citable text path was uncapped (text=lambda r: r.snippet), unlike the sibling FAQ tool. At the default limit=5 this could put ~50K chars on the wire per call (docstrings are capped at 10K chars each at ingest). Adds _MAX_CITABLE_DOCSTRING_CHARS = 4000 and a truncate() wrap, plus a regression test mirroring the existing FAQ cap test. Also corrects a test-file docstring that had wrongly assumed this tool's snippets were already truncated upstream by search.py (only search_docstrings' are).
  • Suggestion refactor: remove legacy /chat, add endpoints to root response #12: the docker-build.yml concurrency block (the actual fix for the real v0.8.9 :latest-tag race) had no test coverage, unlike the semver enable= logic next to it. Adds two tests to test_latest_tag_policy.py that parse the real YAML and assert the concurrency group/cancel-in-progress behavior.
  • Nice-to-have feat: add page context awareness to chat assistant #19: CHANGELOG.md still said [Unreleased] despite being the version this release PR ships (0.8.10, per src/version.py). Retitles per the changelog's own stated convention, adds a fresh [Unreleased] above it, and adds PR fix: improve citation quality and streaming presentation #399 to the citation-fix bullet (PR fix: move citations to sentence boundaries #400 is an explicit follow-up to it) plus a new bullet for fix: improve citation quality and streaming presentation #399's knowledge-search relevance tightening, which had no changelog entry anywhere.
  • Nice-to-have feat: restructure CLI and rename package to open-science-assistant #23: TestFetchPageContentImpl in tests/test_agents/test_page_context.py mocked httpx.Client directly via unittest.mock, inconsistent with this project's no-mocks-of-business-logic policy and with the respx-based TestFetchPageReportsFailureStructurally class right below it testing the same underlying function. Converted all 10 tests to respx. Along the way, found and fixed a real respx gotcha: a bare host URL with no path (respx.get("https://example.com")) matches any path on that host, silently shadowing a more specific route registered after it — this broke the two-hop redirect tests until anchored with an explicit trailing slash.

Test plan

  • uv run ruff check . clean
  • uv run pytest tests/test_tools/test_citation_gating.py tests/test_latest_tag_policy.py tests/test_agents/test_page_context.py -v all pass
  • uv run pytest tests/test_agents/ tests/test_tools/ tests/test_knowledge/ tests/test_latest_tag_policy.py -q — 740 passed

Uncapped, a single call at the default limit=5 could put ~50K chars of
citable text on the wire (25x the FAQ cap). Adds
_MAX_CITABLE_DOCSTRING_CHARS and corrects the citable-payloads test
docstring, which had wrongly assumed this tool's snippets were already
truncated by search.py.
PR #400's own body says it is a follow-up to #399, and #399 also
tightens conceptual code-document search relevance, which had no
changelog entry anywhere.
…espx

Matches the respx-boundary pattern already used by
TestFetchPageReportsFailureStructurally in the same file and this
project's no-mocks-of-business-logic policy. Found and fixed a respx
route-shadowing gotcha along the way: a bare host URL with no path
matches any path on that host, so a more specific route registered
after it is silently shadowed.
@neuromechanist
neuromechanist requested review from yarikoptic and removed request for yarikoptic September 19, 2026 19:19
Name DOCSTRING_SNIPPET_MAX_LENGTH explicitly instead of the ambiguous
'above' (the adjacent constant is the unrelated FAQ cap). Anchor the
remaining bare-host respx routes in TestFetchPageContentImpl with a
trailing slash for defense against the route-shadowing gotcha this
same PR found, even though each currently registers only one route.
@neuromechanist
neuromechanist merged commit 66ad5f8 into develop Sep 19, 2026
8 checks passed
@neuromechanist
neuromechanist deleted the fix/knowledge-truncation-ci-tests branch September 19, 2026 19:43
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