Skip to content

[Feature]: Track Python-compatible regex rules in ddns-rs #729

Open

Description

@NewFuture

Problem Description (描述场景和问题)

The Python client evaluates regex: address rules with Python re, while ddns-rs currently uses Rust's regex crate. Rust intentionally rejects Python features such as look-around and backreferences, so an existing Python configuration may require changes before it can be reused by the Rust client.

The Rust MVP now documents this boundary and returns an explicit compatibility error, but syntax-level parity should be evaluated separately from the initial implementation.

Proposed Solution (解决方案或思路)

Track a dedicated compatibility design and implementation:

  • inventory Python regex: patterns used in documentation, tests, and reported user configurations
  • define the required Python re compatibility subset
  • evaluate a safe Rust-native implementation or translation strategy, including look-around and backreferences
  • reject patterns with unsafe or unsupported behavior deterministically
  • add shared Python/Rust conformance fixtures and process-level tests
  • update the compatibility matrix once a supported approach is selected

The solution must preserve the standalone Rust binary, avoid invoking Python, and consider ReDoS/backtracking risks before accepting a backtracking regex engine.

Alternatives Considered (考虑过的其他方案)

  • Keep Rust regex syntax as the permanent contract. This is the current safe MVP behavior but requires users to migrate some patterns.
  • Add fancy-regex. It supports more constructs but is not a complete Python re implementation and introduces backtracking/performance risks.
  • Invoke Python for matching. Rejected because it breaks the standalone Rust deployment goal.

Additional Context (补充说明)

Follow-up to PR #728 and its regex compatibility review thread. This issue is intentionally separated so the MVP PR can keep a small, predictable dependency and security surface while the compatibility trade-off is evaluated independently.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions