Skip to content

Add custom sanitization map to test CLI for test-specific output rules#1779

Merged
aknysh merged 3 commits intomainfrom
custom-sanitize-map
Nov 11, 2025
Merged

Add custom sanitization map to test CLI for test-specific output rules#1779
aknysh merged 3 commits intomainfrom
custom-sanitize-map

Conversation

@osterman
Copy link
Member

This PR introduces a custom sanitization map for the test CLI to enable test-specific output rules. The implementation adds comprehensive test coverage for path sanitization across different formats (Unix, Windows, debug logs) and standardizes snapshot testing behavior.

Tests verify sanitization of absolute paths, Windows-style backslashes, debug logs with import prefixes, multiple occurrences, and path normalization. Documentation updates explain the sanitization testing strategy.

Closes #[issue-number]

…t rules

Add a new `sanitize` field to the test expectations that allows tests to specify
custom regex replacement patterns for one-off sanitization cases that don't need
global rules. This is useful for sanitizing session IDs, build timestamps, or
other test-specific volatile values.

Changes:
- Add sanitizeOption functional options pattern to sanitizeOutput function
- Add WithCustomReplacements() option builder for custom patterns
- Add sanitize field to Expectation struct for test case YAML configuration
- Update schema.json to validate sanitize field in test cases
- Integrate custom sanitization into verifySnapshot() workflow
- Add 14 comprehensive test cases covering all sanitization scenarios
- Add detailed README documentation with examples and debugging tips

The implementation follows the mandatory functional options pattern from CLAUDE.md
and maintains backward compatibility with existing tests.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@osterman osterman requested review from a team as code owners November 10, 2025 20:34
@mergify
Copy link

mergify bot commented Nov 10, 2025

💥 This pull request now has conflicts. Could you fix it @osterman? 🙏

@mergify mergify bot added conflict This PR has conflicts triage Needs triage labels Nov 10, 2025
@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Nov 10, 2025
Resolved conflict in tests/cli_test.go by combining:
- Custom sanitization map logic from custom-sanitize-map branch
- Additional path normalization patterns from main branch

Both features are now integrated sequentially in the sanitizeOutput function.
@github-actions github-actions bot added the size/m Medium size PR label Nov 10, 2025
@mergify mergify bot removed the conflict This PR has conflicts label Nov 10, 2025
@github-actions
Copy link

github-actions bot commented Nov 10, 2025

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.72%. Comparing base (74482e5) to head (d8dc033).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1779      +/-   ##
==========================================
- Coverage   70.73%   70.72%   -0.01%     
==========================================
  Files         432      432              
  Lines       39916    39916              
==========================================
- Hits        28235    28232       -3     
- Misses       9277     9282       +5     
+ Partials     2404     2402       -2     
Flag Coverage Δ
unittests 70.72% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify bot removed the triage Needs triage label Nov 11, 2025
@aknysh aknysh merged commit 256a9b7 into main Nov 11, 2025
60 checks passed
@aknysh aknysh deleted the custom-sanitize-map branch November 11, 2025 17:29
aknysh added a commit that referenced this pull request Nov 11, 2025
Resolved snapshot conflicts by taking main's version. User will regenerate
snapshots as needed for ai-1 branch changes.

Merged changes from main:
- feat: add error handling infrastructure with context-aware capabilities (#1763)
- fix: Resolve changelog check failures on large PRs (#1782)
- Refine homepage hero and typing animation (#1781)
- fix: Reduce log spam for imports outside base directory (#1780)
- feat: Add custom sanitization map to test CLI for test-specific output rules (#1779)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link

These changes were released in v1.199.0-rc.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants