Skip to content

Extract secret detection into secret_redaction and regex_dfas crates - #15462

Draft
vorporeal wants to merge 1 commit into
david/rss-shard-terminal-modelfrom
david/secret-redaction
Draft

Extract secret detection into secret_redaction and regex_dfas crates#15462
vorporeal wants to merge 1 commit into
david/rss-shard-terminal-modelfrom
david/secret-redaction

Conversation

@vorporeal

Copy link
Copy Markdown
Contributor

Description

This PR continues the crate-split work that decreases incremental compile times for the warp crate. It extracts the secret-detection core into two new crates that sit below warp_terminal:

  • secret_redaction — owns the compiled secret regexes (SECRETS_REGEX), the types SecretsRegex, RegexLevelMetadata, and SecretLevel, the setter set_user_and_enterprise_secret_regexes, the default patterns (regexes module), and the pure text helpers (find_secrets_in_text, find_secrets_in_text_with_levels, find_secrets_in_text_with_levels_using_regex, merge_sorted_ranges_with_levels). The string helpers and redact_secrets move here from app, and become plain pub functions.
  • regex_dfas — owns the DFA-based regex search core (RegexDFAs, FindConfig) that was in warp_terminal's find module. This core powers all grid searching (find bar, async find, block filtering, and secret scanning). The grid-search loop stays in warp_terminal as GridHandler methods that take &RegexDFAs, because it depends on grid internals.

The PR also renames SecretRange to StringRange and moves it from warpui_core into string-offset. The type is a general "char range plus byte range" pair, and the new crates need it without a dependency on warpui_core.

What stays where:

  • Grid obfuscation state (Secret, SecretHandle, SecretMap, IsObfuscated, ObfuscateSecrets) stays in warp_terminal.
  • The view-coupled tooltip/span code and redact_inputs/redact_context stay in warp because they depend on app types.
  • warp_terminal and app re-export the moved items from their old paths, so call sites do not change.

Note: this PR is stacked on #14875 (david/rss-shard-terminal-model).

Warp conversation: https://staging.warp.dev/conversation/024e797d-1d35-4c62-8394-abf93f7ddb0e
Plan: Crate-split scoping: shrink the warp crate

Linked Issue

N/A — refactor that is part of the crate-split compile-time work; there is no user-visible change.

Testing

  • cargo check -p secret_redaction -p regex_dfas -p warp_terminal -p warp -p warp_tui --all-targets passes.
  • cargo nextest run -p secret_redaction -p regex_dfas -p string-offset -p warp_terminal -p warpui_core — 867 tests pass. The regex pattern tests moved from warp_terminal into secret_redaction unchanged, and the word-boundary tests moved into regex_dfas unchanged.
  • cargo nextest run -p warp -E 'test(/secret_redaction|redaction/)' — 40 tests pass.
  • ./script/format and all three presubmit clippy passes are clean.
  • No manual testing: this is a code move with compatibility re-exports, and behavior is covered by the existing tests above.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

@cla-bot cla-bot Bot added the cla-signed label Aug 23, 2026
Move the secret regexes, the default secret patterns, and the text
detection and redaction helpers out of warp_terminal and app into a new
secret_redaction crate. Move the regex DFA search core out of
warp_terminal's find module into a new regex_dfas crate, and keep the
grid search loop in warp_terminal as GridHandler methods. Rename
SecretRange to StringRange and move it into string-offset.

Co-Authored-By: Warp <agent@warp.dev>
@vorporeal
vorporeal force-pushed the david/secret-redaction branch from 6f536d8 to b3e47ba Compare August 23, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant