mirror of
https://github.com/hanzoai/base.git
synced 2026-10-21 03:41:50 +00:00
The wire carried another vendor's namespace in its error codes (PGRST1xx) and in the media type a caller sends to claim a single row. Both ends are ours, so it said someone else's name for no reason a caller could act on. Two vocabularies meet in a fault and the split is the point: a constraint the STORE refused answers with the store's own SQLSTATE, because every SQL engine already agrees on how to say that; a request the WIRE would not accept answers with a word of ours — bad_query, bad_body, not_one_row, refused, not_found, store_failed — because that is a fact about this API and nobody else gets to name it. Cardinality is asked for with application/vnd.hanzo.object+json. LLM.md described the product as a translation of somebody else's seven services, mapping their names onto ours, which is both wrong (their auth is not Hanzo IAM) and backwards. It says what Base is: one binary, one file, the surfaces it serves, and rules enforced here in Go rather than pushed down. plugins/zap/forward.go still called itself additive to four native message types that plugin.go had already removed — one node, one way in, and the table wire arrives over it like every other route.
35 lines
1.5 KiB
Go
35 lines
1.5 KiB
Go
package zap
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/luxfi/zap/forward"
|
|
)
|
|
|
|
// bridgeForward registers the canonical HTTP-over-ZAP terminal
|
|
// (luxfi/zap/forward) on the plugin's live ZAP node, dispatching every
|
|
// MsgTypeForward envelope to h.
|
|
//
|
|
// h MUST be base's fully-wrapped HTTP handler (the *http.ServeMux produced
|
|
// by Router.BuildMux and bound to e.Server.Handler) so every middleware —
|
|
// activity log, panic recovery, rate limiting, auth-token loading, security
|
|
// headers, body limit, CSP, gzip — and every route run on bridged requests
|
|
// exactly as they do on the HTTP port. forward.Serve reconstructs the
|
|
// *http.Request, injects the edge-validated identity (X-Org-Id / X-User-Id /
|
|
// X-User-IsAdmin / X-User-Permissions), serves it through h, and returns the
|
|
// buffered response as a ZAP Response.
|
|
//
|
|
// It is the ONLY thing this node answers. Four other message types once served
|
|
// collections, records, auth and realtime by calling the store directly — see
|
|
// plugin.start for why they are gone rather than mended — so a peer reaches
|
|
// exactly the surface an HTTP caller reaches, under exactly the same chain, and
|
|
// the table wire arrives here like every other route. No-op when the node is
|
|
// absent or h is nil; base's HTTP behavior is unchanged either way.
|
|
func (p *plugin) bridgeForward(h http.Handler) {
|
|
if p.node == nil || h == nil {
|
|
return
|
|
}
|
|
forward.Serve(p.node, h)
|
|
p.logger.Info("forward_serve: ZAP HTTP terminal registered on node "+p.node.NodeID(), "msgType", forward.MsgTypeForward)
|
|
}
|