watchdog

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package watchdog 被动配对不变量监视(spec 2026-09-15-tool-identity-otel-guard-design P3):

生命周期: Stable(v0.33.0 定级)——只允许 additive 变更(新增导出符号 / 新增方法且给零值默认实现 / 新增错误值);改签名、改语义、改默认值、 删导出符号都算 breaking,判定规则与变更流程见 docs/api-compat.md, 逐包理由见 api-lifecycle.yaml。

订阅事件总线校验工具调用配对不变量——只告警,不裁决(热路径裁决在 IdentityGuard)。 INV1 环节收口仍有未执行声明 → reason=declared_not_executed; INV2 结果无对应声明(重复/幽灵结果)→ reason=unpaired_result。 spec §8 INV3(事件面 checksum 抽验)不实现:tool_result 事件载荷截断到 2000 字符, 无法重算 checksum——内容级校验由守卫在源头全量覆盖,此处不重复。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pub

type Pub func(sessionID, caseID string, stepID *uint64, typ, level string, payload map[string]any)

Pub 告警发布(与调度器 pub 同一落库广播路径:repo.InsertEvent + Bus.Broadcast)。

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher 配对不变量监视器。Run 单协程消费事件通道,无需加锁。

func New

func New(pub Pub) *Watcher

New 构造(pub 必填;nil 时告警静默丢弃——不阻塞事件流)。

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context, bus *eventbus.Bus)

Run 消费事件流直到 ctx 取消(main 装配期后台 goroutine)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL