Skip to content

feat(extract): support .bats Bash Automated Testing suites (#3361) - #3460

Open
nikhilsaxena04 wants to merge 1 commit into
Graphify-Labs:v8from
nikhilsaxena04:fix-bats-tests-clean
Open

feat(extract): support .bats Bash Automated Testing suites (#3361)#3460
nikhilsaxena04 wants to merge 1 commit into
Graphify-Labs:v8from
nikhilsaxena04:fix-bats-tests-clean

Conversation

@nikhilsaxena04

Copy link
Copy Markdown

The bug:
Bats test files (.bats) were entirely ignored because the extension was missing from CODE_EXTENSIONS, and even when copied to .bash, the bash AST extractor lacked grammar support for Bats' specific test definitions.

The fix:

  • Added .bats to CODE_EXTENSIONS, _DISPATCH, and language mappings.
  • Upgraded walk() in extractors/bash.py to properly extract bats test definition nodes.
  • Recognises native Bats forms: @test "description" { ... }
  • Recognises Bash-compliant forms: function foo { #@test ... }
  • Both emit linkable 'bash_test' nodes into the graph.

…Labs#3361)

The bug:
Bats test files (.bats) were entirely ignored because the extension
was missing from CODE_EXTENSIONS, and even when copied to .bash,
the bash AST extractor lacked grammar support for Bats' specific test definitions.

The fix:
- Added .bats to CODE_EXTENSIONS, _DISPATCH, and language mappings.
- Upgraded walk() in extractors/bash.py to properly extract bats test definition nodes.
- Recognises native Bats forms: `@test "description" { ... }`
- Recognises Bash-compliant forms: `function foo { #@test ... }`
- Both emit linkable 'bash_test' nodes into the graph.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Formal verification. No changes could be formally verified in this run.


Graphify review — findings

Adds .bats support to the code-file classification, language-family map, and extractor dispatch so Bats test files are scanned and parsed via the existing bash extractor. Detects both Bats test forms in extract_bash — native @test "desc" { ... } blocks (keyed by their description) and function name { #@test } comment-annotated functions — emitting them as bash_test nodes instead of plain bash_function.

Worth a look

  • Quoted #@test text marks ordinary functions as testsgraphify/extractors/bash.py:295 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 2479 functions depend on the 378 functions this change touches.

Health — this change adds coupling hotspots:

  • new: extract() — 563 callers, 43 callees
  • new: _rebuild_code() — 115 callers, 51 callees
  • new: detect() — 108 callers, 15 callees
  • new: _extract_generic() — 18 callers, 26 callees
  • new: save_manifest() — 40 callers, 11 callees
  • new: extract_bash() — 43 callers, 10 callees
  • new: extract_files_direct() — 17 callers, 20 callees
  • new: extract_js() — 85 callers, 4 callees
  • …and 55 more — each is listed as a finding

Verification — 2479 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 2238 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

126 of 263 test file(s) selected (48%) via static blast radius.

  • tests/test_astro_extraction.py — impact
  • tests/test_astro_import_ids.py — impact
  • tests/test_atomic_writes.py — impact
  • tests/test_build.py — impact
  • tests/test_builtin_global_type_refs.py — impact
  • tests/test_case_sensitive_resolution.py — impact
  • tests/test_charmap_encoding.py — impact
  • tests/test_chunking.py — impact
  • tests/test_cjs_module_extension.py — impact
  • tests/test_claude_cli_backend.py — impact
  • tests/test_cpp_nested_and_cli.py — impact
  • tests/test_cpp_objc_cross_file_calls.py — impact
  • tests/test_cross_extension_reexport_self_cycle.py — impact
  • tests/test_cross_language_call_resolution.py — impact
  • tests/test_cross_repo_member_calls.py — impact
  • tests/test_csharp_call_site_generic_args.py — impact
  • tests/test_csharp_enum_members.py — impact
  • tests/test_csharp_field_generic_args.py — impact
  • tests/test_csharp_generic_callsites.py — impact
  • tests/test_csharp_interface_dispatch.py — impact
  • tests/test_csharp_member_calls.py — impact
  • tests/test_csharp_member_nodes.py — impact
  • tests/test_csharp_object_creation.py — impact
  • tests/test_csharp_partial_classes.py — impact
  • tests/test_csharp_type_resolution.py — impact
  • tests/test_definition_file_portability.py — impact
  • tests/test_detect.py — impact
  • tests/test_dotnet.py — impact
  • tests/test_duplicate_annotation_edges.py — impact
  • tests/test_evidence_binding.py — impact
  • tests/test_extract.py — impact
  • tests/test_extract_bats.py — impact, changed-test
  • tests/test_extract_cache_location.py — impact
  • tests/test_extract_cli.py — impact
  • tests/test_file_label_disambiguation.py — impact
  • tests/test_file_node_id_spec.py — impact
  • tests/test_file_slice.py — impact
  • tests/test_forwarding_review_findings.py — impact
  • tests/test_go_builtin_call_targets.py — impact
  • tests/test_go_qualified_resolution.py — impact
  • tests/test_ignore_file_encoding.py — impact
  • tests/test_image_vision.py — impact
  • tests/test_import_extension_resolution.py — impact
  • tests/test_import_self_loops.py — impact
  • tests/test_imported_export_forwarding.py — impact
  • tests/test_incremental.py — impact
  • tests/test_incremental_mtime_collision.py — impact
  • tests/test_indirect_call_arrow_single_param_shadow.py — impact
  • tests/test_indirect_call_catch_binding_shadow.py — impact
  • tests/test_indirect_call_external_import_shadow.py — impact
  • … and 76 more

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify extract.

The verifier did not have enough to check extract, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: parameter `cache_root` is annotated `Path | None` — outside the synthesizable primitive/collection set

Could not verify: Could not verify extract\_bash.

The verifier did not have enough to check extract\_bash, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set

· 63 more finding(s) on lines outside this diff (see the check run).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant