Repository navigation
fix(report): handle missing or null corpus stats in report.generate - #5645
Gaurav-meena95 wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @Gaurav-meena95. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify review 
2 possible issues to check · High impact
The report now shows missing or null corpus file and word counts as zero.
2 possible issues we couldn't confirm
- Missing corpus stats now show as 0 files and ~0 words, followed by an unconditional 'large enough' verdict ·
graphify/report.py:203 - Word or file counts that are strings would make the whole report fail with a format error ·
graphify/report.py:206
They don't change the score.
Code graph · 706 functions depend on this change
- 1 function became more coupled.
generate()(51 callers). - 8 of 658 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Reviewed 96fcbff
Extractor accuracy (Swift #5641, Apex #5627, Python #5647, TypeScript #5604/#5614/#5612, Bash caller-var #5602), GitHub Actions run-step extraction (#5603), incremental correctness (#5634/#5638/#5636), symlink and semantic-cache fixes (#5617/#5618), export/report hardening and perf (#5643/#5644/#5645/#5646/#5619/#5620/#5621), and CLI/docs/skill/install work (#5629/#5628/#5626/#5624/#5623/#5625/#5642/#5583). AST cache schema 59 to 60; Swift/Apex/Python/Bash/GHA inputs re-extract on first build. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed in v0.9.124 (just released to PyPI), cherry-picked with your authorship preserved so it shows under your name in the history. Thanks @Gaurav-meena95 for handling missing/null corpus stats in report.generate — verified green in the full suite and, where applicable, smoke-tested against the published package. 🙏 |
What does this PR do?
Guards
detection_result['total_files']anddetection_result['total_words']lookups inreport.generate()(graphify/report.py) so missing keys orNonevalues default to0instead of raisingKeyErrororTypeError.Problem
When
report.generate()is called with a minimal/partialdetection_result(e.g.,{}or{"total_files": None, "total_words": None}):detection_result['total_files']raisedKeyError: 'total_files'.{detection_result['total_words']:,}raisedTypeError: unsupported format string passed to NoneType.__format__.Details
generate()(graphify/report.py)detection_result['total_files']anddetection_result['total_words']indexing.get(...)and fall back to0whenNoneKeyErrorandTypeErroron missing or null corpus statstests/test_report.pydetection_resultstatstest_report_handles_missing_or_null_corpus_stats{}andNonecorpus stat handlingType of change
How was this tested?