Skip to content

[BUG/DATA-INTEGRITY] record_keeper.py's "binary_anomaly" SQLite column is always False -- no producer exists #368

Closed

Description

@squid-protocol

🛑 Problem Statement

Found by the dead key auditor (#325). gitgalaxy/recorders/record_keeper.py:479:

bin_anomaly = 1 if file_data.get("binary_anomaly", False) else 0

No producer anywhere writes file_data["binary_anomaly"]. The engine already has binary-format anomaly detection (security_lens.py::scan_binary() sets threats["sec_extension_mismatch"] and threats["sec_high_risk_execution"] for magic-byte/header mismatches), but that output never becomes file_data["binary_anomaly"]. The binary_anomaly INTEGER SQLite column is permanently 0.

Related: #366/#367/#368 -- the same table's other security flag columns.

🎯 Objective

The SQLite binary_anomaly column should reflect real binary-format anomaly detections (embedded execution headers, magic-byte/extension mismatches).

🛠️ Proposed Implementation

Confirm whether scan_binary()'s output ever reaches file_data at all for binary files (it may be a Zero-Dependency-Mode/binary-path gap, not just a naming mismatch -- worth checking before assuming a simple rename fixes it). Thread the real result into file_data["binary_anomaly"].

✅ Acceptance Criteria

  • A file with a magic-byte/extension mismatch or embedded execution header produces binary_anomaly = 1 in the SQLite output, proven by a real test.

Activity

  1. added
    bug
    data-integrity
    schema
    priority: high
    on Jul 24, 2026
  2. squid-protocol commented on Jul 24, 2026

    @squid-protocol
    OwnerAuthor

    Fixed in #381 (merged).

  3. squid-protocol commented on Aug 7, 2026

    @squid-protocol
    OwnerAuthor

    Regression found via population-scale validation (#1144)

    Same shape as the regression just found on #367: closed via #381 with a passing unit test, but a
    full v2.4.7 run against 718 real repos (1,201,836 files) shows binary_anomaly is still 100%
    zero across every file
    . #381's fix reads
    file_data.get("equations", {}).get("sec_extension_mismatch", 0), verified only against a
    hand-built mock equations dict in the test -- not against real pipeline output.

    Given #368's original body already flagged this as "murkier... may be a Zero-Dependency-Mode/
    binary-path gap, not just a naming mismatch, worth checking before assuming a simple rename
    fixes it" -- that caveat looks like it was correct, and the #381 fix didn't actually close the
    gap it was worried about.

    Reopening. See #1144 for the full validation methodology and the other
    findings from the same run.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdata-integritypriority: highschema

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions