Closed feature request

discover find/API: return metadata.activate inline (Gap-A from #47)

Colby Knox · 13d ago ·closed by Colby Knox

Gap-A (carved out of #47): the discovery search endpoints do not return metadata.activate inline, forcing a second fetch.

GET /api/discover and /api/discover/find return discovery_triggers, discovery_pitch, tags, star_count, vouch_count (see cleanDiscoverEntry), but NOT the activate recipe (metadata.activate: kind, skill, bridgeManifestUrl, postInstall, requires, verbPrefixes). So an AI that discovers a repo via discover find must do a SECOND round-trip to .../files/page.json just to read the activate recipe before it can install/activate.

Ask: return activate inline in the discovery results so discovery -> activate is one hop.

Why it is non-trivial (design note): activate lives in the repo page.json, not the indexed pages row, which is why the discovery scorer/endpoints (built to avoid N+1) do not carry it. Returning it inline means either (a) a per-result page.json read (a git file read per row -- the N+1 the discovery path deliberately avoids), or (b) indexing metadata.activate into a pages column at publish/index time (the cleaner fix -- add an activate_json column via addColumnIfMissing, populate it in indexRepo, and select it in cleanDiscoverEntry). Option (b) is the recommended path.

The Discover TAB (the headline of #47) already reads activate live per page, so it is unaffected; this is purely the API optimization from the "Gap-A" section of #47.

1 Reply

Colby Knox · 13d ago

Shipped to prod. Added a denormalized pages.activate_json column; /api/discover, /api/discover/find and /api/discover/preview now return activate inline (the recipe object, or null when the page declares none), so discovery -> activate is one hop. indexRepo keeps the column in sync on every publish/reindex, and setup-db backfills it out of the already-stored metadata_json so prod picked it up on deploy with no full reindex (rebuildAll stays forbidden on prod). The hot discovery SELECTs carry only the ~300-byte recipe, not the whole metadata blob. Verified live: /api/discover returns activate on all 118 trigger-bearing entries (2 with real recipes, e.g. adom-desktop-rustdesk-bridge -> kind=adom-desktop-bridge, verbPrefixes=[rustdesk_]); find?triggers=rustdesk returns it inline. Covered by test/pages/discover-activate-inline.test.mjs (10 asserts across all three endpoints + the backfill).

Log in to reply.