package main import ( "io/fs" "os" "path/filepath" "strings" "testing" ) // R6-A AC8: nothing in the node-engine receives, orders or reconciles a whole declaration (novox/hq ADR 0539 §9, ADR // 0429 §8): no package subscribes to a node's declare subject or names the deleted symbols. func TestNoPackageHearsOrOrdersAWholeDeclaration(t *testing.T) { deleted := []string{ "DeclareSubject", "mesh.node.\" + node + \".declare", "ReconcileDue", "ReconcileEvery", "olderThanKept", "refuseOlder", "olderGeneration", "appliedGeneration", "reconcileKept", "reapplyKept", "adoptionWatch", "unsaidFile", "numbersFile", "func gather(", "func handleBody(", "Supersedes(", "ReportSequence", "RefusedOlder", "ReadsGeneration", "ReadsModules", "GenerationRefusal", "LeftOutModuleOf", } root := filepath.Join("..", "..") err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { if err != nil { return err } // The composition moved in from mesh-sdk (novox/hq ADR 0593 §7) has a node's input field of the same name, // ReadsModules, which says the node reads a module per resource; it is no reconciling of a declaration. if d.IsDir() && path == filepath.Join(root, "internal", "compose") { return filepath.SkipDir } if d.IsDir() || !strings.HasSuffix(path, ".go") || strings.HasSuffix(path, "nodeclare_test.go") { return nil } body, err := os.ReadFile(path) if err != nil { return err } for _, word := range deleted { if strings.Contains(string(body), word) { t.Errorf("%s still names %q", path, word) } } return nil }) if err != nil { t.Fatal(err) } }