Skip to content

tier1: read trusted headers per response, not once per stream - #979

Open
matthewdarwin wants to merge 1 commit into
streamingfast:developfrom
matthewdarwin:tier1-read-auth-per-response
Open

matthewdarwin wants to merge 1 commit into
streamingfast:developfrom
matthewdarwin:tier1-read-auth-per-response

Conversation

@matthewdarwin

@matthewdarwin matthewdarwin commented Oct 7, 2026 •

Copy link
Copy Markdown

Minimal option; #980 is the alternative that removes the duplicated identity handling instead. Only one of the two is needed.

tier1's Blocks response handler copies organization id, api key id, meta and ip out of dauth.FromContext(ctx) once, when the stream starts, and reuses those values for every metering event of the stream.

streamingfast/dauth#19 lets continuous authentication refresh a stream's trusted headers mid-stream, for example when the first Authenticate returned an empty success. With the values copied up front, tier1 would keep metering the stream with the original, possibly empty, identity. This reads the headers on each response instead, as firehose/server/server.go already does.

FromContext is a context lookup plus an atomic load per response. Behaviour is unchanged until dauth#19 is in.

Tested: go build ./... and go test ./service/ ./metering/, both against current dauth and with a replace pointing at the dauth#19 branch.

🤖 Generated with Claude Code

The Blocks response handler copied organization id, api key id, meta
and ip from the trusted headers when the stream started. Reading them
on every response lets metering pick up headers refreshed by continuous
authentication during the stream.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@matthewdarwin
matthewdarwin force-pushed the tier1-read-auth-per-response branch from dc42998 to a8570ef Compare October 9, 2026 22:03
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