extern_path only matches package prefixes — per-type FQN mappings are silently ignored
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start with connectrpc-codegen/src/codegen.rs, especially TypeResolver::resolve_path, rust_type, rust_view_type, and the require_extern checks, then inspect the buffa CodeGenContext::for_generate dependency and anthropics/buffa#111. Extend wkt_types_use_buffa_types_extern_path and extern_catchall_with_wkt_longest_wins with per-type and nested-type cases; done means service paths, view paths, and errors remain correct after buffa supports the mapping.
Written by the indexing model from the issue text.
Description
Problem
extern_path only matches at the proto package prefix level — a mapping for a specific type FQN is silently ignored. This is the same gap as anthropics/buffa#111, surfacing through connectrpc-codegen because it reuses buffa-codegen's type resolution.
This came up while working with Buf on the BSR Cargo SDK plugins. BSR's SDK assembly injects extern_path mappings to point a downstream plugin's generated code at the upstream module's SDK crate. Module-level (package-prefix) injection works today; per-type injection does not, which prost/tonic support and which BSR could rely on if a single proto package's files were ever split across more than one BSR module.
Where the limitation lives
TypeResolver (connectrpc-codegen/src/codegen.rs) wraps buffa_codegen::context::CodeGenContext::for_generate() so that service-stub input/output paths are byte-identical to what buffa emits for message fields:
struct TypeResolver<'a> {
ctx: buffa_codegen::context::CodeGenContext<'a>,
require_extern: bool,
}
impl<'a> TypeResolver<'a> {
fn new(...) -> Self {
Self {
ctx: buffa_codegen::context::CodeGenContext::for_generate(proto_file, file_to_generate, config),
require_extern,
}
}
}
CodeGenContext matches extern_paths against each file's package, never against a type FQN, so a per-type mapping like extern_path=.google.protobuf.Timestamp=::other_crate::Ts is dead — see anthropics/buffa#111 for the details and the prost comparison.
What this needs in connect-rust
The fix lands in buffa-codegen and connectrpc-codegen should inherit it for free via for_generate() — that's the whole point of the TypeResolver design. But there is connect-rust-specific surface to verify once buffa supports per-type matching:
TypeResolver::resolve_path/rust_type— service method input/output owned types under a per-type override.TypeResolver::rust_view_type— view paths useCodeGenContext::rust_type_relative_splitto find the package boundary and insert the__buffa::view::sentinel; a per-type override changes where that boundary falls.- The
require_externmode used bygenerate_services— it currently rejects any path that isn't::/crate::-rooted with an error message that suggestsextern_path=.=<…>. The error text and the checks should still hold up when a per-type override is present. - Tests: extend
wkt_types_use_buffa_types_extern_pathandextern_catchall_with_wkt_longest_winswith a per-type override case; add a nested-type case.
Status
Tracking only. Blocked on anthropics/buffa#111. No implementation planned until Buf confirms the per-type case is something BSR's SDK assembly actually emits — module-level extern_path injection has been sufficient for the BSR plugin work so far.
- Dominant language
- Rust
- Stars
- 544
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from connectrpc/connect-rust
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
connectrpc/connect-rust#360 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
connectrpc/connect-rust#358 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 53/100
connectrpc/connect-rust#355 ·
-
Streaming request body errors are always reported as `internal`Possibly taken @AhmedElBanna80 claimed this 18 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
connectrpc/connect-rust#352 ·
-
Difficulty 3/5 Half a day Newbie friendliness 48/100
connectrpc/connect-rust#349 ·
All issues in connectrpc/connect-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
Maintainers usually reply within 17 days
-
bug rust SDK & CLI & REST API
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
boxlite-ai/boxlite#3292 ·
Maintainers usually reply within 1 day
-
Android bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anefzaoui/misterdownloadmanager#2516 ·
Maintainers usually reply within 1 day
-
editor ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
state:triage tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 89/100
agent8-cash/ethpayserver#731 ·
Maintainers usually reply within 1 day