Skip to content

feat(nats-auth-callout): expose GET /info endpoint - #711

Open
priyaselvaganesan wants to merge 1 commit into
mainfrom
feat/version-endpoint-nats-auth-callout
Open

feat(nats-auth-callout): expose GET /info endpoint#711
priyaselvaganesan wants to merge 1 commit into
mainfrom
feat/version-endpoint-nats-auth-callout

Conversation

@priyaselvaganesan

@priyaselvaganesan priyaselvaganesan commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Why

DGXC Ops and QA need a reliable way to identify the exact build of each deployed NVCF service. This adds a GET /info endpoint to nats-auth-callout returning service name, semver, and commit SHA stamped at build time.

What changed

  • Registers GET and all methods on /info via r.engine.Any("/info", gin.WrapH(golibversion.Handler())) in the existing gin router. The go-lib handler rejects non-GET with 405 and Allow: GET.
  • x_defs stamp Service (nvcf-nats-auth-callout-service), Version ({STABLE_VERSION}), and GitHash ({STABLE_GIT_COMMIT_FULL}) into the go-lib version package at link time, on the cmd go_binary alongside the existing internal/version stamp.
  • Adds go-lib v0.0.0-20260728185909-afca4ec2fb26 as a new direct dependency.
  • Tests cover GET returning 200 JSON with the three fields and non-GET returning 405 with Allow: GET.

Additional Details

/info returns:

{"service":"nvcf-nats-auth-callout-service","version":"<semver>","commit":"<full-40-char-sha>"}

service, version, and commit are injected via Bazel x_defs at build time. Unknown fallbacks apply for unstamped builds.

Customer Release Notes

Not customer visible.

Plan Summary

Not applicable.

Usage

Not applicable.

Testing

Built a stamped image from the repo root with bazel build //src/control-plane-services/nats-auth-callout/cmd/nvcf-nats-auth-callout-service:image.tar --stamp and verified the binary embeds the expected service name, version, and full commit SHA. Unit tests pass with go test ./....

Notes

