phase 1 core platform

Phase 1 — Goals

Description: Shared Go integration test harness (testcontainers, tags, CI) before auth/proxy integration milestones scale up.

Phase 1 — Goals

Goal 1.0: Test infrastructure (prerequisite)

Description: Shared Go integration test harness (testcontainers, tags, CI) before auth/proxy integration milestones scale up.

Related milestones:

Validation: go test -tags=integration ./... documented and runnable in CI smoke path


Goal 1.1: Persistence and auth data plane

Description: Introduce Postgres migrations and the minimum schema for organizations and API tokens, plus the auth gRPC contract and validation logic.

Acceptance criteria:

  • Migration runner integrated with Makefile / dev-tool.sh
  • Tables match subset of DATABASE_SCHEMA.md (ibex_core.organizations, ibex_core.tokens)
  • RLS enabled; SET LOCAL app.current_org_id pattern documented and tested
  • ValidateToken (or equivalent) RPC returns org_id + permission bitmap or unauthenticated error
  • Cross-tenant test: token from Org A cannot validate as Org B

Related milestones:

Validation: make db-migrate; go test ./services/auth/... with integration tag; grpcurl or integration client against auth


Goal 1.2: Proxy platform integration

Description: Wire the proxy to auth and parse incoming LLM requests without calling a provider.

Acceptance criteria:

  • Proxy calls auth with bounded timeout; fails closed on auth errors
  • Valid request attaches org context for downstream use (no provider call yet)
  • OpenAI-shaped chat completion JSON parses; malformed body → 400 with stable error envelope
  • No new business endpoints beyond documented proxy routes for this goal

Related milestones:

Validation: Integration tests with auth + proxy running; httptest for malformed payloads


Goal 1.3: Observability baseline

Description: Align skeleton observability with MONITORING.md and DEPENDENCIES.md.

Acceptance criteria:

  • OTel tracer/meter providers initialized in auth and proxy main (exporter optional)
  • HTTP middleware creates spans for request path
  • Migrate /metrics to prometheus/client_golang OR document ADR deferral with parity tests
  • Logs remain structured JSON; no secrets or raw memory content

Related milestones:


Goal 1.4: Developer experience baseline

Description: Canonical local dev onboarding: idempotent seed data, .env.example files, local smoke tests, shared config/error packages, and a standardised health check contract.

Acceptance criteria:

  • make db-seed produces a working org, user, agent, and PAT on a migrated dev database
  • make dev-smoke validates auth → proxy without an LLM key
  • packages/config and packages/apierror are used by auth and proxy (no scattered os.Getenv for required vars)
  • /health and /ready follow a documented JSON contract across Go services

Related milestones:

Validation: Fresh clone + make compose-dev-up + make db-migrate + make db-seed + make dev-smoke exits 0


Goal 1.5: Phase 1 security gate

Description: End-to-end security integration test suite validating the composed proxy middleware chain (auth → agent verify → rate limit) against real Postgres and Redis. Explicit Phase 1 completion gate.

Acceptance criteria:

  • Token from Org A cannot access Org B resources (403)
  • Revoked token rejected (401) within documented SLA
  • Cross-org agent ID rejected (403)
  • Rate limit returns 429 with Retry-After
  • Insufficient permission bitmap returns 403
  • All tests run under go test -tags=integration in CI

Related milestones:

Validation: go test -tags=integration ./services/proxy/... security suite green; Phase 1 exit criteria in README satisfied


Decision points (mid-phase)

WhenQuestionDefault if no pivot
After 1.1.1golang-migrate vs goose vs atlasgolang-migrate (ADR-0005)
After 1.1.2gRPC only vs internal HTTP for authgRPC per ARCHITECTURE.md
After 1.2.1In-process auth vs always remoteRemote gRPC with short timeout

Log pivots in FINDINGS.md.

Edit on GitHub

Last updated on

On this page

0%