Skip to content

feat(tui): integrate body decoder registry for protobuf/gRPC display#26

Merged
kostyay merged 8 commits into
mainfrom
feat/bodydecoder-registry
Feb 24, 2026
Merged

feat(tui): integrate body decoder registry for protobuf/gRPC display#26
kostyay merged 8 commits into
mainfrom
feat/bodydecoder-registry

Conversation

@kostyay

@kostyay kostyay commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wire BodyDecoderRegistry interface through TUI ports so the detail view decodes protobuf and gRPC-Web bodies into human-readable text
  • Registry initialized in main.go with optional .proto file loading via --proto-path flag; raw wire-format decoding always available
  • Refactor renderDetailBody pipeline to thread renderOpts (decoder, dark-bg, pretty-print, collapsed state) instead of positional args
  • Remove protobuf/gRPC MIME types from highlight binary blocklist since they're now decoded
  • Fix gosec G115 (integer overflow) in gRPC-Web frame parser with safe uint64 comparison
  • Add generate-proto Makefile target for buf codegen
  • E2E harness gains withBodyDecoder option + new gRPC Connect round-trip test

Test plan

  • make lint — 0 issues
  • make test — all pass with race detection
  • make security — G115 resolved; only generated-code G103 remains
  • Manual: run httpmon --proto-path=<dir> and verify protobuf bodies render as decoded text in detail view

🤖 Generated with Claude Code

kostyay and others added 8 commits February 24, 2026 15:37
Introduces the pluggable body decoder architecture. Registry routes
by content type to the first matching decoder; returns ErrNoDecoder
on miss so callers can fall through to existing highlight behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Config persists proto_paths in ~/.httpmon/config.json (omitempty).
Repeatable --proto-path flag merges after config paths. Enables
proto file discovery for upcoming protobuf body decoder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Decodes protobuf wire format into JSON with field numbers as keys.
Handles varints, fixed32/64, length-delimited (nested messages, strings,
base64 binary), repeated fields, and groups. Returns application/json
for downstream syntax highlighting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Parses gRPC-Web framing (1-byte flags + 4-byte BE length), extracts
data frames, skips trailers, notes compressed frames. Truncated
frames decoded partially with annotation. Delegates payload to
RawProtobufDecoder.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compiles .proto files via bufbuild/protocompile into a ProtoRegistry.
Resolves gRPC service/method from request path (supports arbitrary
prefix). Named decode uses dynamicpb + protojson for field names;
falls back to raw wire decode on unknown service or unmarshal failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire BodyDecoderRegistry through TUI ports so detail view can decode
protobuf and gRPC-Web bodies into human-readable text. Includes:

- Registry wiring in main.go with proto file loading
- renderOpts refactor to thread decoder through detail pipeline
- Remove protobuf MIME types from binary blocklist (now decoded)
- E2E harness support for body decoder + gRPC Connect test
- Fix gosec G115: safe uint64 cast in gRPC-Web frame parser
- Makefile generate-proto target for buf codegen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Lint/test/security run locally; CI was redundant. Release now triggers
on v* tag push directly instead of chaining off CI workflow_run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kostyay kostyay merged commit 8688636 into main Feb 24, 2026
@kostyay kostyay deleted the feat/bodydecoder-registry branch February 24, 2026 16:23
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