A state machine that fails at run time is reported as passing (0.11.0 reported the failure)

未关闭
#2,358 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
cli, testing

调研方向

Start by tracing handleBehaviorRunError, which the issue says records the failure on the behavior and returns nil, then follow how explore outcomes and -advance consume that result. Reproduce with the supplied SysML model and CLI commands, comparing develop with v0.11.0. Done means run failures reach the outcome, JSON output, and nonzero exit status as expected.

由索引模型根据 Issue 内容生成。

描述

What happened, and what you expected instead

When a transition effect or an entry action fails at run time, the machine ends there and takes no further event, and the run is reported as passing: ✓, "status": "holds", proved over schedules, exit 0. The error appears only under -trace. v0.11.0 reported the failure and exited non-zero.

Same with division by zero in place of the index, with the failing assignment in an entry action, and under the default schedule (-instantiate E::sys -state … -advance 3: 0.11.0 prints advance failed: … and exits 2; develop prints ✓ Advanced to 3.0, Current state: <none>, exit 0).

Expected: the machine ending is fine; the failure of the machine -state names should reach the outcome, -json and the exit status, as it did in 0.11.0.

handleBehaviorRunError records the failure on the behavior and returns nil; I did not find where the explore outcome or -advance reads it back. Happy to send a patch if you say which shape you want.

Reproduction
$ sysml m.sysml -schedule "explore:runs=2,depth=200" -state "E::W::run E::sys.w" -advance 3

v0.11.0 (exit 1):
✗ explored E::W::run: 1 outcome (0 values, 1 error), 1 of 1 linearization failing
error: exhibited state machine run of object #4: process event: fire transition out of idle: transition effect: eval assignment RHS: index out of range: sequence index 1 is outside 1..0

v0.12.1 and develop (exit 0):
✓ explored E::W::run: 1 outcome
visits idle; this.isSolid = true; this.n = 0; this.xs = []
  standing: outcomes (proved over schedules: 1 linearization, inputs as written)

m.sysml:
package E {
  private import ScalarValues::*;
  private import SI::*;
  item def Ask;
  port def P { out item ask : Ask; }
  part def W { port p : ~P; attribute xs : Integer[0..*]; attribute n : Integer = 0;
    exhibit state run { entry; then idle; state idle;
      transition first idle accept Ask via p do action { assign n := n + xs#(1); } then idle; } }
  part def S { port a : P;
    exhibit state run { entry; then s0; state s0;
      transition first s0 accept after 1 [SI::s] do action { send new Ask() via a; } then s0; } }
  part sys { part s : S; part w : W; connect s.a to w.p; }
}
Version

v0.12.1-2309-g5797854cb (develop); also v0.12.1 release. v0.11.0 release reports the failure.

Surface

CLI (sysml)

Platform

Linux amd64

主要语言
Go
星标
59
派生
20
平均合并
10 小时 52 分钟
30 天内合并 PR
903

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Open-MBEE/OpenSysML 的其他 Issue

查看 Open-MBEE/OpenSysML 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。