feat: Implement github_repo_contents in read_tools.py + test#3
Merged
Conversation
|
👀 Quinn is reviewing — verdict (PASS / WARN / FAIL) + findings to follow. |
There was a problem hiding this comment.
QA Audit — PR #3 | feat: Implement github_repo_contents in read_tools.py + test
VERDICT: WARN (pending terminal CI — test still queued; re-evaluating to PASS on green)
CI Status
- test: queued ⏳
Diff Review
read_tools.py: stub replaced with workinggithub_repo_contents—bad_repo()gate, args build (no trailing slash at root),refplumbing via-f,check_gh_error()surfacing, JSON parse guard, empty-array message, and compact{type:4s} {size:>8s} {name} ({path})listing. Clean.tests/test_read_tools.py: 7 new tests covering success (FILE+DIR), root path, ref arg, empty dir, bad repo, gh error, bad JSON. All mockrun_gh— no network. Good coverage.
Observations
- LOW:
json.loads(out)can return a dict (single file) rather than a list (directory). Iterating a dict crashes onentry.get(). The tool is documented as a directory lister andgithub_read_filecovers the file case, so this is a misuse path, but anisinstance(items, list)guard would produce a readable error instead of a traceback if an agent misroutes.
— Quinn, QA Engineer
|
Submitted COMMENT review on #3. |
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.
I'll start by reading the key files to understand the codebase conventions.I'll start by reading the key files to understand the codebase conventions.Let me check the
gh_cli.pyhelpers to confirm signatures.Let me check the ruff config to match line-length and formatting conventions.Now I'll implementgithub_repo_contents. Let me replace the stub body and clean its docstring.Now let me append the tests.Now append the test cases at the end of the file.Let me verify the package import setup and run the gate to confirm correctness.The async failures are environmental —pytest-asyncioisn't installed locally (the pre-existing tests fail identically). Let me install dev deps and re-run for a true verification.All 13 read_tools tests pass. Let me run the full gate.Full gate is green: 24 passed,ruff checkclean,ruff format --checkclean.Summary
Implemented
github_repo_contentsinread_tools.pyand added tests.read_tools.py— replaced the stub body (kept the docstring as a plain string, dropped the TODO note):repoviabad_repo()(early-return error string).["api", f"repos/{repo}/contents/{path}"], usingrepos/{repo}/contents(no trailing slash) whenpathis empty."-f",f"ref={ref}"whenref.strip()is non-empty.run_gh, surfacescheck_gh_error()failures.JSONDecodeErrorreturnsError: could not parse gh output: ….No contents in {repo}/{path or '.'}.{type:4s} {size:>8s} {name} ({path})with afile→FILE,dir→DIR,symlink→LINK,submodule→SUBmap (dirs show size0), under a{repo}/{path or '.'} — {n} item(s):header.tests/test_read_tools.py— appended a_repo_contents_tool()helper and 7 tests covering the 5 required cases (success with FILE/DIR + sizes, empty dir, invalid repo withrun_ghnot called, gh error, bad JSON) plus root-endpoint-has-no-trailing-slash and ref-passed-to-args.Only the two target files were touched; no other function in
read_tools.pywas modified.