feat(api): merge Acontext-admin fork into main repo#458
Conversation
cf11a37 to
03be7a6
Compare
Add admin API as a second entry point (cmd/admin/main.go) sharing the same Go module. This eliminates the need for a separate fork and manual sync-api.sh workflow. - Add admin handlers, services, and repos for project management, usage analytics, and metrics - Add SupabaseAuth and MetricsAuth middleware - Add admin bootstrap container extending the base DI container - Add admin router extending the base router with /admin/v1 and /metrics/v1 route groups - Add Dockerfile.admin and CI/CD workflows (admin/vX.Y.Z tags) - Add MetricsCfg, SupabaseCfg, and JaegerQueryEndpoint config fields - Add PathMatcher utility for quota route matching Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
03be7a6 to
2adbb0d
Compare
- Reuse SupabaseAuth client across requests instead of creating per-request - Wrap storage metrics delete+create in a DB transaction to prevent data loss - Reuse http.Client in projectService instead of creating per-request - Whitelist safe headers (Accept, Content-Type) for Jaeger proxy instead of forwarding all - Remove bearer token plaintext log at admin startup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 1 issue:
Acontext/src/server/api/go/internal/modules/model/metric.go Lines 9 to 17 in 0e12888 Python side for reference: Acontext/src/server/core/acontext_core/constants.py Lines 1 to 3 in 0e12888 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Remove unused MetricTag constants to align Go with Python, update config.admin.yaml pool defaults to match PR #457, fix Swagger BasePath annotation, whitelist Jaeger proxy query params, and filter unsafe response headers in Jaeger proxy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewFound 3 issues:
Acontext/src/server/api/go/internal/modules/repo/project.go Lines 474 to 480 in 9dbe1c9
Acontext/src/server/api/go/internal/modules/repo/project.go Lines 509 to 515 in 9dbe1c9
Acontext/src/server/api/go/internal/modules/service/metric.go Lines 127 to 134 in 9dbe1c9 Acontext/src/server/api/go/internal/modules/model/metric.go Lines 23 to 25 in 9dbe1c9 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
… merge - Replace removed `spaces` table with `learning_spaces` in AnalyzeUsages - Replace removed `tool_references` table with `agent_skills` in AnalyzeStatistics - Remove autoUpdateTime from Metric model to preserve epoch sentinel values set by quota logic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
After merging Acontext-admin fork (#458), the admin router's /api/v1 auth was replaced by the SDK-oriented HMAC secret key lookup, breaking all Dashboard requests (which use base64 JSON tokens with project_id + signature). This adds AdminProjectAuth middleware and a ProjectAuthOverride mechanism so the admin router uses the correct token format while the regular API server remains unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
After merging Acontext-admin fork (#458), the admin router's /api/v1 auth was replaced by the SDK-oriented HMAC secret key lookup, breaking all Dashboard requests (which use base64 JSON tokens with project_id + signature). This adds AdminProjectAuth middleware and a ProjectAuthOverride mechanism so the admin router uses the correct token format while the regular API server remains unchanged. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Why we need this PR?
Merge the Acontext-admin fork into the main repo. The admin API was previously maintained in a separate fork (
memodb-io/Acontext-admin), but consolidating it simplifies maintenance, deployment, and keeps shared code in sync.This PR also includes post-merge code review fixes for security, performance, and reliability issues found in the merged code.
Continues from fork tag
admin/v0.1.17— the next release from this repo should beadmin/v0.1.18.Describe your solution
Phase 1: Merge admin fork
Imported admin-specific functionality into the main repo:
cmd/admin/main.go)Dockerfile.admin) and CI release workflow (admin-release.yaml)bootstrap/container_admin.go) and router (router/router_admin.go)Phase 2: Code review fixes
supabaseauth.New()once in the middleware constructor closure instead of per-requestReplaceStorageMetrics()usingdb.Transaction()to prevent data loss on crash*http.Clientfield toprojectServicestruct, initialized once in constructorAccept,Content-Type) instead of all headers, preventingAuthorization/Cookieleaks to internal JaegerImplementation Tasks
Impact Areas
Which part of Acontext would this feature affect?
Checklist
devbranch.Docker Image Visibility
🤖 Generated with Claude Code