Why: - Independent review found trusted-boundary, semantic parity, replay-budget, comparison, persistence, cancellation, provenance, and routing gaps. - Storage migration must include the new durable delivery table. Evidence: - go test -count=1 ./... - go test -race ./internal/docgen ./internal/tools ./internal/runmgr - go test ./... (deps/agent-document-renderer) - go vet ./... - go build ./... - CGO_ENABLED=0 go build -trimpath ./cmd/agent-system - Python house-style unittest suite and git diff --check Impact: - Word delivery now uses host-owned freezes, Markdown-first resumable persistence, closed registration boundaries, semantic shared rendering, and real comparison. - Controlled/project documents still fail closed to RDM and non-Word flows remain unchanged. Refs: - Unified Document Renderer implementation plan Task 10 - /tmp/task10-backend-review-last.md - Renderer d5cd8c126045a27d5a5cc5da23f64d3c737e116a
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package tools
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestLegacyHousestyleBuildCannotBeEnabledByEnvironment(t *testing.T) {
|
|
py, err := exec.LookPath("python3")
|
|
if err != nil {
|
|
t.Skip("python3 not available")
|
|
}
|
|
wd, err := os.Getwd()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
skill := filepath.Join(wd, "..", "skills", "recipes", "house-style")
|
|
if _, err := os.Stat(filepath.Join(skill, "housestyle", "build.py")); err != nil {
|
|
t.Skip("house-style skill is not in this checkout")
|
|
}
|
|
dir := t.TempDir()
|
|
src := filepath.Join(dir, "summary.md")
|
|
body := "# 摘要\n\n## 结论\n\n- 沙箱里可以直接生成 docx\n"
|
|
if err := os.WriteFile(src, []byte(body), 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cmd := exec.Command(py, "-m", "housestyle.build", src)
|
|
cmd.Dir = dir
|
|
cmd.Env = append(os.Environ(), "PYTHONPATH="+skill, "AGENT_SYSTEM_LEGACY_WORD_COMPARISON=1")
|
|
if out, err := cmd.CombinedOutput(); err == nil || !strings.Contains(string(out), "disabled") {
|
|
t.Fatalf("housestyle.build environment bypass: %v\n%s", err, out)
|
|
}
|
|
docx := filepath.Join(dir, "summary.docx")
|
|
if _, err := os.Stat(docx); !os.IsNotExist(err) {
|
|
t.Fatalf("disabled builder wrote %s: %v", docx, err)
|
|
}
|
|
}
|