[Server] Single SMI-result lookup queries a table that is never migrated
Description
The local provider can list persisted SMI results, but fetching one result by ID fails because the single-result path queries a different, unmigrated table.
Current Behavior
WriteResult stores rows as SmiResultWithID in smi_result_with_ids. GetResult declares a plain SmiResult, causing GORM to query smi_results; that table is not part of the system migrations. A request to GET /api/smi/results/{id} therefore fails even for a row that was just stored.
Expected Behavior
The single-result lookup should query the same model/table used by writes and list operations, returning the persisted result for its ID.
Steps to Reproduce
- Auto-migrate the current system database models.
- Persist an SMI result with
SMIResultsPersister.WriteResult. - Call
SMIResultsPersister.GetResultwith that same ID. - Observe the database error
no such table: smi_results.
Evidence
$ go test ./server/models -run '^TestReproSMIGetResultReadsPersistedTable$' -count=1
SELECT * FROM `smi_results` ...
no such table: smi_results
GetResult could not read the row WriteResult persisted
FAILRoot Cause
GetResult queries SmiResult, while WriteResult and the system migration use SmiResultWithID.
Affected Components
- Meshery Server
- SMI result persistence
GET /api/smi/results/{id}
Validation
Executed on master commit 5b75615243e92b088b4ebf6e7bff82d6f60e5462:
go test ./server/models -run '^TestReproSMIGetResultReadsPersistedTable$' -count=1Result: deterministic failure against SQLite with the current migrations; the lookup selects from an unmigrated table.
Acceptance Criteria
GetResultqueries the same persisted model/table asWriteResultandGetResults.- A just-written result is retrievable by ID.
- The returned JSON preserves the expected SMI result shape.
- A regression test covers write-then-get.
References
Source: meshery/meshery