Skip to main content

Verify a credential by hand

Before the first install there is nothing to run a hook, and the assertions are worth making from a pod in the target namespace. These are the ones the probe makes:

GitHub. From a pod in the namespace, with the token you are about to install:

# 1. Does the credential authenticate, and what is it actually granted?
curl -sS -D- -o /dev/null -H "Authorization: Bearer <token>" \
"<your GitHub API URL>/rate_limit" # 200, and read the x-oauth-scopes header

# 2. Is the org visible to it?
curl -sS -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer <token>" \
"<your GitHub API URL>/orgs/<org>" # 200

# 3. The assertion that matters: are that org's PRs findable?
curl -sS -H "Authorization: Bearer <token>" \
"<your GitHub API URL>/search/issues?q=org:<org>+type:pr&per_page=1" # total_count > 0

# 4. GraphQL is a separate hop, and GHE can serve REST while blocking it
curl -sS -o /dev/null -w '%{http_code}\n' -X POST -H "Authorization: Bearer <token>" \
-d '{"query":"{ __typename }"}' "<your GitHub GraphQL URL>" # 200

Step 3 is the one to care about. A token can authenticate, see the org, and still return total_count: 0 — and that is the case that empties your source. Do not settle for step 1 because the scopes look right, and note that a fine-grained token returns no x-oauth-scopes header at all: absent grants and an absent header are the same reading, which is another reason the assertion that counts is the search. What that token should have been granted, either kind, is What the GitHub credential needs. Step 4 failing is narrower but not harmless: PR counts keep working and every PR size lands null, along with reviews and issue-to-PR links. Step 3 does not gate on this hop, so a credential that passes the pre-flight can still fail here — which is why it is worth running with the token you are about to install rather than with your own.

The signal that says it is happening. The ingest does not fail on a dead /graphql: it abandons that day's enrichment, carries on, and finishes. What it leaves behind is the record — the run log carries a WARNING naming the buckets, and the durable list is unenriched_days in the github row of ingest_state:

psql "<your datapond URL>" -c \
"SELECT detail->'unenriched_days' FROM ingest_state WHERE source = 'github'"

Three readings, and they are different:

valuemeaning
absentthis mirror was built before the record existed, or by a source that keeps none
[]the ingest ran and enriched every day it walked
entriesthose org/day buckets have their pull requests and nothing else

An entry names its reason, and clears itself: fix the hop, re-run the ingest over those days, and the bucket that comes back complete drops out of the list. Nothing else removes an entry, so a list that stays full after a re-run means the re-run did not reach /graphql either.

On GitHub Enterprise Server the API base is https://<host>/api/v3 and GraphQL is at https://<host>/api/graphql; on github.com they are https://api.github.com and https://api.github.com/graphql.

Jira. Same shape:

# 1. Reachable, and which deployment — Cloud and DC page differently
curl -sS "<your Jira base URL>/rest/api/2/serverInfo" # 200, note deploymentType

# 2. Does the credential resolve to a user? serverInfo is anonymous on many
# DC installs, so on its own it proves nothing about auth.
curl -sS -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer <PAT>" \
"<your Jira base URL>/rest/api/2/myself" # 200

# 3. Are issues actually visible to it? (Data Center form)
# THIS IS THE UNSCOPED FORM, and it is what the probe asks only when
# ingest.jira.projects is EMPTY. If you have set it, run 3b instead — a
# healthy `total` here proves nothing about the query the probe will send.
curl -sS -X POST -H "Authorization: Bearer <PAT>" -H 'Content-Type: application/json' \
-d '{"jql":"order by created DESC","startAt":0,"maxResults":0}' \
"<your Jira base URL>/rest/api/2/search" # total > 0

# 3b. If you set ingest.jira.projects, THIS is what the probe asks. Jira refuses
# the WHOLE query with a 400 if a single key is unknown or invisible to the
# credential — it does not answer for the keys that were fine.
curl -sS -X POST -H "Authorization: Bearer <PAT>" -H 'Content-Type: application/json' \
-d '{"jql":"project in (\"ABC\",\"DEF\")","startAt":0,"maxResults":0}' \
"<your Jira base URL>/rest/api/2/search" # 200, total > 0

# 3c. Where those keys come from — the ones this credential can actually see,
# rather than the ones a spreadsheet says it should.
curl -sS -H "Authorization: Bearer <PAT>" \
"<your Jira base URL>/rest/api/2/project" # .[].key

Jira Cloud authenticates with ingest.jira.email plus the API token as HTTP basic auth rather than a bearer PAT (curl -u), and counts through /rest/api/3/search/approximate-count. Data Center uses the bearer PAT above.

While you have the credential to hand: if this install has ever run a live Jira source on a release before 0.9.0, or has ever run with ingest.jira.absoluteWindowBound turned on, also run Am I affected? — the same two shapes of call, answering whether that credential's timezone skewed the incremental window.

If 3b comes back 400 and you do not know which key it is, you do not have to bisect it by hand: the probe does that for you. On a refusal it re-asks one key at a time and records the verdict for each — see the fault list in Afterwards, the schedule takes over, and project_verdicts in the diagnostic bundle.