Skip to content

fix(protoc-gen-elixir-grpc): leading slash in generated file paths#53

Merged
yordis merged 1 commit into
mainfrom
yordis/elixir-grpc-1
Jun 25, 2026
Merged

fix(protoc-gen-elixir-grpc): leading slash in generated file paths#53
yordis merged 1 commit into
mainfrom
yordis/elixir-grpc-1

Conversation

@yordis

@yordis yordis commented Jun 25, 2026

Copy link
Copy Markdown
Member

When a proto file had no package directory, the generated output path
began with a stray "/" (e.g. "/simple.server.pb.ex"). Build the path
by appending the filename to pathParts before joining, so the result
is a clean relative path.

Also document that Buf's top-level clean: true will delete the
plugin's out directory before generation, and recommend pointing
out at a generated-only directory to avoid losing hand-written
handlers.

Signed-off-by: Yordis Prieto yordis.prieto@gmail.com

When a proto file had no package directory, the generated output path
began with a stray "/" (e.g. "/simple.server.pb.ex"). Build the path
by appending the filename to pathParts before joining, so the result
is a clean relative path.

Also document that Buf's top-level `clean: true` will delete the
plugin's `out` directory before generation, and recommend pointing
`out` at a generated-only directory to avoid losing hand-written
handlers.

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

cursor Bot commented Jun 25, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small path-construction fix and documentation only; no runtime or security-sensitive logic changes.

Overview
Fixes generated server stub paths when a proto has no package (or otherwise empty path segments): output names like simple.server.pb.ex instead of /simple.server.pb.ex, by appending the .server.pb.ex filename to pathParts before joining rather than prefixing with a lone /.

Adds Buf clean: true guidance in the README and main.go package comment: each plugin out is wiped before generation, so out should be a generated-only tree (e.g. lib/generated_grpc) or keep clean: false if handlers live beside stubs.

Tests now expect relative paths without a leading slash.

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

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f77e34b3-d274-4bf0-a6c5-2dff31fa9b9c

📥 Commits

Reviewing files that changed from the base of the PR and between 1669e52 and f8480c3.

📒 Files selected for processing (3)
  • cmd/protoc-gen-elixir-grpc/README.md
  • cmd/protoc-gen-elixir-grpc/main.go
  • cmd/protoc-gen-elixir-grpc/main_test.go

Walkthrough

This PR updates Buf generator guidance for clean: true, changes generated file path construction to avoid a leading slash when no package path exists, and updates tests to match the new filename format.

Changes

Buf output path handling

Layer / File(s) Summary
Buf clean: true guidance
cmd/protoc-gen-elixir-grpc/README.md, cmd/protoc-gen-elixir-grpc/main.go
The README and generator header comments describe Buf clean: true output placement and generated-only output directories.
Filename path construction
cmd/protoc-gen-elixir-grpc/main.go, cmd/protoc-gen-elixir-grpc/main_test.go
generateFilePath appends the server filename segment before joining path parts, and the tests expect the updated generated filenames.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through Buf with a tidy grin,
and tucked the slashless paths right in.
My carrots stayed clean, my burrow stayed bright,
now generated stubs land just right.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/elixir-grpc-1

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.

@yordis yordis marked this pull request as ready for review June 25, 2026 01:29
@yordis yordis merged commit ac4777a into main Jun 25, 2026
3 of 4 checks passed
@yordis yordis deleted the yordis/elixir-grpc-1 branch June 25, 2026 01:29
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