Skip to content

fix(tests): mock redact_sensitive_text in large-content test cases - #8

Closed
dsr-restyn wants to merge 0 commit into
fix/block-proc-environ-readfrom
fix/test-redact-perf
Closed

fix(tests): mock redact_sensitive_text in large-content test cases#8
dsr-restyn wants to merge 0 commit into
fix/block-proc-environ-readfrom
fix/test-redact-perf

Conversation

@dsr-restyn

Copy link
Copy Markdown
Owner

Problem

redact_sensitive_text runs a multi-pass regex scan that is O(n) but slow enough on 100K+ char inputs to exceed the 30s per-test signal.alarm in conftest.py. This caused three tests in test_file_read_guards.py to return {'error': 'Test exceeded 30 second timeout'} as a JSON result instead of the expected response — tests appeared to pass in pytest but produced wrong output.

Fix

Mock redact_sensitive_text as a no-op in the three affected tests. These tests exercise the character-count guard and config override logic, not redaction behaviour — bypassing redaction is correct here.

Affected tests

  • TestCharacterCountGuard::test_oversized_read_rejected — 100,001 chars through redact before the guard rejects it
  • TestCharacterCountGuard::test_content_under_limit_passes — 99,999 chars through redact
  • TestConfigOverride::test_custom_config_raises_limit — 200,000 chars through redact

Verification

pytest tests/tools/test_file_read_guards.py::TestCharacterCountGuard tests/tools/test_file_read_guards.py::TestConfigOverride -v
5 passed in 0.70s

Stacks on top of #fix/block-proc-environ-read → upstream PR NousResearch#4609.

@dsr-restyn
dsr-restyn force-pushed the fix/block-proc-environ-read branch from 0231836 to 0512b8f Compare April 3, 2026 20:47
@dsr-restyn
dsr-restyn force-pushed the fix/test-redact-perf branch from 41731f5 to f39d452 Compare April 3, 2026 20:47
@dsr-restyn

Copy link
Copy Markdown
Owner Author

Superseded by upstream PR NousResearch#4860 which targets main directly. The fix will land in the fix/block-proc-environ-read branch naturally once NousResearch#4860 merges.

@dsr-restyn dsr-restyn closed this Apr 3, 2026
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.

1 participant