Skip to content

feat(api): consume blocks via gRPC StreamBlocks (flagged, default off) - #941

Merged
raymondjacobson merged 1 commit into
mainfrom
feat/consume-block-stream
Jun 9, 2026
Merged

raymondjacobson merged 1 commit into
mainfrom
feat/consume-block-stream

Conversation

@raymondjacobson

Copy link
Copy Markdown
Member

Summary

Bumps go-openaudio to aee578e (OpenAudio/go-openaudio#342) and wires the core-indexer to source blocks from the CoreService.StreamBlocks gRPC stream instead of polling GetBlocks, behind a new coreBlockStreamEnabled env — default off, so prod behavior is unchanged until flipped.

What #342 gives us

The ETL can now consume blocks over a gRPC server stream: the node replays history from the resume height, then live-tails, gap-filling any heights its in-process pubsub drops. The ETL reconnects from its cursor on error and auto-falls-back to polling if the endpoint doesn't support the stream.

Changes

  • go.mod/go.sum: github.com/OpenAudio/go-openaudio (+ /pkg/etl) → v1.3.1-0.20260609211151-aee578ec923b
  • config/config.go: new CoreBlockStreamEnabled (coreBlockStreamEnabled env, default off)
  • indexer/indexer.go: when enabled, set Config.BlockStreamEnabled and pass a gRPC (connect.WithGRPC) Core client via SetBlockStreamClient. The SDK's unary Core client is retained for status checks + the polling fallback.

Rollout

  1. Merge with the flag unset → no behavior change (still polling).
  2. Set coreBlockStreamEnabled=true on one indexer and validate: it tails live, resumes gap-free on restart, and (induced) stream errors fall back to polling cleanly.
  3. The one open question is whether the prod LB/ingress in front of the validator passes long-lived h2 gRPC streams — this single-indexer step is where that gets confirmed. If it doesn't, leave the flag off; polling is unaffected.

Validated locally with the harness in OpenAudio/go-openaudio#344 (devnet, --stream, catch-up + restart-resume).

Test plan

  • go mod tidy (only go.mod/go.sum), go build ./..., go vet ./indexer ./config clean
  • Staging: flip coreBlockStreamEnabled=true on one indexer; confirm live-tail + gap-free restart + fallback

🤖 Generated with Claude Code

Bumps go-openaudio to aee578e (#342) and wires the core-indexer to source
blocks from CoreService.StreamBlocks instead of polling GetBlocks, gated by a
new coreBlockStreamEnabled env (default off).

When enabled, builds a gRPC (connect.WithGRPC) Core client from audiusdUrl and
passes it via SetBlockStreamClient + Config.BlockStreamEnabled. The SDK's unary
Core client is retained for status checks and the polling fallback, and the ETL
auto-falls-back to polling if the endpoint doesn't support the stream — so this
is safe to flip on per environment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@raymondjacobson
raymondjacobson merged commit 237b2af into main Jun 9, 2026
5 checks passed
@raymondjacobson
raymondjacobson deleted the feat/consume-block-stream branch June 9, 2026 21:36
dylanjeffers added a commit that referenced this pull request Nov 12, 2026
## Summary
Audit of feature flags and env toggles in the API. Only one met the bar
for removal.

**Removed**
- `skipAuthCheck` env var (`api/server.go`). When set to true, it turned
off `isAuthorizedRequest` entirely, and production code read it from the
environment. Nothing in this repo, compose, or k8s sets it. Every test
that needs it sets `app.skipAuthCheck = true` on the struct, which still
works. Added in #151 (2025-06) and never used through the env since.
This cuts a dead toggle and an auth bypass at the same time.

**Audited and kept (needs a decision from someone with prod access)**
- `commsMessagePush`: defaults on since #349 (2025-09). The env override
only turns it off. `server_test.go` depends on it to keep the websocket
manager and pg-notify listeners out of the shared test app, so it works
as a test seam. I couldn't confirm prod doesn't set
`commsMessagePush=false`; if it doesn't, the env parse can go, but the
struct field should stay for tests.
- `coreBlockStreamEnabled`: defaults off and arrived in #941 (2026-06,
~5 months ago). I couldn't see the prod env (no RBAC on
deployments/configmaps). If prod has it on, inline it; if it was never
turned on, consider deleting the gRPC stream path.
- `newChainQueueEnabled` / `newChainFlushEnabled` /
`newChainInsecureSkipVerify` / `etlStartingBlockHeight` /
`etlEndingBlockHeight` / `PlayRoutingHosts`: the genesis migration is
still in progress (see `cmd/genesis-writer/ROLLOUT.md`). Not stale yet;
remove them at cutover.

## Test plan
- [x] `go build ./...` and `go vet ./api/`
- [ ] `go test ./api/...` (couldn't run locally because Docker/test DB
was down; CI covers it)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant