Skip to content

groundwater_at takes an API key; a keyless 401 says a key is needed - #1

Merged
rafiei-vahid merged 1 commit into
mainfrom
fix/groundwater-at-api-key
Sep 28, 2026
Merged

rafiei-vahid merged 1 commit into
mainfrom
fix/groundwater-at-api-key

Conversation

@rafiei-vahid

Copy link
Copy Markdown
Collaborator

The well-record endpoint (/api/gw-wells/at) now requires a signed-in account, so the guest call returns 401. The client reported that as "invalid or revoked API key", even though no key was sent. Those are the two groundwater tests in the daily CI, red since 2026-09-26.

  • groundwater_at(lat, lon, tol_deg=0.05, api_key=None) sends api_key, or SWATGENX_API_KEY if unset, the same way Client does.
  • A 401 on a request sent without a key now says the endpoint needs an API key.
  • The two groundwater tests run when SWATGENX_API_KEY is set and skip without it. A new test pins the keyless message.

Local run without a key: 14 passed, 2 skipped. With the old client, the new test fails.

Follow-up: a one-line workflow change to pass the SWATGENX_API_KEY repository secret (a dedicated test account's key), so the two groundwater tests run in CI again.

🤖 Generated with Claude Code

https://claude.ai/code/session_0165nvw7C6jpq45EnoiEHE7S

The well-record endpoint (/api/gw-wells/at) is signed-in only, so the guest call answered 401 and the client
reported "invalid or revoked API key" although no key was sent (the daily CI's two groundwater tests, red since
2026-09-26).

- groundwater_at(lat, lon, tol_deg=0.05, api_key=None): sends api_key or SWATGENX_API_KEY, as Client does;
- a 401 on a keyless request now says the endpoint needs an API key;
- the two groundwater tests run with SWATGENX_API_KEY and SKIP without it; a new test pins the keyless message.
The workflow line that passes the SWATGENX_API_KEY secret follows separately (it needs a workflow-scoped token).

Local run without a key: 14 passed, 2 skipped. With the old client the new test fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0165nvw7C6jpq45EnoiEHE7S
@rafiei-vahid
rafiei-vahid merged commit 89dfa29 into main Sep 28, 2026
2 checks passed
@rafiei-vahid
rafiei-vahid deleted the fix/groundwater-at-api-key branch September 28, 2026 18:46
SWATGenX pushed a commit that referenced this pull request Sep 28, 2026
…un again (#2)

* CI passes the SWATGENX_API_KEY secret, so the two groundwater tests run again

The secret holds a dedicated test account's API key. Without it the two tests skip (PR #1); with it they call the
signed-in well-record endpoint for real.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0165nvw7C6jpq45EnoiEHE7S

* test_client_requires_key clears SWATGENX_API_KEY, which CI now sets

Client falls back to the environment variable, so with the CI secret present Client(api_key="") no longer raised
(run 36468776367: DID NOT RAISE). Clearing it keeps the test on the no-key path, as the keyless groundwater test does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0165nvw7C6jpq45EnoiEHE7S

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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