Skip to content

fix: Add abs() guard to Tymist.tock setter for consistency with Doer#7

Open
Nicholas-Keystate wants to merge 1 commit intoWebOfTrust:masterfrom
Nicholas-Keystate:fix/tymist-tock-abs-guard
Open

fix: Add abs() guard to Tymist.tock setter for consistency with Doer#7
Nicholas-Keystate wants to merge 1 commit intoWebOfTrust:masterfrom
Nicholas-Keystate:fix/tymist-tock-abs-guard

Conversation

@Nicholas-Keystate
Copy link
Copy Markdown

Summary

Add abs() guard to Tymist.tock setter for consistency with Doer.tock setter.

Problem

Tymist.tock.setter (tyming.py:78) did not apply abs():

self._tock = float(tock)  # Allowed negative!

But Doer.tock.setter (doing.py:569) does:

self._tock = abs(float(tock))  # Protected

Since Doist inherits from Tymist (not Doer), a Doist(tock=-X) would cause tyme to decrement on each tick(), breaking all scheduling invariants:

  1. Tyme monotonicity violated
  2. Tymers never expire (comparing against retreating tyme)
  3. Periodic Doers' retymes never reached
  4. Potential infinite loops

Fix

  • Add abs() to Tymist.tock setter
  • Update constructor to use setter (inherits abs() guard)
  • Add test_tymist_tock_abs_guard test

Consistency

Other parameters already have sign guards:

  • Doist.limit: abs(float(limit)) (doing.py:110)
  • Doer.tock: abs(float(tock)) (doing.py:569)

This PR extends that pattern to Tymist.tock.

Test

tymist = tyming.Tymist()
tymist.tock = -1.0
assert tymist.tock == 1.0  # Now passes with this fix

Tymist.tock.setter was missing abs() guard that Doer.tock.setter has.
Since Doist inherits from Tymist (not Doer), a Doist(tock=-X) would
cause tyme to decrement on each tick(), breaking all scheduling:

- Tyme monotonicity violated
- Tymers never expire (comparing against retreating tyme)
- Periodic Doers' retymes never reached
- Potential infinite loops

This change:
- Adds abs() to Tymist.tock setter (line 80)
- Updates constructor to use setter (inherits abs() guard)
- Adds test_tymist_tock_abs_guard test

Matches existing pattern in:
- Doer.tock setter: abs(float(tock)) (doing.py:569)
- Doist.limit: abs(float(limit)) (doing.py:110)
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