Move current SQLite identity guards out of obsolete store

This commit is contained in:
2026-09-30 11:04:51 +08:00
parent 3d7189c33c
commit 43d89de0ed
4 changed files with 9 additions and 8 deletions
@@ -102,6 +102,7 @@
- Dispatcher 旧任务消费分支:删除 `task_runtime_v3`、`task_queue_v3`、`task_control_v3` 及其专属测试和仅依赖这些旧测试夹具的旧 Mock 恢复测试;当前 `CurrentRuntime`、`CurrentBootstrap`、`CurrentDiscoveryFollower` 和根命令隔离测试仍独立通过。
- Dispatcher 旧本地执行与控制分支:删除 `local_v01`、旧 Mock 呼叫/上传/恢复、旧路由与时间策略、旧 `Dispatcher`/lease 实现及依赖它们的测试;现行命令、任务消费、录音/结果链路的定向测试继续通过。
- Agent 会话共用边界:保留当前根命令使用的 `AgentCoordinator` 注册、状态探测、激活、最新会话授权和过期拒绝;移除仅供旧执行链路使用的 `ExecuteRaw`、旧控制、查询补偿与旧 SIP applied-config 核验及其测试。当前 SIP 门禁仍由现行加载回报与隔离测试校验,不冒充 Asterisk 实际加载;旧 MQ/Store 和其余契约尚待清理,不能将此批视为 P07 完成。
- SQLite 代码归属:当前 Store 所需的 SQLite 驱动和 Dispatcher 身份/命令冲突错误已从旧 Store 迁到当前入口,保留拒绝旧布局及外来 Dispatcher 抢占的原测试。旧 Store 与迁移文件尚未删除;此改动只移动源码定义,不读取、改写或清理现存业务数据。
## 验收台账
+8 -3
View File
@@ -11,13 +11,18 @@ import (
"strings"
"git.ipao.vip/rogee/go-sip/internal/configread"
_ "modernc.org/sqlite"
)
// CurrentStore is the authority for the new numeric-tenant task model. It
// deliberately refuses an old database instead of clearing or replaying data
// whose owner/message identity cannot be proved safe to convert.
// CurrentStore refuses an incompatible database instead of clearing or
// replaying data whose owner and message identity cannot be proved safe.
type CurrentStore struct{ db *sql.DB }
var (
ErrCommandConflict = errors.New("command id reused with different body")
ErrDispatcherIdentityMismatch = errors.New("database belongs to another dispatcher")
)
const currentSchema = `
CREATE TABLE IF NOT EXISTS dispatcher_state (
dispatcher_id TEXT PRIMARY KEY,
-3
View File
@@ -1,15 +1,12 @@
package store
import (
"errors"
"fmt"
"time"
"git.ipao.vip/rogee/go-sip/internal/tenant"
)
var ErrDispatcherIdentityMismatch = errors.New("database belongs to another dispatcher")
// DispatcherID returns the already-bound database identity, never a new identity.
func (s *Store) DispatcherID() (string, error) {
var id string
-2
View File
@@ -17,7 +17,6 @@ import (
"git.ipao.vip/rogee/go-sip/internal/contract"
"git.ipao.vip/rogee/go-sip/internal/mq"
"git.ipao.vip/rogee/go-sip/internal/tenant"
_ "modernc.org/sqlite"
)
//go:embed migrations/*.sql
@@ -25,7 +24,6 @@ var migrations embed.FS
var (
ErrDuplicateCommand = errors.New("duplicate command")
ErrCommandConflict = errors.New("command id reused with different body")
ErrNoCapacity = errors.New("quota capacity unavailable")
ErrCASConflict = errors.New("control revision conflict")
ErrLeaseHeld = errors.New("active lease held by another dispatcher")