py/envoy.docs.sphinx_runner: Code review notes#4423
Closed
Copilot wants to merge 3 commits into
Closed
Conversation
✅ Deploy Preview for nifty-bassi-e26446 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Agent-Logs-Url: https://github.com/envoyproxy/toolshed/sessions/b8a1ed0d-f4be-4b51-a923-631fe1cf7d43 Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add code quality report for sphinx_runner
py/envoy.docs.sphinx_runner: Code review notes
May 10, 2026
This was referenced May 11, 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.
Adds
REVIEW.md— a structured second-pass code-quality report forpy/envoy.docs.sphinx_runner. No source changes.Coverage (12 categories, 28 findings)
SphinxRunner(arg parsing, version math, sphinx invocation, HTML archiving all in one class); dead_build_dir = "."class var;validate_argsraisesSphinxBuildErrorfor a pre-flight arg check;intersphinx_mappingtyped optional but always populatedhtml_dirhard-coded togenerated/htmlregardless of--build_target; sphinx exit code boolean-coerced (actual code discarded); dead Sphinx <3.5 compat guards in vendoredsphinx_tabs; module-levelLEXER_MAPbuilt at import timerun()isasyncwith zeroawaits; entire Sphinx build (potentially 30 min) blocks the event loop;check_env()does blockingread_text()on the loopFileNotFoundErrorescapescheck_env()unhandled;save_html()destroys existing output before new build is verified;rst_tartruthiness relies onpathlib.Path("")being falsyrst_dirandconfig_file@cached_propertydo side-effecting I/O (tar extraction, YAML write) at access time;colorscached for a trivially cheap dict constructionprint(e)inrun()bypassesself.log;_validate()loses exception context (raise … from emissing);debug()prints timing infinallyeven on failurepy_compatiblechecks>= 3.8butsetup.cfgrequires>=3.12(guard is effectively dead); wrong filename incheck_env()error message;envoyproxy.ioURL hard-coded inlinebuild_summary()entirelyprint()-based; Sphinx warnings swallowed after-W --keep-goingwith no structured recordversions_pathmissing return annotation;colors → dictunparameterised; blanket# type:ignorewithout justification oncolorama,sphinx.cmd.build,sphinxcontrib.httpdomain;sphinx_tabs/tabs.pyentirely unannotatedcmd.pyandsphinx_tabsuntested;FileNotFoundErrorcase incheck_env()missing;test_sphinx_runner_runisasyncwithout@pytest.mark.asynciodebug()has carried a# TODO: remove thisfor multiple release cycles; two commented-outpkg_resourcesnamespace declarations; stale# TODO: Use packaging.version.Versionrelease_leveldocstring copy-pasted verbatim frompy_compatible;README.rstis one sentence with no CLI reference or extension inventoryFollow-up PRs
Eight prioritised, self-contained PRs are proposed at the end of the report, from quick wins (S effort: error handling, dead-code removal, annotation gaps) through to medium-effort items (async remediation, caching refactor, test quality).
Original prompt
Deep code-quality review of
py/envoy.docs.sphinx_runnerDeliverable: a single PR that adds one new markdown file containing a structured code-quality / code-smell report for
py/envoy.docs.sphinx_runner. No code changes — report only.Where to put the file
What the report must cover
This is a deeper second-pass review that follows the in-flight initial cleanup PR (packaging metadata, lower dep bounds, mechanical Py3.12+ typing/syntax modernisation). Explicitly skip anything already covered by that initial pass — i.e. do NOT re-list:
setup.cfgmetadata fixes (url, classifiers,python_requires,py_modules,packages.find,package_data, the stale commented-out# sphinx-tabs…lines).typing.List→list,Optional[X]→X | None,collections.abcimport migrations.Investigate and categorise findings under at least these headings (omit a heading if you genuinely find nothing under it, but be thorough — explore every module and test file):
-j autousage.await, accidental coroutine objects, sync I/O on the event loop, blocking subprocess calls inside async functions,async-for-async's-sake.shell=True, unsanitised paths, missingcwddiscipline, temp-file/temp-dir leaks, race conditions, output-tree assumptions, missing cleanup on failure.@cached_property/functools.cacheusage, cache-key bugs, caches that don't actually cache or grow unboundedly.except:, swallowed exceptions,raise … from Nonehiding root causes, missing context in re-raises, log-and-return-success antipatterns.printcalls, inconsistent log levels, f-string-formatted logs vs%slazy formatting, missing context fields, swallowed sphinx warnings.Any-soup, missing return annotations on public functions, structural types that should beProtocols,# type: ignorewithout justification, mypy errors being suppressed.assert_called_once_withoveruse, slow/flaky tests, tests sharing mutable fixtures.README.rstaccuracy, examples that no longer work.Format of the report
Use this structure (markdown):
Rules
#L10-L42) pointing at the commit SHA you reviewed.SphinxRunner._build_dirat swallows ...This pull request was created from Copilot chat.