#22112·meshery

[Server] Rewriting an SMI result silently retains the old payload

Author: maverickaayushCreated Sep 27, 2026Updated Sep 28, 2026

Description

SMIResultsPersister.WriteResult silently ignores a replacement payload when the supplied result ID already exists. This breaks the method's explicit update path and leaves stale SMI result data persisted.

Current Behavior

Writing {"meshName":"old"} and then {"meshName":"new"} with the same key succeeds both times, but the stored row still contains old.

Expected Behavior

When WriteResult takes its existing-row branch, it should persist the newly supplied result payload.

Steps to Reproduce

  1. Migrate SmiResultWithID in an in-memory database.
  2. Call WriteResult(id, oldPayload).
  3. Call WriteResult(id, newPayload) with the same ID.
  4. Read the row and observe that the old payload remains.

Evidence

$ go test ./server/models -run '^TestReproSMIWriteOverwritesExistingResult$' -count=1
second write was ignored: got mesh name "old", want new
FAIL

Root Cause

SMIResultsPersister.WriteResult loads the existing row into r and passes that unchanged row to UpdateResult. The incoming result bytes are only unmarshaled in the create branch.

Affected Components

  • Meshery Server
  • SMI result persistence
  • Local provider performance/conformance results

Validation

Executed on master commit 5b75615243e92b088b4ebf6e7bff82d6f60e5462:

go test ./server/models -run '^TestReproSMIWriteOverwritesExistingResult$' -count=1

Result: deterministic failure; the second payload is ignored.

Acceptance Criteria

  • Existing-row writes decode and persist the incoming payload.
  • The row ID remains the supplied key.
  • A regression test writes two distinct payloads under one key and reads the second.

References