Make RTH property test robust to common transcription noise and permutations#45
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3c9ae016b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| st.sampled_from(list("013457")), | ||
| st.sampled_from(list("oieast")), | ||
| max_size=6, |
There was a problem hiding this comment.
Restrict substitution mappings to normalization-compatible values
The new substitution_table can map digits to arbitrary letters (e.g., "1" -> "i"), but _normalize_rth_noise only normalizes a fixed digit set to fixed targets (e.g., "1" -> "l"). This makes assert lhs == normalized_rhs fail for generated cases that are not reversible by the normalizer, so the property test becomes red for reasons unrelated to RTH stability (for example, base token "1" with substitution {"1": "i"} can never normalize back to canonical "1").
Useful? React with 👍 / 👎.
Motivation
Description
_normalize_rth_noiseto map common STT substitutions (0/1/3/4/5/7-> letters) and a helper_hash_bit_distanceto compute bit-distance between hex hashes.test_rth_stable_under_noise_permutationsto drawst.permutationsof the canonical token set, optional duplicate noise tokens, whitespace prefix/suffix, and a charactersubstitution_table, then buildcanonical_textandnoisy_textfrom those variants.lhs == normalized_rhs) and to permit a bounded raw-hash deviation (_hash_bit_distance(lhs, rhs) <= 160) as a realistic tolerance.tests/test_prop_screenless.pyand preserved the Project Echo invariant comment (# Project Echo 不変原則:画面無しデバイス時代の透明性防衛).Testing
PYTHONPATH=src pytest -q tests/test_prop_screenless.pyand the run failed during collection withModuleNotFoundError: No module named 'hypothesis'so full property execution could not be completed.hypothesiswithpython -m pip install hypothesis -qand the installation failed due to network/proxy restrictions, preventing a complete local test run.tests/test_prop_screenless.pywas updated so CI should validate the change oncehypothesisis available in the test environment.Codex Task