Skip to content

feat(api,sdk,cli): add unauthenticated version endpoint across the stack#1601

Draft
markturansky wants to merge 1 commit into
mainfrom
feat/version-endpoint
Draft

feat(api,sdk,cli): add unauthenticated version endpoint across the stack#1601
markturansky wants to merge 1 commit into
mainfrom
feat/version-endpoint

Conversation

@markturansky
Copy link
Copy Markdown
Contributor

Summary

  • Adds GET /api/ambient/v1/version as a pre-auth middleware plugin in ambient-api-server, returning {"version":"...","build_time":"..."} without requiring authentication
  • Adds Version and BuildTime ldflags targets in pkg/api/api.go and wires them through the Dockerfile build args (GIT_VERSION, BUILD_TIME)
  • Adds FetchServerVersion() standalone function to Go SDK (no auth required) and Client.ServerVersion() method (authenticated)
  • Adds fetch_server_version() to Python SDK (_version_api.py)
  • Updates CLI acpctl version to show both client and server version

Files 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 | Version and BuildTime package 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 | ServerVersion type + FetchServerVersion() |
| components/ambient-sdk/python-sdk/ambient_platform/_version_api.py | ServerVersion dataclass + fetch_server_version() |
| components/ambient-cli/cmd/acpctl/version/cmd.go | Shows client + server version |

Design Decisions

  • Pre-auth middleware (RegisterPreAuthMiddleware) instead of RegisterRoutes — 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 via RegisterRoutes.
  • Standalone SDK function (FetchServerVersion) alongside the Client method — 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 CLI
  • go vet ./... passes for all three
  • gofmt -l reports no formatting issues
  • acpctl version shows client version and gracefully handles unavailable server
  • Deploy to cluster and verify GET /api/ambient/v1/version returns JSON without auth
  • Verify ldflags injection via docker build --build-arg GIT_VERSION=v0.3.0 --build-arg BUILD_TIME=...

🤖 Generated with Claude Code

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>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit d91baa9
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/6a0e6b27c096630008734277

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fc77548a-2639-4d50-87ca-11e4be2fadbf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-endpoint
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/version-endpoint

Comment @coderabbitai help to get the list of available commands and usage tips.

@jeremyeder jeremyeder force-pushed the feat/version-endpoint branch from 73f8028 to d91baa9 Compare May 21, 2026 02:17
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.

1 participant