Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Merge duplicate map keys in TestActionExecutionContractStaysAPIOwned

rcourtman744166731e07
diff --git a/internal/unifiedresources/code_standards_test.go b/internal/unifiedresources/code_standards_test.go
index f997fd58a4..6fb1e21e53 100644
--- a/internal/unifiedresources/code_standards_test.go
+++ b/internal/unifiedresources/code_standards_test.go
@@ -349,6 +349,10 @@ func TestResourceAPIExposesDedicatedFacetReads(t *testing.T) {
func TestActionExecutionContractStaysAPIOwned(t *testing.T) {
requiredSnippets := map[string][]string{
+ // Single map entry per file: Go map literals silently drop
+ // duplicate keys, so two entries for the same file would
+ // erase the first. Keeping all actions.go pins together
+ // guarantees every snippet actually runs.
filepath.Join(".", "actions.go"): {
"func BeginActionExecution(record ActionAuditRecord, actor string, now time.Time)",
"func CompleteActionExecution(record ActionAuditRecord, result *ExecutionResult, actor string, now time.Time)",
@@ -358,13 +362,20 @@ func TestActionExecutionContractStaysAPIOwned(t *testing.T) {
// at approval time. Pinning it here keeps the broker contract
// honest: drift refusal cannot silently turn into another error
// kind that callers fail to detect.
- "ErrActionPlanDrift = errors.New(",
+ "ErrActionPlanDrift = errors.New(",
// ErrResourceRemediationLocked is the canonical error returned
// when the operator has set NeverAutoRemediate=true on the
// target resource. Pin it here so the broker contract stays
// honest: per-resource lock refusal cannot silently turn into
// another error kind that callers fail to detect.
"ErrResourceRemediationLocked = errors.New(",
+ // ActionVerificationResult is the canonical post-execution
+ // read-after-write outcome carrier. The broker writes it onto
+ // ExecutionResult.Verification; pinning the type here keeps the
+ // shape stable across refactors so frontend audit surfaces and
+ // any other consumers can rely on it.
+ "type ActionVerificationResult struct",
+ "Verification *ActionVerificationResult `json:\"verification,omitempty\"`",
},
filepath.Join(".", "store.go"): {
"RecordActionExecutionStart(record ActionAuditRecord, event ActionLifecycleEvent) error",
@@ -383,15 +394,6 @@ func TestActionExecutionContractStaysAPIOwned(t *testing.T) {
"func RedactAuditText(s string) string",
"func RedactAuditRecord(record ActionAuditRecord) ActionAuditRecord",
},
- // ActionVerificationResult is the canonical post-execution
- // read-after-write outcome carrier. The broker writes it onto
- // ExecutionResult.Verification; pinning the type here keeps the
- // shape stable across refactors so frontend audit surfaces and
- // any other consumers can rely on it.
- filepath.Join(".", "actions.go"): {
- "type ActionVerificationResult struct",
- "Verification *ActionVerificationResult `json:\"verification,omitempty\"`",
- },
filepath.Join("..", "api", "actions.go"): {
"type ActionExecutor interface",
"func (h *ResourceHandlers) HandleExecuteAction(w http.ResponseWriter, r *http.Request)",