improve-flow-coverage

Improve Python flow test coverage for C source files by finding gaps and writing tests.

6.2k|596|Updated May 5, 2016
One-click install
npx skills add https://github.com/RediSearch/RediSearch --skill improve-flow-coverage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: improve-flow-coverage
Source: https://github.com/RediSearch/RediSearch/tree/main/.skills/improve-flow-coverage
Command: npx skills add https://github.com/RediSearch/RediSearch --skill improve-flow-coverage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

C source files in the RediSearch codebase often have untested code paths that reduce confidence in changes. This Skill automates the end-to-end workflow of finding flow test coverage gaps, triaging them, and writing Python tests to close them.

Core Features & Use Cases

  • Coverage Gap Analysis: Runs the check-flow-coverage pipeline to build with gcov instrumentation, execute the test suite, and report testable gaps grouped by feature.
  • Guided Test Authoring: Presents gaps grouped by feature with suggested test approaches, then writes or extends Python flow tests following established guidelines.
  • Defensive Code Cleanup: Replaces unreachable defensive code with RS_ASSERT or RS_ABORT assertions, keeping lcov exclusions only for allocation-failure cleanup paths.
  • Use Case: A developer modifying src/query.c wants to ensure their changes are covered. They run the skill on that file, review the grouped gap report, select which gaps to address, and get verified tests plus a coverage confirmation in one workflow.

Quick Start

Ask the assistant to improve flow coverage for a C source file, for example by saying: improve flow coverage for src/query.c and src/module.c.

Frequently Asked Questions about improve-flow-coverage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve test coverage for C source files in RediSearch?

Run the improve-flow-coverage workflow with one or more C file paths, such as src/query.c. It builds with coverage instrumentation, runs the test suite, reports testable gaps grouped by feature, and writes Python flow tests to close the gaps you select.

How do I run flow tests with coverage instrumentation?

Use ./build.sh RUN_PYTEST COV=1 TEST="module.function" to run targeted tests with gcov coverage capture. A single run both executes the tests and records coverage data into bin/flow_standalone.info, so you should not run the same tests twice.

Does this coverage workflow support Rust source files?

No, this workflow only covers C source files under src/ and deps/thpool/. For Rust code under src/redisearch_rs/, use the check-rust-coverage skill instead, which is designed for Rust coverage analysis.

When should defensive code be replaced with assertions instead of tested?

Replace unreachable defensive code with RS_ASSERT or RS_ABORT when the condition should never be false, such as exhaustive switch default arms. Keep lcov exclusions only for allocation-failure guards that perform cleanup like freeing memory before returning.

Why is my coverage report stale after running tests?

A stale flow_standalone.info file means the coverage capture failed, usually because the build was not instrumented. Rebuild with ./build.sh COV=1 FORCE and rerun the tests, verifying the info file is newer than your start marker.