Skip to content

feat: add config DSL methods for PII redaction (T7)#55

Closed
dpaluy wants to merge 2 commits intomasterfrom
feature/add-config-dsl-methods
Closed

feat: add config DSL methods for PII redaction (T7)#55
dpaluy wants to merge 2 commits intomasterfrom
feature/add-config-dsl-methods

Conversation

@dpaluy
Copy link
Copy Markdown
Owner

@dpaluy dpaluy commented Jan 7, 2026

Summary

Implements T7 (#44): Config DSL methods for enabling pattern-based PII redaction.

New Config API

TraceBook.configure do |config|
  config.redact :email, :phone, :credit_card    # Enable specific patterns
  config.redact_group :api_keys                  # Enable pattern group
  config.redact_pattern(/secret=\w+/, "[SECRET]") # Custom pattern
end

Included Changes

  • T2: Validators module with Luhn algorithm and SSN range validation
  • T3: PATTERNS hash with 16 built-in patterns:
    • PII: email, phone, ssn
    • Financial: credit_card (with Luhn validation)
    • API Keys: openai_key, anthropic_key, aws_key, stripe_key, github_token, github_pat
    • Auth: bearer_token, basic_auth, jwt
    • Network: ipv4, ipv6
    • Crypto: private_key
  • T7: Config DSL methods (redact, redact_group, redact_pattern)
  • Pattern groups for batch enabling (pii, financial, api_keys, auth, network, crypto)

Validation

  • Invalid pattern names raise ConfigurationError at config time
  • Invalid group names raise ConfigurationError at config time

Test Plan

  • 14 new config DSL tests added
  • All 160 tests pass

dpaluy added 2 commits January 6, 2026 23:33
Add public method to convert ActiveRecord actors to job-safe serialized
format for background job enqueueing. Supports GlobalID extraction with
fallback to type/id tuple for objects without GlobalID support.

Closes #42
Add pattern-based redaction DSL to Config class:
- config.redact :email, :phone - enables individual patterns
- config.redact_group :api_keys - enables pattern groups
- config.redact_pattern(/regex/, "[REPLACEMENT]") - custom patterns
- config.active_patterns - returns all enabled Pattern objects

Also includes:
- T2: Validators module with Luhn and SSN range validation
- T3: PATTERNS hash with 16 built-in patterns (email, phone, credit_card,
  ssn, openai_key, anthropic_key, aws_key, stripe_key, github_token,
  github_pat, bearer_token, basic_auth, private_key, ipv4, ipv6, jwt)
- PATTERN_GROUPS for convenient batch enabling (pii, financial, api_keys,
  auth, network, crypto)

Invalid pattern names raise ConfigurationError at config time for
early validation.
@dpaluy dpaluy added the enhancement New feature or request label Jan 7, 2026
@dpaluy dpaluy force-pushed the master branch 8 times, most recently from 0a23bb3 to d2366f3 Compare March 26, 2026 14:19
@dpaluy
Copy link
Copy Markdown
Owner Author

dpaluy commented Apr 26, 2026

Closing as obsolete after Tracebook v1.0.0 moved to the RubyLLM Chat/Message architecture and removed the old interaction-recorder paths this PR was based on. Current OPF redaction backend work is tracked by #68/#69.

@dpaluy dpaluy closed this Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant