Add postcondition: declarative expected-outcome specs for actions#381
Merged
Conversation
expect_poll/assert_eventually poll a single condition with no action-bound spec and no before-baseline, so they can't express 'a new dialog appeared'; trajectory_eval is whole-trajectory. Evaluate a small JSON spec of clauses (appears/disappears/enabled/disabled/text_present/text_absent/count) against the after-observation, diffed against the before-observation, returning a per-clause pass/fail report. compile_postcondition yields an after->bool predicate for expect_poll.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 60 |
| 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.



摘要
新增
check_postcondition/compile_postcondition— 以小型 JSON 規格斷言動作的預期畫面結果,對照 before 幀做差異。expect_poll/assert_eventually輪詢單一條件,沒有與動作綁定的後置條件規格,也不對照 before 基準(因此無法表達「一個新對話框出現了」);trajectory_eval是整條軌跡層級。本功能對 after 觀測(可選擇與 before 觀測做差異)評估子句規格——
appears/disappears(對照 before)、enabled/disabled、text_present/text_absent、count(equals/min)——回傳逐子句的通過 / 失敗報告。appears只有在元素於 after 出現且不在 before(確為新元素)時才成功。compile_postcondition把規格轉成after -> bool判定函式以供expect_poll搭配。純標準函式庫;規格為純 JSON 可帶入 action 檔 / MCP / 排程器。Qt-free。五層
utils/postcondition/—PostconditionReport、check_postcondition、compile_postcondition。je_auto_control匯出 +__all__。AC_check_postcondition({ok, clauses, failed})。ac_check_postcondition(read-only)。測試
test/unit_test/headless/test_postcondition_batch.py— 新對話框出現(對照 before)、已存在則 appears 失敗、disabled+text_present、count equals/min、disappears 需 before、未知子句乾淨失敗、compile 判定函式、wiring + facade。9 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。