[Server] Rewriting an SMI result silently retains the old payload
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
- Migrate
SmiResultWithIDin an in-memory database. - Call
WriteResult(id, oldPayload). - Call
WriteResult(id, newPayload)with the same ID. - 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
FAILRoot 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=1Result: 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
Source: meshery/meshery