Skip to content

refactor(mcp): consolidate 3 separately-maintained local-path-redaction implementations #6264

Description

@JSONbored

Context

packages/loopover-mcp/lib/local-branch.js:214-220 (redactLocalPath), packages/loopover-mcp/bin/loopover-mcp.js:3628-3631 (redactLocalValidationPaths), and bin/loopover-mcp.js:3948-3972 (sanitizeDiagnosticText) are three separately-maintained implementations of the same underlying concept — redacting a local filesystem path before it reaches API/terminal output — using different mechanisms (a generic absolute-path regex heuristic vs. exact-known-path string substitution) and, as the sibling (-prefix bug issue in this same file shows, different correctness.

Requirements

  • After the sibling (-prefix regex fix lands (see the companion issue), consolidate these three into one shared, single-tested path-redaction helper that all three current call sites use.
  • Preserve whichever mechanism (regex heuristic vs. exact substitution) is actually needed at each call site — if sanitizeDiagnosticText's exact-substitution approach solves a different problem (redacting a KNOWN path vs. detecting an unknown one in free text), keep both approaches available as named functions in the one consolidated module rather than forcing a single mechanism that doesn't fit all three use cases.

Test Coverage Requirements

99%+ Codecov patch coverage; existing tests for all three original call sites must continue passing against the consolidated module.

Deliverables

  • One shared module providing local-path redaction, used by all three former call sites.
  • No behavior regression at any of the three original call sites.

Expected Outcome

A future fix to path-redaction logic (like the sibling (-prefix bug) only needs to happen once.

Links & Resources

  • packages/loopover-mcp/lib/local-branch.js:214-220, bin/loopover-mcp.js:3628-3631,3948-3972
  • The companion (-prefix regex fix issue (land first, then consolidate)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions