Skip to content

Raise ArgumentError for unsupported EoTime comparison operands - #55

Open
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/raise-invalid-comparison-argument
Open

Raise ArgumentError for unsupported EoTime comparison operands#55
OskarEichler wants to merge 3 commits into
floraison:masterfrom
OskarEichler:codex/raise-invalid-comparison-argument

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Instantiate the intended ArgumentError when an unsupported comparison operand lacks to_f. Calling ArgumentError as a method currently raises NoMethodError instead, hiding the intended diagnostic.

Reproduction

EtOrbi::EoTime.new(0, "UTC") < Object.new raises NoMethodError before, ArgumentError after.

The focused check covers <, <=, >, >= and <=>. Valid numeric and Time comparisons remain unchanged.

Verification

  • Ruby 4.0.6 via rbenv; existing Probatio suite, no test files added or modified.
  • Reviewed master baseline and this individual patch each run 270 tests / 412 assertions with exactly the same three pre-existing DST/rday failures from rday / rweek calculation is odd in time zones with DST #51. Failure identities were compared, not just counts.
  • A release-based 1.4.1 branch containing the five separately proposed fixes passes 263 existing tests / 405 assertions with TZInfo 2.0.6 in UTC, Asia/Tokyo, America/Chicago, Europe/Istanbul and the detected local zone.
  • Temporary focused before/after reproductions pass with TZInfo 2.0.6 and 1.2.11. The combined release branch also passes the existing TZInfo 1.2.11 suite at seed 36231. Seed 99751 has the same pre-existing Zulu test-order failure on both unmodified release and patched release: a test mutates the cached TZInfo object's comparison method.
  • Ruby syntax and gem packaging checks pass. Targeted Lint passes on the combined branch with the existing, unrelated AssignmentInCondition warning excluded; no lint configuration was changed.

The current master's unreleased day-delta change was not brought into the consumer branch. No live scheduler or production operations were used. Linux/Windows and other Ruby runtimes were not run locally.

Breaking changes and limitations

Intentional exception-class correction: unsupported operands now raise ArgumentError rather than the accidental NoMethodError. No accepted operand types or comparison arithmetic changed. No overlapping current fix was found.

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