Time-of-day flake: test_update_routine_cron_expr_recomputes_next_fire reds every CI run in the 02:55-03:00Z window - #2370
Conversation
- add _clock seam to RoutineStore (defaults to time.time) - use frozen clock in test to avoid 02:55-03:00Z collision window
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesRoutine clock control
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_update_routine_cron_expr_recomputes_next_fire(store): | ||
| store._clock = staticmethod(lambda: 43200.0) |
There was a problem hiding this comment.
CRITICAL: store._clock = staticmethod(lambda: 43200.0) stores a staticmethod descriptor object as an instance attribute. When create_routine later calls self._clock(), CPython's instance-attribute lookup returns the raw __dict__ value without invoking the descriptor protocol (__get__), so the call receives the staticmethod wrapper itself — which is not callable — and raises TypeError: 'staticmethod' object is not callable.
The class-level _clock = staticmethod(time.time) is correct only when the class attribute itself is accessed (descriptor __get__ fires, returning the inner function). The test's instance-level assignment bypasses that mechanism entirely, so this test will fail at runtime.
Store a plain callable instead:
| store._clock = staticmethod(lambda: 43200.0) | |
| store._clock = lambda: 43200.0 |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
There was a problem hiding this comment.
Refuted on this repo's supported Pythons: staticmethod objects implement __call__ since Python 3.10 (bpo-43682), and requires-python here is >=3.11. The instance-attribute lookup does return the wrapper, but calling the wrapper directly works and forwards to the inner callable. Proven empirically: I ran the full file at head with wall-clock frozen to 02:57:30Z and got 27 passed - only possible if the instance override was exercised (the pre-fix base reds under the same frozen clock; fenced output in the PR body). A bare lambda would read cleaner, but there is no runtime defect; not worth a CI cycle. Resolving.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by step-3.7-flash · Input: 76K · Output: 7.3K · Cached: 177.3K |
|
nemotron-super review VERDICT: No blocking issues found. Automated first-pass review by the nemotron-super lane. The lead still reviews before merge. |
CARD TITLE (intent, not commit subject): Time-of-day flake: test_update_routine_cron_expr_recomputes_next_fire reds every CI run in the 02:55-03:00Z window
Autonomous build of board card tsk-kboqzh.
Files:
tests/projects/test_routines_store.py | 1 +
tinyagentos/projects/routines_store.py | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
Summary by CodeRabbit
Red proof at merge base (card demand: 02:57:30Z window)
Clock frozen at 2026-08-12T02:57:30Z (epoch 1786503450.0) via a pytest plugin monkeypatching
time.time; run at merge base7d38483e(pre-fix):Both
0 3 * * *and*/5 * * * *compute next_fire 1786503600.0 (03:00:00Z) inside the 02:55-03:00Z window, exactly the carded flake. Same frozen-clock run at PR headb2be024e: 27 passed in the full file — which also proves the_clockseam is live, since an inert seam would fail identically to base.