Skip to content

db/connection.ts: findDbPath and openRepo exceed halstead.effort FAIL threshold #1748

Description

@carlos-alm

GAUNTLET (Titan phase 15 audit) flagged two FAIL-level rule-1 violations in src/db/connection.ts that are out of scope for phase 15's commit (which is narrowly scoped to the openReadonlyWithNative resource-leak ordering bug + engine-resolution dedup, per sync.json's phase-15 label):

  • findDbPath (lines 263-327): halstead.effort=30574.33 (exceeds FAIL threshold of 15000); cognitive=24, cyclomatic=15 (exceed WARN).
  • openRepo (lines 387-437): halstead.effort=20067.26 (exceeds FAIL threshold of 15000); cognitive=16, cyclomatic=12 (exceed WARN).

Neither function is targeted by any other phase in the current sync.json execution plan (connection.ts appears only once, at phase 15). Filing this so the FAIL-level complexity findings aren't silently lost.

Recommendation: decompose findDbPath's directory-walk/ceiling logic and openRepo's native-fallback branching into smaller named helpers, verified against codegraph complexity --file src/db/connection.ts --health -T --json before/after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions