Skip to content

[TEST/FEAT] Heuristic Fallback Fault Tolerance: In-Memory DB Infrastructure & Mock-Isolated Regression Suite #4

@ojaswa072

Description

@ojaswa072

Summary

BLT-Preflight's heuristic fallback — the regex-based scanner that activates when the upstream LLM API is unavailable — constitutes the tool's last line of defense for security risk detection. This fallback path currently has zero test coverage, representing measurable technical debt in a security-critical pipeline. This issue proposes a scoped, two-part remediation: introducing SQLite --memory support to enable stateless testing infrastructure, then leveraging that infrastructure to build a defensive mock-isolated regression suite that validates fallback fault tolerance end-to-end.

Problem Statement: Unverified Fault Tolerance is a Security Risk

In a security-focused tool, an untested code path is not a cosmetic deficiency — it is a liability. The current state presents two compounding risks:

1. Silent Fallback Failures: If the heuristic scanner contains a regression (e.g., a broken regex, a missed pattern class), no automated gate will catch it. A developer relying on Preflight for pre-commit risk detection could receive a false-negative result during an LLM outage with zero indication of degraded coverage.
2. Non-Deterministic Test State: Without in-memory DB support, any test that touches persistence must manage on-disk fixture files, creating cross-platform fragility (LF/CRLF path handling, teardown race conditions, CI environment variance). This makes the heuristic path harder to test reliably.

These two gaps are causally linked and should be resolved together. I have a technical implementation plan ready and would like to begin work on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions