Skip to content

feat(recorder): log replayable query records for allowlisted developers - #303

Merged
elffjs merged 2 commits into
mainfrom
feat/query-replay-logging
Jul 21, 2026
Merged

feat(recorder): log replayable query records for allowlisted developers#303
elffjs merged 2 commits into
mainfrom
feat/query-replay-logging

Conversation

@elffjs

@elffjs elffjs commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a ReplayLogger gqlgen extension that emits one structured log line per operation from developers on a configured allowlist, containing the raw query, variables, operation name, JWT subject, and vehicle token ID — everything needed to replay the request against a test environment.
  • New RECORDED_DEVELOPERS setting: comma-separated developer license addresses (comma-separated string because the shared env loader only overrides scalars). Empty/unset disables recording entirely — the extension is not registered. Invalid addresses fail at startup.
  • Wired through configureGQLExtensions, so the HTTP GraphQL and MCP paths record identically.

Notes

  • Logging is synchronous by design: no shared state to contend on, the write is microseconds against millisecond requests, and fire-and-forget would silently drop records on shutdown or pile up goroutines if stdout stalls.
  • Address matching normalizes via common.HexToAddress, so config casing vs. JWT checksum casing doesn't matter.
  • Harvest records from the log pipeline by filtering on message query replay record and the developer field.

Test plan

  • go test ./internal/queryRecorder/ — covers allowlist parsing, a recorded request (field-level assertions on the JSON line), non-allowlisted developers, and unauthenticated requests.
  • make lint clean.

🤖 Generated with Claude Code

elffjs and others added 2 commits July 21, 2026 14:06
Add a ReplayLogger gqlgen extension that emits one structured log line
per operation submitted by a developer on the RECORDED_DEVELOPERS
allowlist. Each line carries the raw query, variables, operation name,
subject, and vehicle token ID so requests can be replayed against test
environments. Recording is disabled when the setting is empty; both the
HTTP GraphQL and MCP paths are covered.

Co-Authored-By: Claude Fable 5 <[email protected]>
@elffjs
elffjs merged commit 969551c into main Jul 21, 2026
4 checks passed
@elffjs
elffjs deleted the feat/query-replay-logging branch July 21, 2026 18:16
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