Skip to content

feat: API key management and fixes, workload tier updates, and admin CLI improvements#555

Merged
jcabrero merged 7 commits into
mainfrom
fix/api-flexibility
Mar 27, 2026
Merged

feat: API key management and fixes, workload tier updates, and admin CLI improvements#555
jcabrero merged 7 commits into
mainfrom
fix/api-flexibility

Conversation

@jcabrero
Copy link
Copy Markdown
Member

@jcabrero jcabrero commented Mar 26, 2026

Summary

  • API key ID type change: Widen api_keys.id from UUID to VARCHAR to support legacy non-UUID key identifiers (e.g. sandbox keys). Includes a new migration, updated entity/DTOs, and removal of the UUID-only regex filter from key lookups. This fixes an issue where in Sandbox, API Keys were removed when migrating forward.
  • Auth middleware: Add accountIdentityAuthentication middleware that accepts both JWT and account-admin API key auth, used on the GET account endpoint.
  • Workload tier update endpoint: Add PUT /api/v1/workload-tiers/update to allow modifying tier properties (name, cpus, gpus, memory, disk, cost). This allows us to change tiers live when workloads are running on that tier.
  • Admin CLI commands: Add CRUD commands for API keys and an update command for workload tiers, with a new generic PUT method on the API client. This allows managing API Keys from the nilcc-admin-cli.
  • Test reliability: Pin localstack to v4.14.0 and add TCP/HTTP readiness checks for all test services to prevent race conditions on container startup.
  • CI fix: Use pnpm exec tsc instead of bare tsc to avoid picking up a system TypeScript on newer GitHub Actions runner images.

Support non-UUID API key identifiers (e.g. legacy sandbox keys) by
changing the id column type to VARCHAR across migrations, entity,
DTOs, and service layer. Adds a new migration to alter existing
databases and removes the UUID-only regex filter from key lookups.

Includes migration unit tests and an integration test for legacy
non-UUID key authentication.
Introduce a middleware that accepts both JWT and account-admin API
key authentication, rejecting global admin and non-admin API keys.
Use it on the GET account endpoint so account-admin keys can
retrieve account details.
Add PUT /api/v1/workload-tiers/update for admin users to modify
existing tier properties (name, cpus, gpus, memory, disk, cost).
Includes DTO validation, service logic with conflict detection,
OpenAPI documentation, and integration tests.
Add CRUD commands for API keys (create, list, update, delete) and
an update command for workload tiers. Adds a generic PUT method to
the API client to support update operations.
Pin localstack image to v4.14.0 to avoid breaking changes from
latest tags. Add TCP/HTTP endpoint readiness checks for all
services (postgres, localstack, anvil, mock servers) before
proceeding with tests, replacing time-based waits.
@jcabrero jcabrero force-pushed the fix/api-flexibility branch from c873031 to 9a2adaf Compare March 26, 2026 15:51
The bare `tsc` command resolves to a system-installed TypeScript on
newer GitHub Actions runner images (20260323+), which errors on
deprecated tsconfig options. Using `pnpm exec tsc` ensures the
project-local TypeScript 5.8.3 is used instead.
@jcabrero jcabrero changed the title fix: api flexibility feat: API key flexibility, workload tier updates, and admin CLI improvements Mar 26, 2026
@github-actions
Copy link
Copy Markdown

Coverage Report for nilcc-api

Status Category Percentage Covered / Total
🔵 Lines 80.95% 5156 / 6369
🔵 Statements 80.95% 5156 / 6369
🔵 Functions 83.71% 257 / 307
🔵 Branches 84.26% 514 / 610
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
nilcc-api/migrations/1772193140110-ApiKeys.ts 78.57% 100% 66.66% 78.57% 28-30
nilcc-api/migrations/1773000000000-WalletAuth.ts 65.38% 100% 66.66% 65.38% 43-60
nilcc-api/migrations/1775000000000-ApiKeyIdVarchar.ts 100% 100% 100% 100%
nilcc-api/src/data-source.ts 86.06% 84.21% 72.72% 86.06% 113-114, 126-127, 170-171, 178-188, 191-196
nilcc-api/src/account/account.controller.ts 95% 92.3% 100% 95% 145-146, 210-217
nilcc-api/src/api-key/api-key.dto.ts 100% 100% 100% 100%
nilcc-api/src/api-key/api-key.entity.ts 100% 100% 100% 100%
nilcc-api/src/api-key/api-key.service.ts 95.55% 75% 100% 95.55% 67-68, 89-90
nilcc-api/src/common/auth.ts 88.14% 94.44% 92.3% 88.14% 96-112, 118-119, 194-195, 215-216, 246-247
nilcc-api/src/common/paths.ts 100% 100% 100% 100%
nilcc-api/src/workload-tier/workload-tier.controllers.ts 100% 100% 100% 100%
nilcc-api/src/workload-tier/workload-tier.dto.ts 100% 100% 100% 100%
nilcc-api/src/workload-tier/workload-tier.router.ts 100% 100% 100% 100%
nilcc-api/src/workload-tier/workload-tier.service.ts 87.14% 72.72% 100% 87.14% 46-47, 63-64, 76-80
Generated in workflow #204 for commit 95f979a by the Vitest Coverage Report Action

@jcabrero jcabrero changed the title feat: API key flexibility, workload tier updates, and admin CLI improvements feat: API key management, workload tier updates, and admin CLI improvements Mar 27, 2026
@jcabrero jcabrero changed the title feat: API key management, workload tier updates, and admin CLI improvements feat: API key management and fixes, workload tier updates, and admin CLI improvements Mar 27, 2026
@jcabrero jcabrero merged commit 658cc34 into main Mar 27, 2026
3 checks passed
@jcabrero jcabrero deleted the fix/api-flexibility branch March 27, 2026 12:19
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