Skip to content

fix: register discovery endpoint at /api/v1/discovery - #621

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-discovery-api-endpoint
Feb 11, 2026
Merged

fix: register discovery endpoint at /api/v1/discovery#621
hotlong merged 2 commits into
mainfrom
copilot/fix-discovery-api-endpoint

Conversation

CopilotAI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

GET /api/v1/discovery returned 404 because no route was registered at that path. Discovery was only reachable at /api/v1 (RestServer) and /.well-known/objectstack (DispatcherPlugin), but Studio UI and user expectations reference /api/v1/discovery.

Changes

  • packages/rest/src/rest-server.tsregisterDiscoveryEndpoints() now registers the shared handler at both basePath and ${basePath}/discovery
  • packages/runtime/src/dispatcher-plugin.ts — Added GET ${prefix}/discovery route alongside /.well-known/objectstack
  • packages/rest/src/rest.test.ts — Updated route assertions for the new /discovery path

Discovery endpoints after this change

PathProvider
/.well-known/objectstackDispatcherPlugin
/api/v1RestServer
/api/v1/discoveryRestServer + DispatcherPlugin

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel

vercelBot commented Feb 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
objectstack-playReadyReadyPreview, CommentFeb 11, 2026 1:32pm
specErrorErrorFeb 11, 2026 1:32pm

Request Review

…/api/v1
Both RestServer and DispatcherPlugin now register discovery at the
/discovery sub-path so that GET /api/v1/discovery returns the API
discovery payload alongside the existing /api/v1 and
/.well-known/objectstack endpoints.
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix discovery API endpoint access issuefix: register discovery endpoint at /api/v1/discoveryFeb 11, 2026
CopilotAI requested a review from hotlongFebruary 11, 2026 13:28
@hotlong
hotlong marked this pull request as ready for review February 11, 2026 13:33
CopilotAI review requested due to automatic review settings February 11, 2026 13:33
@hotlong
hotlong merged commit 8030ca6 into mainFeb 11, 2026
6 of 7 checks passed

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a missing route registration so GET /api/v1/discovery no longer returns 404, aligning runtime behavior with Studio UI and expected discovery URL conventions.

Changes:

  • Register the RestServer discovery handler on both /api/v1 and /api/v1/discovery.
  • Add a /api/v1/discovery discovery route in DispatcherPlugin alongside /.well-known/objectstack.
  • Update REST route assertion tests to expect the new discovery path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

FileDescription
packages/runtime/src/dispatcher-plugin.tsAdds GET ${prefix}/discovery route returning dispatcher discovery info.
packages/rest/src/rest-server.tsReuses a shared discovery handler and registers it at both basePath and ${basePath}/discovery.
packages/rest/src/rest.test.tsUpdates route assertions to include /api/v1/discovery and adjusts discovery-disable expectations.

Comment on lines +95 to +97
server.get(`${prefix}/discovery`, async (_req: any, res: any) => {
res.json({ data: dispatcher.getDiscoveryInfo(prefix) });
});

CopilotAIFeb 11, 2026

Copy link

Choose a reason for hiding this comment

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

The newly added ${prefix}/discovery route in createDispatcherPlugin isn't covered by tests. Since packages/runtime already has Vitest coverage for runtime/dispatcher behavior, please add a unit test that starts the plugin against a mocked IHttpServer and asserts the discovery route is registered (and, ideally, that it doesn’t conflict when @objectstack/rest is also present).

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +97
server.get(`${prefix}/discovery`, async (_req: any, res: any) => {
res.json({ data: dispatcher.getDiscoveryInfo(prefix) });
});

CopilotAIFeb 11, 2026

Copy link

Choose a reason for hiding this comment

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

createDispatcherPlugin now registers GET ${prefix}/discovery, but @objectstack/rest (RestServer) also registers GET /api/v1/discovery. In the default stacks (e.g. CLI serve and DevPlugin) both plugins are enabled, so this will double-register the same method/path on the same IHttpServer, which can cause route conflicts (some servers throw on duplicates, others have precedence rules) and can return a different payload shape than RestServer (Dispatcher returns HttpDispatcher.getDiscoveryInfo(...), RestServer returns protocol.getDiscovery()). Consider avoiding duplicate registration when com.objectstack.rest.api is present (e.g. via ctx.getKernel().getPlugins()), or make this handler delegate to the protocol discovery response to keep the payload consistent.

Copilot uses AI. Check for mistakes.
Sign up for freeto 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

@hotlong