tests: 100% coverage for helpers, fix extract_xml_tag bug#4
Merged
will-fawcett-trillium merged 3 commits intomainfrom Apr 28, 2026
Merged
tests: 100% coverage for helpers, fix extract_xml_tag bug#4will-fawcett-trillium merged 3 commits intomainfrom
will-fawcett-trillium merged 3 commits intomainfrom
Conversation
extract_xml_tag previously used a single check `p2 <= p1` to detect a missing tag, but `find()` returns -1 on miss. With input containing only the closing tag (p1 = -1, p2 = some positive index), the check passed and the function returned a slice of garbage characters instead of raising NoTagFoundError. Check both positions explicitly: raise if the opening tag is missing, or if the closing tag is at or before the opener.
Cover all previously-untested code paths in src/eve_mcp/server/helpers.py: - extract_xml_tag / extract_tag: happy paths, missing-tag cases - get_eve_client: missing-credentials RuntimeError, lazy construction, cached singleton on subsequent calls - ensure_logged_in: refreshes auth token on the cached client - _query_eve: token/source/final event assembly, FINAL-only fallback, ERROR event short-circuit, conversation cleanup robustness when delete fails - _extract_factuality_issues: parses ```json fence from the LLM answer - _assess_factuality_issue: strips <CODE_RECOMMENDATIONS> from the answer body and unwraps an optional inner ```json fence Brings overall coverage to 100%.
With the new helpers tests landed, the suite achieves 100% line coverage. Lock that in: any future change that introduces an untested branch will now fail pre-commit.
3 tasks
r-spiewak
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/eve_mcp/server/helpers.pycovering every previously-untested function: tag extractors,get_eve_clientlazy init + caching,ensure_logged_in, the full_query_evestreaming path (token assembly, FINAL fallback, ERROR short-circuit, conversation cleanup),_extract_factuality_issues, and_assess_factuality_issue.extract_xml_tagreturned a slice of garbage instead of raisingNoTagFoundErrorwhen only a closing tag was present in the input. The single checkp2 <= p1failed becausefind()returns -1 on miss.--fail-underfrom 50 to 100 to lock in the new coverage floor.Stacks on top of #3 (
cleanup/dead-code). Will retarget tomainonce #2 and #3 merge.This addresses items 8 (unit tests) and 9 (100% coverage) from the v0.0.1 release checklist.
Test plan
poetry run pre-commit run --all-files— all hooks pass at 100% coveragequery_eveagainst the live EVE API with real credentials