Skip to content

ci: replace stale ARGUS_STAGING_KEY with local cueapi-core in test job#32

Merged
govindkavaturi-art merged 2 commits into
mainfrom
fix/ci-replace-stale-argus-staging-key-with-local-cueapi-core
May 6, 2026
Merged

ci: replace stale ARGUS_STAGING_KEY with local cueapi-core in test job#32
govindkavaturi-art merged 2 commits into
mainfrom
fix/ci-replace-stale-argus-staging-key-with-local-cueapi-core

Conversation

@mikemolinet
Copy link
Copy Markdown
Collaborator

Why

The test job in feature-to-main.yml runs the SDK's CRUD tests (tests/test_cues.py, tests/test_webhook.py) against a real CueAPI server, authenticated by secrets.ARGUS_STAGING_KEY. That key has been invalid for ~3 days — Argus was retired 2026-05-02 (cueapi#539) and the staging user/key was decommissioned.

Symptom on PRs #30 and #31: every test that uses the client fixture errors with cueapi.exceptions.AuthenticationError: Invalid API key. Both PRs blocked.

What

Switch test to the same self-contained pattern already proven by the passing sdk-integration job:

  1. Clone cueapi-core (already done)
  2. alembic upgrade head against the test Postgres
  3. Boot uvicorn (app.main:app) on 127.0.0.1:8000 in the background
  4. Wait for /health 200 (30 s budget)
  5. POST /v1/auth/register with a unique-per-attempt email (ci-sdk-${RUN_ID}-${ATTEMPT}@example.com); ALLOW_REGISTER=true gates this
  6. Capture api_key from the JSON response, mask it, expose via step output
  7. Plumb existing CUEAPI_STAGING_URL / CUEAPI_STAGING_API_KEY env vars at local values
  8. Run pytest tests/ -v --tb=short exactly as before
  9. Dump uvicorn log on failure for triage

tests/conftest.py reads both env vars unchanged — no SDK code change needed.

Scope / non-goals

  • Workflow-only diff (feature-to-main.yml test job).
  • notify-merge still uses secrets.ARGUS_CUEAPI_KEY for the post-merge telemetry cue against api.cueapi.ai. That key is also stale, but the step runs after auto-merge so it does not gate the PR. Leaving for a follow-up that needs a fresh prod key minted by an operator.
  • No sdk-integration.yml changes; that job already runs against a local in-process cueapi-core via httpx ASGI fixtures.

Test plan

Once merged

mikemolinet and others added 2 commits May 5, 2026 17:41
… ARGUS_STAGING_KEY

The `test` job's `pytest tests/` runs the SDK's CRUD tests against a real
CueAPI server. Previously that server was remote staging, authenticated by
`secrets.ARGUS_STAGING_KEY`. Argus was retired 2026-05-02 (cueapi PR #539)
and that key/user is no longer valid — every PR's `test` job has been
red for ~3 days with `AuthenticationError: Invalid API key`, blocking
PRs #30 and #31 (and any future SDK PRs).

This switches the job to the same self-contained pattern that's already
proven by the passing `sdk-integration` job: clone cueapi-core, install,
migrate, boot uvicorn locally, register a fresh test user via
POST /v1/auth/register (gated by ALLOW_REGISTER=true), capture the key,
plumb it through the existing `CUEAPI_STAGING_URL` / `CUEAPI_STAGING_API_KEY`
env vars (no SDK code change needed — `tests/conftest.py` already reads
them from env).

Workflow-only diff. No SDK behavior change.

Note: `notify-merge` still references `secrets.ARGUS_CUEAPI_KEY` for the
post-merge prod telemetry cue. That key is also stale, but the step runs
after auto-merge so it doesn't gate the PR — leaving for a follow-up that
needs a new prod key minted by an operator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…pi-core conftest)

First push failed because OSS migration set ends at 023 while the User
model declares an `api_key_encrypted` column with no migration backing it.
That's a parity drift in cueapi-core (private migration 019 in the hosted
repo includes the column; the OSS port renamed/replaced it with the
alert-webhook bits but kept the column on the model). `alembic upgrade
head` produced a schema missing that column → register endpoint 500'd
on the User SELECT.

Switch the CI bootstrap to model-driven schema init via
`Base.metadata.create_all`, which is the exact pattern cueapi-core's own
`tests/conftest.py` uses (and which is robust to model/migration drift
because the model is the source of truth for tests).

Imports the same model list as conftest so all tables register before
create_all runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@govindkavaturi-art govindkavaturi-art enabled auto-merge (squash) May 6, 2026 00:46
Copy link
Copy Markdown
Member

@govindkavaturi-art govindkavaturi-art left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right shape for post-Argus SDK testing: stand up cueapi-core locally instead of pointing at the retired ARGUS_STAGING_KEY. Schema init via Base.metadata.create_all mirrors cueapi-core's tests/conftest.py pattern. Approve.

@govindkavaturi-art govindkavaturi-art merged commit b30d23b into main May 6, 2026
4 checks passed
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.

2 participants