Skip to content

Enrich ListRegistryEntries response with version metadata#754

Merged
rdimitrov merged 1 commit into
mainfrom
admin-registry-entries-richer-fields
Apr 24, 2026
Merged

Enrich ListRegistryEntries response with version metadata#754
rdimitrov merged 1 commit into
mainfrom
admin-registry-entries-richer-fields

Conversation

@rdimitrov
Copy link
Copy Markdown
Member

Summary

  • GET /v1/registries/{name}/entries now returns title, description, createdAt, updatedAt, and position alongside the existing entryType, name, version, and sourceName.
  • Brings this admin endpoint to parity (in terms of available per-version metadata) with GET /v1/sources/{name}/entries, which the admin UI already relies on for the corresponding sources view.
  • Response shape stays flat (one row per version). The endpoint is intentionally unshadowed — per .claude/rules/api.md §5 — so grouping stays a UI concern.

Why

The admin UI lists all entries of a registry and needs to render title + description per entry. Those fields live on entry_version and were already selected by ListEntriesBySource; ListEntriesByRegistry was the only path that dropped them. createdAt/updatedAt/position close remaining metadata gaps between the two admin endpoints.

The upstream v0.1 consumer endpoints (/registry/{name}/v0.1/servers, /x/dev.toolhive/skills) already return description via their spec-shaped payloads — they are unchanged.

Scope

  • database/queries/registry_entries.sql — extend ListEntriesByRegistry SELECT.
  • internal/db/sqlc/registry_entries.sql.go — regenerated.
  • internal/service/service.go — new fields on RegistryEntryInfo.
  • internal/service/db/impl_registry.go — map nullable columns, same pattern as impl_source.go.
  • internal/api/v1/routes_test.go — happy-path fixture + assertions cover the new fields.
  • docs/thv-registry-api/* — swagger regenerated.

/v1/sources/{name}/entries and SourceEntryInfo are untouched. position is only added to the registry endpoint — it's the source's priority within a given registry (registry_source.position) and has no meaning in the source-centric view.

Test plan

  • task lint-fix — clean
  • task test for internal/api/v1/... and internal/service/... — green (the only failure in the full task test run was an unrelated testcontainers/docker timeout in internal/sync/writer)
  • task docker-up-detached and hit the endpoint end-to-end:
    curl -s http://localhost:8080/v1/registries/default/entries
    
    Confirmed title, description, createdAt, updatedAt, position all populate from the seeded file source; /v1/sources/{name}/entries response shape unchanged.
  • Reviewer: sanity-check swagger diff (docs/thv-registry-api/swagger.yaml)

🤖 Generated with Claude Code

`GET /v1/registries/{name}/entries` returned only `(entryType, name,
version, sourceName)`. The admin UI that renders this view needs to
display the same per-version details available on
`GET /v1/sources/{name}/entries` — at minimum a human-readable title
and description.

Extend `ListEntriesByRegistry` to also select `v.title`,
`v.description`, `v.created_at`, `v.updated_at`, and expose them along
with `rs.position` (source priority within the registry) on
`RegistryEntryInfo`. Nullable columns map to empty strings via the
same pattern used in `impl_source.go`. The response shape stays flat
(one row per version) because this endpoint intentionally shows
cross-source rows unshadowed.

`/v1/sources/{name}/entries` and the upstream v0.1 consumer endpoints
are unchanged.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.57%. Comparing base (06cfce2) to head (7b9808f).

Files with missing lines Patch % Lines
internal/service/db/impl_registry.go 0.00% 11 Missing ⚠️
internal/db/sqlc/registry_entries.sql.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #754      +/-   ##
==========================================
+ Coverage   60.40%   60.57%   +0.16%     
==========================================
  Files         108      108              
  Lines       13041    10495    -2546     
==========================================
- Hits         7878     6357    -1521     
+ Misses       4610     3585    -1025     
  Partials      553      553              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@blkt blkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are sources ok?

@rdimitrov rdimitrov merged commit 27af469 into main Apr 24, 2026
15 checks passed
@rdimitrov rdimitrov deleted the admin-registry-entries-richer-fields branch April 24, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants