Skip to content

chore(deps): bump go-flashduty to main — surface investigation target purpose - #223

Closed
flashduty[bot] wants to merge 1 commit into
mainfrom
feat/investigation-target-purpose
Closed

flashduty[bot] wants to merge 1 commit into
mainfrom
feat/investigation-target-purpose

Conversation

@flashduty

@flashduty flashduty Bot commented Oct 12, 2026

Copy link
Copy Markdown

问题

通过 CLI 写入告警规则时,investigation_targets[].purpose 会被静默丢弃(服务端 monit-webapi 支持该字段并会持久化)。

复现:

  1. 用 --data 提交一条带 investigation_targets[].purpose 的规则(create 或 update 均可);
  2. 请求返回 200;
  3. rule-v2-info 读回,target 只剩 kind / query(或 dashboard)/ time_range,purpose 不见了;
  4. 规则审计快照(rule-audit-detail)里同样没有 purpose —— 说明它在离开客户端之前就被裁掉了。

另外两条佐证(本地实测):

  • target 里塞一个未知字段:服务端对该类型是严格解码(收到未知字段应报 400),结果创建成功且未知字段消失 ⇒ 请求体在 CLI 侧就被裁成固定字段集;
  • purpose 里塞控制字符(服务端校验必然拒绝):创建依然成功 ⇒ 该字段根本没到服务端。

根因

CLI 的请求体由 SDK 类型反射生成(见 internal/cmd/cligen),而 go.mod 固定的 github.com/flashcatcloud/go-flashduty@v0.15.14 的模型里没有 Purpose 字段。该字段已在 SDK main 落地(flashcatcloud/go-flashduty#96 feat/investigation-target-purpose),但尚无新 tag,所以这里只能先 bump 到 main 的伪版本。

改动

  • go.mod / go.sum:go-flashduty v0.15.14 → v0.15.15-0.20261010142149-a2783aa8de6d
  • 重新生成:go run ./internal/cmd/cligen(39 services / 361 commands)
  • 生成产物随之新增 purpose 字段说明(zz_generated_alert_rules.go、zz_generated_response_help.go)

共 4 个文件、+16/−9。

验证

  • go build ./... 通过
  • make fmt 通过;make check-cards 通过(无需同步 skill 卡片)
  • go test ./...:仅 TestRootAutoUpdateCheckTimeoutWarnsAfterCommand 失败;把本次改动 stash 掉后在 main 原状下同样失败,属既有失败,与本次改动无关

后续

SDK 打 tag 之后可以把伪版本换成正式版本(go get github.com/flashcatcloud/go-flashduty@vX.Y.Z),无需其它改动。

@ysyneu

ysyneu commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Superseded: #224 already bumped go-flashduty to v0.15.15, which contains the investigation target purpose field, and regenerated the commands (released in v1.5.19). Merging this branch now would move the SDK back to an older pseudo-version. The silent drop of unknown --data fields described here is addressed in #225.

@ysyneu ysyneu closed this Oct 12, 2026
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