fix(js-parser): treat a zero-JS-file repo as an empty result, not a crash#107
Open
gadievron wants to merge 1 commit into
Open
fix(js-parser): treat a zero-JS-file repo as an empty result, not a crash#107gadievron wants to merge 1 commit into
gadievron wants to merge 1 commit into
Conversation
…rash A directory with zero JS-family source files made the JavaScript parser abort the entire scan instead of returning a clean empty result. repository_scanner.js succeeds and emits an empty file list (exit 0), but run_typescript_analyzer hit `if not files: return False`, so run_full_pipeline early-returned without results['success'], main() did sys.exit(1), and _parse_javascript raised RuntimeError on the non-zero exit (uncaught at the scan layer => whole scan aborts). The Python, Ruby and Zig parsers all handle an empty repo gracefully; the JS guard was the lone outlier promoting valid empty input to a fatal exit. Mirror the zig graceful-empty pattern entirely within parsers/javascript/test_pipeline.py: on zero files, write valid empty analyzer_output.json / dataset.json / call_graph.json, record synthetic successful stages, set self.empty_repo, and return True; run_full_pipeline then skips the unit generator and reports success. _parse_javascript reads units_count=0 and returns a valid empty ParseResult. parser_adapter.py and zig/test_pipeline.py are correct as-is and left untouched. Adds regression test tests/parsers/javascript/test_empty_repo.py (RED before, GREEN after). Full openant-core suite: 219 passed, 22 skipped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
A directory with zero JS-family source files made the JavaScript parser
abort the entire scan instead of returning a clean empty result.
repository_scanner.js succeeds and emits an empty file list (exit 0), but
run_typescript_analyzer hit
if not files: return False, sorun_full_pipeline early-returned without results['success'], main() did
sys.exit(1), and _parse_javascript raised RuntimeError on the non-zero
exit (uncaught at the scan layer => whole scan aborts). The Python, Ruby
and Zig parsers all handle an empty repo gracefully; the JS guard was the
lone outlier promoting valid empty input to a fatal exit.
Mirror the zig graceful-empty pattern entirely within
parsers/javascript/test_pipeline.py: on zero files, write valid empty
analyzer_output.json / dataset.json / call_graph.json, record synthetic
successful stages, set self.empty_repo, and return True; run_full_pipeline
then skips the unit generator and reports success. _parse_javascript reads
units_count=0 and returns a valid empty ParseResult. parser_adapter.py and
zig/test_pipeline.py are correct as-is and left untouched.
Adds regression test tests/parsers/javascript/test_empty_repo.py
(RED before, GREEN after). Full openant-core suite: 219 passed, 22 skipped.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com