Add settle_detector: settle decision as a pure seam over a churn series#389
Merged
Conversation
smart_waits.wait_until_screen_stable bakes the settle logic inside a time.sleep loop over live frames, so you can't feed it a recorded series or unit-test the decision. Extract it: given a stream of churn values, report when churn stayed <= max_churn for quiet_samples in a row (a spike resets the run). SettleTracker is the incremental form. Pure-stdlib, no clock, no capture.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 21 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要
新增
settle_point/is_settled/SettleTracker— 把「畫面是否安定」的決策抽成純接縫,作用於變化量序列。smart_waits.wait_until_screen_stable與actionability的穩定檢查把邏輯包在time.sleep輪詢迴圈、作用於即時像素幀——無法餵記錄好的序列,也無法獨立於擷取去單元測試決策。本功能接收一串變化量(每樣本變了多少:像素差 / 元素數差 / digest 0-1),在變化量連續
quiet_samples次維持 ≤max_churn時回報穩定;尖峰會重置 quiet run。純標準函式庫,確定性、可在注入序列上測試,不需擷取、不需時鐘。Qt-free。五層
utils/settle_detector/—SettleState、SettleTracker、settle_point、is_settled。AC_settle_point/ MCPac_settle_point/ Script Builder Settle Point (churn series)(Flow)。測試
test_settle_detector_batch.py— quiet run 後穩定、尖峰重置、永不穩定→None、is_settled 布林、SettleTracker 增量 + reset、wiring + facade。7 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。