feat: harden send preview idempotency

This commit is contained in:
zhaoyilun
2026-07-10 19:24:53 +08:00
parent 138615a29c
commit 93112d6d99
8 changed files with 482 additions and 22 deletions

View File

@@ -63,6 +63,7 @@ type smokeResult struct {
PacketLogDirConfiguredAfterRun bool `json:"packet_log_dir_configured_after_run"`
MsgLibConfigured bool `json:"msglib_configured"`
SendAuditPath string `json:"send_audit_path"`
SendIdempotencyPath string `json:"send_idempotency_path"`
}
func main() {
@@ -76,10 +77,18 @@ func run() error {
defer cancel()
clearRuntimeEnv()
auditPath := filepath.Join("runs", "capability-smoke", "send-preview.jsonl")
sendStateDir := filepath.Join("runs", "capability-smoke", fmt.Sprintf("state-%d", time.Now().UnixNano()))
if err := os.MkdirAll(sendStateDir, 0o755); err != nil {
return err
}
auditPath := filepath.Join(sendStateDir, "send-preview.jsonl")
if err := os.Setenv("ISPHERE_SEND_AUDIT_PATH", auditPath); err != nil {
return err
}
idempotencyPath := filepath.Join(sendStateDir, "send-idempotency.jsonl")
if err := os.Setenv("ISPHERE_SEND_IDEMPOTENCY_PATH", idempotencyPath); err != nil {
return err
}
session, cleanup, err := newSession(ctx, "isphere-capability-smoke")
if err != nil {
@@ -160,6 +169,7 @@ func run() error {
PacketLogDirConfiguredAfterRun: os.Getenv("ISPHERE_PACKET_LOG_DIR") != "",
MsgLibConfigured: false,
SendAuditPath: auditPath,
SendIdempotencyPath: idempotencyPath,
}
encoded, err := json.Marshal(result)
if err != nil {