Skip to content

Add settle_detector: settle decision as a pure seam over a churn series#389

Merged
JE-Chen merged 1 commit into
devfrom
feat/settle-detector-batch
Jun 23, 2026
Merged

Add settle_detector: settle decision as a pure seam over a churn series#389
JE-Chen merged 1 commit into
devfrom
feat/settle-detector-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 23, 2026

Copy link
Copy Markdown
Member

摘要

新增 settle_point / is_settled / SettleTracker — 把「畫面是否安定」的決策抽成純接縫,作用於變化量序列。smart_waits.wait_until_screen_stableactionability 的穩定檢查把邏輯包在 time.sleep 輪詢迴圈、作用於即時像素幀——無法餵記錄好的序列,也無法獨立於擷取去單元測試決策。

本功能接收一串變化量(每樣本變了多少:像素差 / 元素數差 / digest 0-1),在變化量連續 quiet_samples 次維持 ≤ max_churn 時回報穩定;尖峰會重置 quiet run。純標準函式庫,確定性、可在注入序列上測試,不需擷取、不需時鐘。Qt-free。

五層

  • 核心:utils/settle_detector/SettleStateSettleTrackersettle_pointis_settled
  • Facade / Executor AC_settle_point / MCP ac_settle_point / Script Builder Settle Point (churn series)(Flow)。
  • 文件:v175 EN + Zh + toctree。更新日誌:root EN + zh-TW + zh-CN。

測試

test_settle_detector_batch.py — quiet run 後穩定、尖峰重置、永不穩定→None、is_settled 布林、SettleTracker 增量 + reset、wiring + facade。7 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。

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.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 21 complexity · 0 duplication

Metric Results
Complexity 21
Duplication 0

View in Codacy

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.

@JE-Chen JE-Chen merged commit 61d68f2 into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/settle-detector-batch branch June 23, 2026 22:19
@sonarqubecloud

Copy link
Copy Markdown

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