This is one of several Phase 1 Go service /info PRs. Pattern follows merged go-lib handler (#270), helm-reval (#275), and grpc-proxy (#610). Each service PR is independent.

References

POR: https://docs.google.com/document/d/1XigTpFIMVfkR-RgwdF7urquq8YxGYDEVamsrJNJwC-U

Issues

Relates to #315

Related Pull Requests

Dependencies

Adds go-lib v0.0.0-20260728185909-afca4ec2fb26 (Apache-2.0, same module as this repo). Go MVS pulls otel and related transitive deps forward.

Summary by CodeRabbit

  • New Features

    • Added an /info endpoint that reports the service name, version, and commit information.
    • The endpoint supports GET requests and clearly rejects unsupported methods with an appropriate response.
  • Bug Fixes

    • Improved method handling for /info, including the correct Allow: GET response header.
  • Tests

    • Added coverage for successful responses, metadata fields, content type, and unsupported HTTP methods.

Signed-off-by: priyaselvaganesan <pselvaganesa@nvidia.com>
@priyaselvaganesan
priyaselvaganesan requested a review from a team as a code owner August 6, 2026 19:04
@priyaselvaganesan
priyaselvaganesan requested review from along-2017 and balajinvda and removed request for along-2017 August 6, 2026 19:04
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The NATS auth callout service now exposes a version-backed /info endpoint. Build stamping supplies service, release, and commit metadata. Tests verify GET responses and non-GET rejection behavior.

Changes

NATS auth callout service info endpoint

Layer / File(s) Summary
Build metadata and module wiring
src/control-plane-services/nats-auth-callout/cmd/.../BUILD.bazel, src/control-plane-services/nats-auth-callout/go.mod
Build stamping defines the service name, release version, and Git commit. Go dependencies include the shared library and updated module versions.
Info route registration
src/control-plane-services/nats-auth-callout/internal/router/router.go, src/control-plane-services/nats-auth-callout/internal/router/BUILD.bazel
The router registers /info with the shared version handler and updates its Bazel dependencies.
Info endpoint validation
src/control-plane-services/nats-auth-callout/internal/router/info_test.go, src/control-plane-services/nats-auth-callout/internal/router/BUILD.bazel
Tests verify JSON metadata for GET and 405, Allow: GET, and empty bodies for POST, PUT, and DELETE.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Router
  participant golibversion
  Client->>Router: Request /info
  Router->>golibversion: Serve version metadata
  golibversion-->>Router: JSON response or 405 with Allow: GET
  Router-->>Client: HTTP response
Loading

Possibly related PRs

  • NVIDIA/nvcf#555: Adds related agent API routing and service-version instrumentation.
  • NVIDIA/nvcf#591: Adds a shared version-backed GET /info endpoint with matching method handling.
  • NVIDIA/nvcf#610: Adds the shared /info endpoint, build metadata, and method-validation tests.

Suggested reviewers: along-2017

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes the new customer-facing GET /info endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/version-endpoint-nats-auth-callout

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/control-plane-services/nats-auth-callout/internal/router/info_test.go (1)

44-50: 🗄️ Data Integrity & Integration | 🔵 Trivial | 🏗️ Heavy lift

Assert the stamped metadata values.

The test accepts fallback values such as "unknown". A missing or miswired x_defs value can therefore pass. This does not verify the service name, semantic version, or full commit SHA returned by /info.

Add a stamped test with controlled values or an injectable handler, then assert the exact service, version, and commit fields. Keep this test for fallback behavior only if that behavior is also required.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/control-plane-services/nats-auth-callout/internal/router/info_test.go`
around lines 44 - 50, Update the /info test around the response unmarshalling to
inject controlled metadata values and assert exact service, version, and commit
values instead of only checking non-empty fields. Use the existing handler or
configuration injection point visible in the router tests, and retain the
fallback assertion only if fallback behavior is separately required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/control-plane-services/nats-auth-callout/go.mod`:
- Line 111: Align the google.golang.org/grpc v1.80.0 requirement with its
replacement: either change the required version to v1.79.3 and document why the
replacement is intentional, or remove the replacement so v1.80.0 is used
directly.

---

Nitpick comments:
In `@src/control-plane-services/nats-auth-callout/internal/router/info_test.go`:
- Around line 44-50: Update the /info test around the response unmarshalling to
inject controlled metadata values and assert exact service, version, and commit
values instead of only checking non-empty fields. Use the existing handler or
configuration injection point visible in the router tests, and retain the
fallback assertion only if fallback behavior is separately required.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 45aa28a4-ea93-435e-a10c-161224c073c5

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb0cde and eeddb44.

⛔ Files ignored due to path filters (1)
  • src/control-plane-services/nats-auth-callout/go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • src/control-plane-services/nats-auth-callout/cmd/nvcf-nats-auth-callout-service/BUILD.bazel
  • src/control-plane-services/nats-auth-callout/go.mod
  • src/control-plane-services/nats-auth-callout/internal/router/BUILD.bazel
  • src/control-plane-services/nats-auth-callout/internal/router/info_test.go
  • src/control-plane-services/nats-auth-callout/internal/router/router.go

golang.org/x/tools v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/grpc v1.80.0 // indirect

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

cd src/control-plane-services/nats-auth-callout
rg -n 'google\.golang\.org/grpc|^replace ' go.mod
go list -m all | rg '^google\.golang\.org/grpc'

Repository: NVIDIA/nvcf

Length of output: 384


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- guidance files ---'
find .. -name AGENTS.md -print

printf '%s\n' '--- go.mod context ---'
sed -n '84,125p' src/control-plane-services/nats-auth-callout/go.mod

printf '%s\n' '--- replacement references ---'
rg -n -C 3 'google\.golang\.org/grpc|v1\.79\.3|v1\.80\.0' \
  src/control-plane-services/nats-auth-callout \
  --glob '!vendor/**' \
  --glob '!go.sum'

printf '%s\n' '--- changed-file summary ---'
git diff --stat -- src/control-plane-services/nats-auth-callout/go.mod
git diff -- src/control-plane-services/nats-auth-callout/go.mod

Repository: NVIDIA/nvcf

Length of output: 5842


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

cat src/control-plane-services/nats-auth-callout/AGENTS.md
printf '%s\n' '--- repository status ---'
git status --short -- src/control-plane-services/nats-auth-callout/go.mod
printf '%s\n' '--- module and toolchain declarations ---'
sed -n '1,35p' src/control-plane-services/nats-auth-callout/go.mod
printf '%s\n' '--- replacement-related history summary ---'
git log -5 --oneline -- src/control-plane-services/nats-auth-callout/go.mod

Repository: NVIDIA/nvcf

Length of output: 3697


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- commits that introduced or changed the replacement ---'
git log --oneline -S 'replace google.golang.org/grpc' -- src/control-plane-services/nats-auth-callout/go.mod

printf '%s\n' '--- dependency-change commit details ---'
for commit in $(git log --format='%H' -S 'replace google.golang.org/grpc' -- src/control-plane-services/nats-auth-callout/go.mod | head -3); do
  git show --format=fuller --stat --no-renames "$commit" -- src/control-plane-services/nats-auth-callout/go.mod
  git show --format= --no-ext-diff --unified=12 "$commit" -- src/control-plane-services/nats-auth-callout/go.mod
done

Repository: NVIDIA/nvcf

Length of output: 6642


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- current commit ---'
git log -1 --format='%H%n%s'

printf '%s\n' '--- gRPC changes in the current commit ---'
git show --format= --no-ext-diff --unified=8 HEAD -- \
  src/control-plane-services/nats-auth-callout/go.mod |
  rg -n -C 8 'google\.golang\.org/grpc|^[-+].*grpc|^[-+]replace ' || true

Repository: NVIDIA/nvcf

Length of output: 3400


Align the gRPC requirement with the replacement.

This change selects google.golang.org/grpc v1.80.0 but still replaces it with v1.79.3. If v1.79.3 is intentional, align the requirement and document the reason. Otherwise, remove the replacement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/control-plane-services/nats-auth-callout/go.mod` at line 111, Align the
google.golang.org/grpc v1.80.0 requirement with its replacement: either change
the required version to v1.79.3 and document why the replacement is intentional,
or remove the replacement so v1.80.0 is used directly.

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