Appearance
Git Info API — API Analysis (API-A)
Concept layer — frozen. The Git Info generic. Nothing here is written by a normal playbook run; a project's own feature analysis is the live document and takes every edit. This layer names no project and links to none — the dependency runs one way, from an application to its concept.
Feature: Git Info
Get Git Info
Endpoint:
text
GET /git-infoThe path carries no version prefix — this is an infrastructure diagnostic, not a versioned business API.
Request Headers
text
// No Authorization header required — the endpoint is declared a public routeRequest Body
None (GET request — no body).
Request Parameters
None.
Request Logic
- The guard reads the deployment's environment indicator (named by the project, not here). If it resolves to production, it throws a forbidden error immediately (illustrative — the project chooses whether a refusal is a 403, a 404 or a route that is not registered there; a 404 or an absent route leaks less than a 403 that confirms the endpoint exists).
- Otherwise it reads
GIT_COMMIT,GIT_BRANCHandBUILD_TIMEfrom the environment. It falls back to"unknown"for any missing value. - It executes a lightweight DB connectivity check (for example
SELECT 1). It setshealthy = trueif successful,falseif the query throws. - It returns the fixed four-field response.
No database tables are selected for the core response. The DB health check is a connectivity probe only.
Transactional operations: none. The DB health check is a read-only probe with no state mutation.
Success Response (200 OK)
json
{
"commitHash": "abc1234",
"branch": "feature/add-git-info",
"buildTime": "2025-06-20T10:00:00Z",
"healthy": true
}Note that this endpoint returns the four fields at the top level; it does not use the { data, status, message, requestId } success envelope that the other generic APIs use.
Response Data Mapping
| Response Field | Source / Value | Notes |
|---|---|---|
commitHash | process.env.GIT_COMMIT | Falls back to "unknown" |
branch | process.env.GIT_BRANCH | Falls back to "unknown" |
buildTime | process.env.BUILD_TIME | Falls back to "unknown" |
healthy | DB connectivity check result | true = reachable, false = unreachable |
Error Responses
403 Forbidden (production environment) — one refusal shape; see Request Logic for the others:
json
{
"status": 403,
"error": {
"code": "ERR_GIT_INFO_FORBIDDEN",
"message": "Build metadata is not available in this environment."
},
"requestId": "uuid"
}