Skip to content

feat: Layer 1 — Proxy & Observability via native Albus integration#2

Open
rafaelsandroni wants to merge 14 commits intoguardion-v2from
layer1-proxy-observability
Open

feat: Layer 1 — Proxy & Observability via native Albus integration#2
rafaelsandroni wants to merge 14 commits intoguardion-v2from
layer1-proxy-observability

Conversation

@rafaelsandroni
Copy link

Summary

  • Delete custom guardionAuth middleware (src/middlewares/guardion/) — replaced by native Albus integration. The gateway's existing fetchApiKeyDetails, fetchOrganisationConfig, and fetchOrganisationGuardrail functions work correctly once ALBUS_BASEPATH points at Guard API.
  • Remove dead code: isGuardionAuth bypass in authN (was never set), guardion provider VK short-circuit in helpers.ts
  • Add configurable telemetry paths: GUARD_LOGS_PATH and GUARD_ANALYTICS_PATH env vars replace hardcoded paths in controlPlane.ts (private-deployment branch only)
  • Remove debug console.log from uploadLogsToControlPlane
  • Add design spec and implementation plan documenting the Guard API contract (5 endpoints) and all changes

Guard API Contract

The gateway now calls these endpoints natively (no mapping layer):

  1. GET /v2/api-keys/self/details — authentication
  2. GET /v2/virtual-keys/:slug — LLM provider key resolution
  3. GET /v2/configs/:slug — dynamic routing config
  4. GET /v2/guardrails/:slug — guardrail definitions
  5. POST $GUARD_LOGS_PATH / POST $GUARD_ANALYTICS_PATH — telemetry ingestion

Required Environment Variables

PRIVATE_DEPLOYMENT=ON
ALBUS_BASEPATH=http://guard-api:8000
PORTKEY_CLIENT_AUTH=<service-token>
GUARD_LOGS_PATH=/v1/logs/enterprise/logs          # optional, this is the default
GUARD_ANALYTICS_PATH=/v1/analytics/enterprise/analytics  # optional, default

Test plan

  • Build passes (npm run build)
  • No broken imports after middleware deletion
  • Pre-existing test suite unaffected (no new failures)
  • else branch in controlPlane.ts (CONTROL_PLANE_BASEPATH/dp/metrics) untouched
  • End-to-end smoke test against running Guard API (Task 8 in implementation plan)

🤖 Generated with Claude Code

rafaelsandroni and others added 14 commits March 12, 2026 19:17
Captures the MVP architecture for replacing the custom guardionAuth
middleware with native Albus integration pointing at Guard API.
Includes Guard API contract, gateway changes, env var additions,
and known limitations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Step-by-step plan for replacing the custom guardionAuth middleware
with native Albus integration: 5 files changed, env var additions,
path substitutions, and integration smoke test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ow use native VK resolution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ults

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Also removes debug console.log('headers', headers) from uploadLogsToControlPlane.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies auth, proxy (inline + config slug), virtual key resolution,
log telemetry, header translation, and Bearer auth against a running
Guard API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Documents two issues found during integration testing:
- PORTKEY_CLIENT_AUTH not configured in Guard API causes telemetry 401s
- GET /v2/integrations/ endpoint not implemented causes 404 noise

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onfig

Inline JSON config in x-guardion-config is treated as a slug by the
gateway (fetched from Guard API /v2/configs/:slug), not parsed as
inline routing config. Use x-guardion-virtual-key header for direct
VK routing in tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rewrite rootHtmlHandler with full Guardion header support (virtual key,
  config slug, policy routing modes), streaming, guardrail results panel,
  cURL preview, and example prompts
- Move playground route before authN middleware so it's publicly accessible
- Fix dev:node script to load .env via --env-file flag
- Update integration tests to use groq-prod virtual key and correct URLs
- Test telemetry ingestion endpoint directly instead of log viewer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix backslash escaping in generateCurl() that caused SyntaxError,
  preventing sendRequest from being defined
- Add /favicon.ico route before auth to avoid 401 on browser auto-request

Co-Authored-By: Claude Opus 4.6 <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