Skip to content

feat(template): derive ErrorTemplate from proto Template option#20

Open
yordis wants to merge 3 commits intomainfrom
yordis/feat-template-from-proto
Open

feat(template): derive ErrorTemplate from proto Template option#20
yordis wants to merge 3 commits intomainfrom
yordis/feat-template-from-proto

Conversation

@yordis
Copy link
Copy Markdown
Member

@yordis yordis commented May 6, 2026

  • Lets services declare their error contract once in proto and pick it up in Go without hand-rewriting the same domain/reason/code/visibility/help/metadata in two places.
  • Field-level FieldOptions (visibility, value/default_value) drive per-instance metadata, so a populated proto message becomes a fully-formed error without per-call boilerplate.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented May 6, 2026

PR Summary

Medium Risk
Adds protobuf-reflection-based template construction and metadata derivation, which changes how errors can be generated and introduces new dependencies/tooling for codegen. Main risk is correctness/compatibility of proto option parsing and derived metadata behavior across message types.

Overview
Adds NewErrorTemplateFromProto and ErrorTemplate.FromProto to construct templates from protobuf message-level template options and derive per-instance metadata from annotated fields (including fixed-value and default-value policies).

Extends ErrorTemplate/NewError creation to carry template metadata into produced errors, and adds comprehensive examples/tests plus proto + generated Go testdata to validate behavior.

Updates repo tooling: introduces buf.gen.yaml and buf module config/lock for test protos, adds a CI job to ensure generated code is committed, and bumps Go to 1.26 with new trogonproto/protobuf dependencies.

Reviewed by Cursor Bugbot for commit 6191c3f. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@yordis has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 32 minutes and 38 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4045977-8ba8-49a2-b5ce-ace95091500b

📥 Commits

Reviewing files that changed from the base of the PR and between 2679893 and 6191c3f.

⛔ Files ignored due to path filters (3)
  • go.sum is excluded by !**/*.sum
  • internal/testdata/gen/trogonerror/testdata/v1/errors.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • internal/testdata/proto/buf.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .gitattributes
  • .github/workflows/ci.yml
  • buf.gen.yaml
  • error.go
  • example_test.go
  • go.mod
  • internal/testdata/proto/buf.yaml
  • internal/testdata/proto/trogonerror/testdata/v1/errors.proto
  • template_proto.go
  • template_proto_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/feat-template-from-proto

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

yordis added 2 commits May 5, 2026 23:08
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…mapping

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.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