Troubleshooting

Troubleshoot versioned api contracts — Sustainable Catalyst Platform Core

Troubleshoot versioned api contracts — Sustainable Catalyst Platform Core Application: Sustainable Catalyst Platform Core Status: Useful first draft, not a production-verified procedure. Typical symptoms Versioned API contracts fa

ProductSustainable Catalyst Platform CoreUpdatedNovember 20, 2026Reading time22 minutes

Application: Sustainable Catalyst Platform Core
Component: API Contracts & Developer Integration
Source baseline: 59b8444365525a58fd4f6a7e29a20d712769e1a2 (repository main, November 7, 2026)
Verification status: Source-inspected; deployed acceptance pending
Estimated reading time: 16–19 minutes

Summary: Diagnose requests that begin failing after an API release, or that continue returning HTTP success while their fields, meaning, authentication scope, or error behavior change. Preserve the last accepted contract and distinguish public API routes, internal product routes, gateway proxy responses, and standards-native documents before attempting a fix.

Goal

Establish whether a failing client observed (a) an incompatible server change, (b) a client or SDK defect, (c) an expected authentication or quota rejection, (d) an upstream gateway failure, or (e) a semantic change to research information. Primary acceptance: the same authorized synthetic client either receives the contractually compatible response or detects and explicitly rejects the incompatible upgrade. A successful HTTP status alone does not satisfy this test.

Requirements

  • An authorized disposable staging environment, pinned repository commit and deployed image/release identifier; never infer the live build solely from the GitHub default branch.
  • A known-good contract manifest, representative sanitized request/response fixtures, client SDK version and exact endpoint and method under test.
  • Credentials from an approved secret store or temporary environment variables; do not paste tokens into article text, command history, CI logs, issue comments or screenshots.
  • Explicit route ownership and visibility rules, including data-use and provenance constraints for scientific material.
  • Permission to test authentication failures with test credentials. Never issue destructive retries, migrations or publication writes as a troubleshooting shortcut.

1. Identify the API surface before debugging

Surface Observed source boundary Common false assumption
/api/v1/* Unified public API; developer credential middleware, route scopes, public envelope on many routes. All failures and all responses share one JSON shape.
/v1/* Internal/first-party APIs; route-specific dependencies and responses. Public bearer token or public version header applies to every internal endpoint.
/api/v1/gateway/* Public gateway wraps JSON upstream responses and may pass through non-JSON content. The gateway response body always matches a direct product response.
/api/v1/stac*, GeoJSON Standards-native documents may deliberately omit the Catalyst envelope. Absence of data/meta is necessarily a regression.
/public/v1/* Separate source-contract public routes exist for some provider/runtime modules. These are automatically governed by the /api/v1 public credential middleware.

Platform Core documents /api/v1 as the public major-version path; existing /v1 routes remain available for internal integration. A change that breaks the public contract requires a deliberate new major path. Do not treat a product release number (for example, 4.21.0) as interchangeable with the public API major version (v1). Source: Unified Public API contract.

2. Verify version headers and request identifiers

For normal requests handled by the public middleware, the source writes X-SC-API-Version: 1 and X-Request-ID. The usual JSON envelope includes meta.api_version: "v1" and a matching request ID. This is the baseline a client should assert, not merely display. Known exception: early middleware returns when the public API is disabled (404) or the production request-log salt is missing (503) include the request-ID header but return before the version header is set; classify these as configuration failures, not automatically as a v2 upgrade.

{
  "data": {"service": "synthetic-platform-core", "version": "4.21.0", "status": "operational"},
  "meta": {"api_version": "v1", "request_id": "synthetic-001", "documentation": "/developers"}
}

Illustrative synthetic response, not a captured live response. Inspect public API middleware and public status route for the actual fields.

3. Use the correct failure taxonomy

HTTP/condition Interpretation and first check Recovery boundary
400 Gateway path rejected or malformed request. Correct path or request; do not retry unmodified.
401 Missing/invalid/revoked public credential or invalid internal write key. Check approved credential and endpoint family; do not weaken authentication.
403 Missing scope, inactive developer application/plan, disabled public reads, or a route-specific denial. Confirm principal and required scope; not an availability outage.
404 Missing/nonpublic resource, disabled public API, or absent route. Check release and visibility without enumerating private objects.
405 or 413 Gateway method disallowed or request exceeds size bound. Use documented method or reduce request size.
422 FastAPI validation error or incompatible required input. Compare field names, types, bounds and schema; never blindly coerce.
429 Minute/daily quota exceeded; Retry-After provided by inspected public middleware. Respect delay and plan; avoid parallel retry storms.
502/504 Gateway upstream/network error, oversized response or timeout. Inspect gateway health/correlation; do not replay non-idempotent writes.
503 Disabled service, missing security setup, circuit breaker or unavailable dependency. Determine source of 503; restore configuration or dependency before retry.
200 with invalid fields Silent schema/semantic drift or application-level ok:false. Validate content and domain invariants before accepting.

Error bodies are not universally identical: public authentication/validation responses often contain detail (a string or validation array), while gateway errors may use data: null, a meta object and warnings. Source: auth middleware, gateway response handlers.

Procedure

4. Capture a sanitized, reproducible request

Run the following against an operator-approved staging address using a test credential. It performs one read-only request. It does not disable TLS verification, follow redirects or log the bearer token to the response capture.

set -euo pipefail
: "${SC_CORE_URL:?Set an authorized staging base URL}"
: "${SC_PUBLIC_API_KEY:?Set a temporary staging public API key}"
OUT="$(mktemp -d)"; chmod 700 "$OUT"
STATUS="$(curl --silent --show-error   --connect-timeout 5 --max-time 20   --header "Authorization: Bearer ${SC_PUBLIC_API_KEY}"   --header 'Accept: application/json'   --header 'X-Request-ID: kb-contract-staging-001'   --dump-header "$OUT/headers.txt"   --output "$OUT/body.json"   --write-out '%{http_code}'   "${SC_CORE_URL%/}/api/v1/status")"
printf 'HTTP status: %s\nEvidence directory: %s\n' "$STATUS" "$OUT"
# Review/redact the files locally. Do not paste raw private responses in tickets.

Retain the method, route, UTC timestamp, deployed image or commit, HTTP status, content type, version header, request ID, authorized test principal, schema/SDK version and sanitized response. Record the exact bytes and hash only if permitted by rights and data classification. Do not send secret-bearing request headers into an incident ticket.

5. Check the response structure before parsing the domain object

A tolerant client may accept explicitly documented additive fields, but it must reject a removed required field, changed type, unrecognized contract major, or altered unit/meaning. Treat the standards-native STAC and GeoJSON exceptions separately. If the endpoint is through the gateway, record both the Core response status and the meta.upstream_status where available.

# Minimal consumer guard for a standard public-envelope route.
def require_public_v1(status, headers, payload):
    if status != 200:
        raise RuntimeError(f"Request failed: HTTP {status}")
    h = {k.lower(): v for k, v in headers.items()}
    if h.get("x-sc-api-version") != "1":
        raise ValueError("Unexpected public contract major")
    if not isinstance(payload, dict) or not isinstance(payload.get("meta"), dict):
        raise ValueError("Missing public API envelope")
    if payload["meta"].get("api_version") != "v1":
        raise ValueError("Unexpected payload major")
    if payload["meta"].get("request_id") != h.get("x-request-id"):
        raise ValueError("Request identity mismatch")
    return payload["data"]

# Do not apply this envelope guard to STAC/GeoJSON raw documents.

6. Reproduce with direct HTTP and both client SDKs

Test the same stable, read-only endpoint with direct HTTP, the pinned Python public SDK, and the pinned JavaScript public SDK. Compare URL, request headers, status, body parsing and error handling. The SDK convenience request() methods normally return the data field rather than full response metadata; use request_raw() in Python or requestRaw() in JavaScript when the diagnostic needs the complete envelope. For headers, direct HTTP inspection remains necessary.

Inspect a source-level JavaScript compatibility candidate before declaring a deployed failure: the pinned index.mjs contains helper methods that call this.get(...), but its main client class shows request(...) and requestRaw(...) rather than an implemented get method. Some helper paths also include /api/v1 although request() prepends that prefix. A staging runtime smoke test must establish whether an installed bundle exhibits either issue; do not automatically generalize to all SDK releases.

# Optional static check against an authorized local checkout; does not call any service.
node tools/check_js_sdk.mjs   /path/to/sustainable-catalyst-platform-core/backend/public_sdk/javascript/index.mjs
# An exit code of 1 indicates a potential source-level SDK compatibility issue.
# Inspect the exact installed bundle before treating it as a deployed defect.

7. Separate version drift from expected authentication failures

Use synthetic keys or test identities to verify 401 for an absent/invalid key, 403 for insufficient scope, 429 for a bounded rate-limit scenario, and a private-resource 404 where the relevant public route promises nondisclosure. Ensure response bodies disclose no private record. Do not probe arbitrary accounts or publicly accessible production objects.

8. Investigate downstream version mismatch through gateway health

The service gateway can compare an upstream-reported version with a configured expected prefix and report version_mismatch or version_unreported. This is a health signal, not proof that every response schema is compatible. Record service ID, the expected prefix, observed upstream version, Core version, request ID, status and latency. A downstream timeout can appear as 504, and a transport failure as 502; do not misdiagnose either as a new public major version.

9. Detect silent semantic changes

Scientific compatibility includes meaning, not only parseability. Record units (for example, t CO₂ versus t C), coordinate reference systems, observation versus retrieval time, temporal aggregation, rounding, baseline definitions, uncertainty fields, missing-value handling and provenance links. A renamed or reinterpreted measurement may require migration even if the JSON field type is unchanged. Verify against a fixed, rights-cleared scientific fixture and retain its source version and method reference.

10. Compare releases using a conservative manifest

The companion checker illustrates how to fail a release when existing consumers lose a route, required response field, agreed scope, version header or documented error case, or acquire a new required request field. Its synthetic manifest also treats explicitly tracked semantic changes as breaking. This checker is a teaching/acceptance aid, not a replacement for generated OpenAPI diffs, schema validators, release approvals or deployed end-to-end tests.

python3 tools/check_api_contract.py compare   fixtures/baseline_manifest.json fixtures/additive_candidate.json
# Expected: PASS, 0 findings.

python3 tools/check_api_contract.py compare   fixtures/baseline_manifest.json fixtures/breaking_candidate.json
# Expected: FAIL with findings; exit status 1 is intentional.

python3 tools/check_api_contract.py inspect   fixtures/baseline_manifest.json fixtures/status_success.json
# Expected: PASS for this synthetic response.

Symptoms

Symptom Likely classification First discriminating test
Client suddenly receives 401 Credential absent, revoked or wrong API family. Compare target prefix and test credential state.
Client receives 403 after upgrade Scope or application/plan authorization change. Compare required scope and test app grant.
New release parses but outputs unexpected values Semantic change or incorrect normalization. Compare source-based scientific fixture and units.
Gateway health reports version_mismatch Downstream version-prefix divergence. Inspect expected prefix and upstream health metadata.
Valid response lacks meta.data or envelope Raw STAC/GeoJSON or wrong response handler. Check documented response media type before fixing client.
SDK helper throws a method error Potential helper implementation defect. Compare direct HTTP and the precise installed SDK method.
API returns 429 with Retry-After Capacity/quota response, not schema break. Respect delay; inspect application plan.
404/503 lacks version header Possible early public-middleware exit. Check disabled API and request-log salt readiness.

Cause

An apparent contract failure commonly arises at one of five boundaries: (1) endpoint family or method mismatch; (2) token, scope, rate limit or service configuration; (3) server serializer, validation schema or error handler; (4) gateway/upstream version divergence; or (5) SDK assumptions or scientific semantics. Identify the boundary with the smallest authorized read-only reproduction before modifying code or configuration.

Troubleshooting

  1. Pin: Capture the deployed Core build, SDK package digest and exact request. GitHub main alone does not identify a deployed artifact.
  2. Classify: Determine whether the route is /api/v1, internal /v1, gateway proxy, or standards-native API.
  3. Observe: Capture only nonsecret status, version, request ID, content type and sanitized response.
  4. Compare: Diff against a last-known-good contract for fields, types, scopes, error cases, response kind and semantics.
  5. Isolate: Repeat with direct HTTP before blaming the SDK, and with the exact installed SDK before blaming the server.
  6. Verify negatives: Missing credentials, wrong scopes, missing resources, invalid schemas, quota controls and disabled dependencies must return typed failures without private content.
  7. Contain: On a breaking change, stop publication/export and unsafe replay; preserve accepted state and diagnostics.

Resolution

Confirmed cause Safe resolution Required follow-up
Client route prefix or method is wrong Correct the client to the documented endpoint and method. Regression test both old supported and new clients.
Breaking field, scope, status or meaning change in /api/v1 Restore backward-compatible behavior or plan a parallel major-version rollout. Migration note, compatibility tests, consumer sign-off.
Wrong error parser Normalize error handling by endpoint family; preserve actual HTTP status and request ID. Run negative tests for detail/gateway warnings/raw response.
Downstream service version mismatch Re-align expected version and deployed service only after verifying compatibility. Gateway health plus direct product tests.
JavaScript helper method/path issue Patch the helper against the client’s supported request method/path rules. Unit and runtime tests against the packaged SDK.
Semantic scientific regression Restore prior calculation semantics or migrate downstream derived results with an explicit method version. Reproducibility comparison, lineage preservation, scientific review.

For rollback, recover a verified release artifact and compatible database state through the approved deployment process. Do not assume a Core recovery checkpoint is a database backup: the production certification documentation explicitly distinguishes checkpoint metadata from operator-managed backups. Preserve scientific evidence, audit events and migration receipts before any restore.

Verification

Accept a release only when both automated contract checks and authenticated staging behavior agree. A clean offline fixture demonstrates only checker consistency. A passing health endpoint demonstrates only health criteria. Neither establishes that all clients, downstream services, or scientific calculations are correct.

Case Input or actor Pass condition
Public version identity Authorized read-only test client Expected /api/v1, X-SC-API-Version: 1 and matching response request ID.
Public envelope GET /api/v1/status Required data/meta values and types; expected service semantics.
Standards exception STAC or GeoJSON route Valid standards-native document; no false missing-envelope alert.
Missing/revoked credential Disposable invalid key Expected 401, no private data.
Insufficient scope Valid test key, wrong scope Expected 403 or route-documented denial; no private data.
Validation failure Malformed bounded test input Expected 422; no persistent state change.
Rate limit Controlled disposable plan Expected 429, positive Retry-After.
Gateway upstream failure Synthetic disconnected downstream Expected mapped gateway error; request ID retained, sensitive upstream errors masked.
Schema regression Alter required field or media type Checker fails and prevents release.
Semantic regression Same type, altered units/time interpretation Scientific fixture fails and points to changed meaning.
SDK consistency Python/JS direct comparisons Both route correctly and either parse contract or fail explicitly.
Rollback Disposable staging rehearsal Prior accepted contract restored; evidence and migration logs retained.

11. Retain a minimal evidence and change-control packet

  • Incident or test ID, UTC timestamps, affected route/method, owner and service, affected consumers and last-known-good contract.
  • Deployed image digest and commit; expected/actual public major, gateway upstream version and SDK package version.
  • Sanitized response evidence, correlation ID, expected/actual error status, reason and response shape; no raw bearer tokens.
  • Contract diff and scientific semantic diff, explicit accepted risks, documented exclusions and developer/reviewer sign-off.
  • CI command and test output, approved staging probe, rollback rehearsal, restore artifact fingerprint, and release decision.

12. Known limits and non-goals

This guide does not claim an organization-wide uniform error schema, production configuration of all API paths, end-to-end version negotiation, automatically generated breaking-change gates, or a verified JavaScript SDK failure in a deployed application. The offline manifest checker is deliberately scoped and does not parse arbitrary JSON Schema, OpenAPI security schemes, streaming protocols or binary responses. Those require dedicated tools and real client/provider tests. A stored schema or successful response also does not approve research, rights, reproducibility or publication.

13. Technical references

Scroll to Top