refactor: Consume shared Cerebro proto from Go SDK#160
Conversation
|
Droid finished @jonathanhaaswriter's task —— View job This is a well-executed refactor that cleanly removes the locally-duplicated |
|
Droid encountered an error —— View job Droid is reviewing code and running a security check… |
|
Droid finished @jonathanhaaswriter's task —— View job Droid is reviewing code and running a security check… This is a clean, well-scoped refactor. All callers are consistently updated to the SDK import path, the removed local proto and conversion bridge have no remaining callers, and |
Summary
Removes Aperio's copied
cerebro/v1protobuf and its forked proto bridge, consuming the canonical contract from the shared Cerebro Go SDK (github.com/writer/cerebro/sdk/go/cerebroapi) instead. This is the downstream half of cerebro#1143, which moved the proto contract + bridge into the SDK.Why
The SDK now ships the generated
cerebro/v1proto and itsClaim/EntityRefconversion bridge. Aperio'scerebroclientembeds*cerebroapi.Client, so once Aperio upgrades to that SDK it transitively registerscerebro/v1/primitives.proto. Keeping Aperio's own generated copy would register the same file descriptor a second time and panic at init (proto: file already registered). So adopting the new SDK and deleting the local copy must happen together.Removes
gen/cerebro/v1/primitives.pb.go(generated duplicate, -448 LOC)internal/cerebroclient/proto.gohand-maintained bridge body (now thin re-exports of the SDK)EncodeExternalIDencoder body incerebroclaimsUpdates
proto/cerebro/v1/primitives.protogo_packagerepointed to the SDK module. The.protois kept because Aperio's ownaperio.contracts.v1.CerebroClaimsFanoutEventimportscerebro.v1.Claim.buf.gen.go.yaml(Go, run with--exclude-path proto/cerebroso the cerebro Go type comes from the SDK) andbuf.gen.ts.yaml(TypeScript still generatescerebro/v1locally; protobuf-es has no global-registry collision).make generate,npm run proto:generate, and the Contracts workflow run both.buf.yamlbreaking config exceptsFILE_SAME_GO_PACKAGE(go_package is a codegen detail being intentionally repointed; the wire contract is unchanged).cerebroclaims.EncodeExternalIDnow delegates toclaims.EncodeExternalIDLegacy, which is byte-identical to the old encoder (space ->-). This preserves already-persisted Cerebro URNs.784f5ee).Test Plan
go build ./...go vet ./...go test ./internal/cerebroclient/... ./internal/cerebroclaims/... ./internal/siemdispatcher/... ./internal/bootstrap/... ./internal/ingestionworker/... ./internal/cerebrofanout/...(the cerebroclient proto round-trip test passing also confirms no duplicate-registration panic)make generate-check(regeneration deterministic, no drift)gofmt -lclean on changed Go files