feat(edge): Edge HTTP Server with MessageBus, middleware, CORS, rate limiting, OpenAPI spec - #1
Closed
tanmayxchoudhary wants to merge 1 commit into
Closed
feat(edge): Edge HTTP Server with MessageBus, middleware, CORS, rate limiting, OpenAPI spec#1tanmayxchoudhary wants to merge 1 commit into
tanmayxchoudhary wants to merge 1 commit into
Conversation
Implements the bounty scope from Clawland-AI#22 with 4 new endpoints: - GET /api/health (and legacy /healthz) - GET /api/status (and legacy /api/v1/status) - POST /api/command (and legacy /api/v1/command) - POST /api/message Differentiation vs existing PRs (Clawland-AI#19, Clawland-AI#23, Clawland-AI#27): - Full middleware stack: request logging, panic recovery, CORS, rate limiting - Graceful shutdown via StartWithContext(ctx) - Structured error responses with consistent JSON format - Functional options pattern (WithMessageBus, WithRateLimit) - 16 comprehensive table-driven tests (vs ~4-7 in competing PRs) - Includes CORS preflight, wrong method, concurrent access, backward compat tests - OpenAPI 3.0 specification at pkg/edge/openapi.json - Backward-compatible NewServer(cfg) and NewServer(cfg, msgBus) signatures - Deterministic gene selector tie-breaker for full test suite pass Tests: go test ./... PASS, go vet ./... PASS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Edge HTTP Server bounty from Clawland-AI#22 — adding 4 new API endpoints to turn PicoClaw into a full L1 edge node.
Endpoints
/api/health/healthz)/api/status/api/v1/status)/api/command/api/v1/command)/api/messageKey changes
pkg/edge/server.go— Complete rewrite with:/healthzand/api/v1/*aliasesWithMessageBus()option (backward-compatible withNewServer(cfg, msgBus)variadic)StartWithContext(ctx){"error": "...", "code": N})WithMessageBus(),WithRateLimit(rps, burst)pkg/edge/server_test.go— 16 table-driven tests covering:NewServersignaturespkg/edge/openapi.json— OpenAPI 3.0 specification for all endpointscmd/picoclaw/main.go— Wired MessageBus into edge serverREADME.md— Updated endpoint documentationpkg/gene/selector.go— Deterministic gene sort tie-breaker sogo test ./...passes repository-wideDifferentiation from existing PRs (Clawland-AI#19, Clawland-AI#23, Clawland-AI#27)
go test ./...passesValidation
Closes Clawland-AI#22
Race status: I am aware of 3 existing open PRs for this bounty (Clawland-AI#19, Clawland-AI#23, Clawland-AI#27). This PR aims to differentiate on code quality, test coverage, observability, and documentation.