Skip to content
Updated Sep 12, 2026 by Barča Dvořáková · Owner: analysisactiveconceptgenericapi-a Edit on GitHub

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-info

The 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 route

Request 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_BRANCH and BUILD_TIME from the environment. It falls back to "unknown" for any missing value.
  • It executes a lightweight DB connectivity check (for example SELECT 1). It sets healthy = true if successful, false if 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 FieldSource / ValueNotes
commitHashprocess.env.GIT_COMMITFalls back to "unknown"
branchprocess.env.GIT_BRANCHFalls back to "unknown"
buildTimeprocess.env.BUILD_TIMEFalls back to "unknown"
healthyDB connectivity check resulttrue = 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"
}