feat(api,sdk,cli): add unauthenticated version endpoint across the stack#1601
Draft
markturansky wants to merge 1 commit into
Draft
feat(api,sdk,cli): add unauthenticated version endpoint across the stack#1601markturansky wants to merge 1 commit into
markturansky wants to merge 1 commit into
Conversation
Adds GET /api/ambient/v1/version as a pre-auth middleware plugin so the endpoint is accessible without authentication. The server version and build time are injected via ldflags at build time and returned as JSON. The Go and Python SDKs expose standalone FetchServerVersion functions that require only a base URL (no token/project). The CLI version subcommand now shows both client and server versions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for cheerful-kitten-f556a0 canceled.
|
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
73f8028 to
d91baa9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/ambient/v1/versionas a pre-auth middleware plugin in ambient-api-server, returning{"version":"...","build_time":"..."}without requiring authenticationVersionandBuildTimeldflags targets inpkg/api/api.goand wires them through the Dockerfile build args (GIT_VERSION,BUILD_TIME)FetchServerVersion()standalone function to Go SDK (no auth required) andClient.ServerVersion()method (authenticated)fetch_server_version()to Python SDK (_version_api.py)acpctl versionto show both client and server versionFiles Changed
< /dev/null | File | Change |
|------|--------|
|
components/ambient-api-server/plugins/version/plugin.go| New pre-auth middleware plugin for/version||
components/ambient-api-server/pkg/api/api.go|VersionandBuildTimepackage variables ||
components/ambient-api-server/cmd/ambient-api-server/main.go| Side-effect import for version plugin ||
components/ambient-api-server/Dockerfile|ARG GIT_VERSION/BUILD_TIME+ ldflags injection ||
components/ambient-sdk/go-sdk/client/version_api.go|ServerVersiontype +FetchServerVersion()||
components/ambient-sdk/python-sdk/ambient_platform/_version_api.py|ServerVersiondataclass +fetch_server_version()||
components/ambient-cli/cmd/acpctl/version/cmd.go| Shows client + server version |Design Decisions
RegisterPreAuthMiddleware) instead ofRegisterRoutes— the version endpoint must be accessible without JWT/Bearer auth. The rh-trex-ai framework applies auth middleware at the router level to all routes registered viaRegisterRoutes.FetchServerVersion) alongside theClientmethod — allows CLI and other tools to check server version without constructing a full authenticated client.Test plan
go build ./...passes for api-server, SDK, and CLIgo vet ./...passes for all threegofmt -lreports no formatting issuesacpctl versionshows client version and gracefully handles unavailable serverGET /api/ambient/v1/versionreturns JSON without authdocker build --build-arg GIT_VERSION=v0.3.0 --build-arg BUILD_TIME=...🤖 Generated with Claude Code