Skip to content

Miscellaneous low-priority fixes#121

Merged
orien merged 6 commits into
masterfrom
miscellaneous-low-priority-fixes
May 28, 2026
Merged

Miscellaneous low-priority fixes#121
orien merged 6 commits into
masterfrom
miscellaneous-low-priority-fixes

Conversation

@orien
Copy link
Copy Markdown
Member

@orien orien commented May 28, 2026

Context

Several small issues exist across the codebase: dead code from the JS port, missing guards, undocumented edge cases, a documentation inconsistency, and plaintext leaking via inspect.

Changes

  • Remove unreachable shifted.zero? branch in spatial_guesses (dead code from JS port)
  • Guard sequence matcher against empty passwords (== 1< 2)
  • Document expand_year boundary condition and negative-year edge case
  • Add README Limitations section noting English-only frequency lists
  • Fix to_hash migration snippet in CHANGELOG (missing .sort.to_h)
  • Suppress password from Score#inspect and token from Match#inspect

Consequences

Dead code is removed. Empty passwords no longer rely on accidental behaviour in the sequence matcher. Callers are warned about non-English scoring limitations. The CHANGELOG migration snippet now correctly replicates alphabetical key ordering. Plaintext passwords and tokens no longer appear in inspect output.

orien added 6 commits May 28, 2026 13:02
The outer guard `shifted_count&.positive?` ensures `shifted > 0`,
so `shifted.zero?` can never be true. Dead code carried over from the JS port.
Add `.sort.to_h` to match the README and old behaviour — `to_hash`
returned keys sorted alphabetically. Also clarify that splatting a
match or passing it to `Hash()` now raises `TypeError`.
Document that frequency lists are English-only and that non-English
passwords may score higher than the real-world risk warrants.
`password.length == 1` didn't cover length 0, relying on the loop
producing nil deltas to accidentally return []. Use `< 2` instead.
Score#inspect was showing the full password via Data.define's default.
Match#inspect was including token (a password substring). Both now
suppress these fields, matching the pattern already on Tester.
@orien orien merged commit 9a5fe73 into master May 28, 2026
10 checks passed
@orien orien deleted the miscellaneous-low-priority-fixes branch May 28, 2026 03:26
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