Skip to content

refactor: relocate sanitize_control_chars to dedicated module #262

Description

@dean0x

Location: crates/mds-core/src/lint/diagnostic.rs:416

What: sanitize_control_chars lives in the lint module but is now a core cross-cutting concern used by:

  • lint::to_canonical_json()
  • error::MdsError::serialize()
  • Python bindings (mds-python/src/lib.rs)
  • CLI render paths

Why deferred: Orthogonal to closing #176. Better as a separate refactor after the security hardening lands.

Source review: .devflow/docs/reviews/fix-esc-injection-176/2026-07-25_1625 (architecture-11)

Acceptance Criteria:

  • Create new module crates/mds-core/src/sanitize.rs
  • Move sanitize_control_chars and its helpers to the new module
  • Update all imports to use mds::sanitize_control_chars (no change to public API)
  • Verify all tests pass
  • Update KNOWLEDGE.md to reflect the new module structure

Note: The function's public API signature will not change. This is a pure organizational refactor to reflect the cross-cutting nature of sanitization in the system architecture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitectural refactoringrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions