From 1f7bcd2803ec3e6a6cc3a1b7729b7422cb0d7d2e Mon Sep 17 00:00:00 2001 From: Boris Rybalkin Date: Thu, 4 Jun 2026 07:53:18 +0100 Subject: [PATCH] serve snap.yaml description in find/info responses The cache already parsed the snap.yaml description into App, but App.ToInfo dropped it and the Snap model had no description field, so snapd's /v2/find and /v2/snaps/info responses carried an empty description. The platform app page (and App Center) therefore showed no description for not-yet-installed apps, while installed apps - sourced from snapd's local /v2/snaps - did. Add description to the Snap model and populate it from App.ToInfo so the store relays the published snap.yaml description, which is the intended source now that apps no longer rely on the index-v2 catalog. Assert it end to end: store /v2/snaps/info and snapd-relayed /v2/find both carry the fixture snap.yaml description. --- model/app.go | 1 + model/app_test.go | 4 +++- model/snap.go | 1 + test/store_test.go | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/model/app.go b/model/app.go index 1fb6a8e..81e2983 100644 --- a/model/app.go +++ b/model/app.go @@ -27,6 +27,7 @@ func (a *App) ToInfo(version string, downloadSize int64, downloadSha384 string, SnapID: snapId.Id(), Name: a.Name, Summary: a.Summary, + Description: a.Description, Version: version, Type: appType, Architectures: []string{arch}, diff --git a/model/app_test.go b/model/app_test.go index 42ac3b1..c46546e 100644 --- a/model/app_test.go +++ b/model/app_test.go @@ -6,7 +6,7 @@ import ( ) func TestApp_ToInfo(t *testing.T) { - app := &App{Name: "name", Summary: "summary"} + app := &App{Name: "name", Summary: "summary", Description: "description"} info, err := app.ToInfo("1", 0, "sha", "url", "amd64", "icon-url") assert.NoError(t, err) assert.Equal(t, "name.1", info.SnapID) @@ -14,6 +14,8 @@ func TestApp_ToInfo(t *testing.T) { assert.Equal(t, "sha", info.Download.Sha3_384) assert.Equal(t, "url", info.Download.URL) assert.Equal(t, "app", info.Type) + assert.Equal(t, "summary", info.Summary) + assert.Equal(t, "description", info.Description) assert.Equal(t, "icon-url", info.Media[0].URL) } diff --git a/model/snap.go b/model/snap.go index f350873..1d88637 100644 --- a/model/snap.go +++ b/model/snap.go @@ -4,6 +4,7 @@ type Snap struct { SnapID string `json:"snap-id"` Name string `json:"name"` Summary string `json:"summary"` + Description string `json:"description"` Version string `json:"version"` Type string `json:"type"` Architectures []string `json:"architectures"` diff --git a/test/store_test.go b/test/store_test.go index c520c36..8c81294 100644 --- a/test/store_test.go +++ b/test/store_test.go @@ -183,6 +183,8 @@ func TestFind(t *testing.T) { assert.NoError(t, err, output) assert.Contains(t, output, "http://apps.s3:3902/v2/apps/stable/testapp1/icon.png", "snapd find must relay the store's absolute icon URL") + assert.Contains(t, output, "First test application for the integration suite", + "snapd find must relay the store's snap.yaml description") output, err = Ssh("device", "snap remove testapp1") assert.NoError(t, err, output) @@ -273,6 +275,7 @@ func TestRest_SnapsInfo(t *testing.T) { assert.Equal(t, 200, resp.StatusCode()) assert.Contains(t, string(resp.Body()), `"snap-id":"testapp1.1"`) assert.Contains(t, string(resp.Body()), `http://apps.s3:3902/v2/apps/stable/testapp1/icon.png`) + assert.Contains(t, string(resp.Body()), `"description":"First test application for the integration suite"`) } func snapArch() (string, error) {