Skip to content

Expand test coverage for secrets detection and redaction package#43

Merged
hyp3rd merged 2 commits intofeat/secretsfrom
copilot/sub-pr-42
Jan 12, 2026
Merged

Expand test coverage for secrets detection and redaction package#43
hyp3rd merged 2 commits intofeat/secretsfrom
copilot/sub-pr-42

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Addresses code review feedback on PR #42 identifying missing test coverage for error conditions, edge cases, configuration options, and nested structure handling.

Tests Added

Error Handling

  • ErrSecretInputTooLong for all detection methods
  • Invalid configurations for both SecretDetector and Redactor (empty/invalid masks, invalid depths, empty patterns/keys)

Edge Cases

  • Empty strings, whitespace-only input, nil/empty collections
  • Max recursion depth enforcement preventing over-deep traversal

Configuration Options

  • WithSecretPattern / WithSecretPatterns - custom pattern detection
  • WithSecretMaxLength / WithSecretMask - input limits and custom masking
  • WithRedactionKeys - case-insensitive key matching
  • WithRedactionMaxDepth - recursion depth control

Complex Structures

  • Maps nested 3+ levels deep with sensitive keys at each level
  • Slices containing maps with mixed sensitive/non-sensitive fields

Coverage Impact

Test coverage: 72.6% of statements (up from minimal baseline)

All 16 test functions with 29 subtests passing.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: hyp3rd <62474964+hyp3rd@users.noreply.github.com>
Copilot AI changed the title [WIP] Update secrets detection and redaction package based on PR feedback Expand test coverage for secrets detection and redaction package Jan 12, 2026
Copilot AI requested a review from hyp3rd January 12, 2026 12:41
@hyp3rd hyp3rd marked this pull request as ready for review January 12, 2026 13:09
Copilot AI review requested due to automatic review settings January 12, 2026 13:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR significantly expands test coverage for the secrets detection and redaction package, addressing code review feedback on PR #42. The changes add comprehensive test coverage for error conditions, edge cases, configuration options, and complex nested structure handling, bringing test coverage from minimal baseline to 72.6%.

Changes:

  • Added 16 test functions with 29 subtests covering error handling, edge cases, and configuration options
  • Validated error conditions for input length limits and invalid configurations
  • Tested complex nested structures including 3+ level deep maps and slices containing maps

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hyp3rd hyp3rd merged commit 3e6934c into feat/secrets Jan 12, 2026
18 of 19 checks passed
@hyp3rd hyp3rd deleted the copilot/sub-pr-42 branch January 12, 2026 13:20
@hyp3rd hyp3rd restored the copilot/sub-pr-42 branch January 12, 2026 13:21
@hyp3rd hyp3rd deleted the copilot/sub-pr-42 branch January 12, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants