bigquery, bigquery-derive: hide macro implementation details behind #[doc(hidden)] pub mod __private before 1.0
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Start with src/bigquery/src/query/from_sql.rs, src/bigquery/src/query.rs, and src/bigquery-derive/src/lib.rs, then read the linked contributor guide section on proc-macro crates. Trace the derive-generated calls and the runtime types they need before changing the public API. Done means generated code routes through the hidden module, the derive crate documents its supported imports, and both crates receive compatible breaking version bumps.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
google-cloud-bigquery and google-cloud-bigquery-derive currently expose procedural-macro implementation details directly in google-cloud-bigquery's documented public API (google_cloud_bigquery::query) and emit calls directly to user-facing methods instead of routing generated code through a #[doc(hidden)] pub mod __private module.
Because google-cloud-bigquery was recently bumped to 1.0.0 on main (#7424, not yet released), shipping 1.0.0 as-is will freeze macro-internal types and trait methods under 1.x SemVer.
Problem Details
Per Rust proc-macro conventions (serde::__private, thiserror::__private, etc.), README.md ("any public symbol that is not part of the public API have the #[doc(hidden)] attribute set"), and doc/contributor/howto-guide-handwritten-client-api.md:
Generated code calls only a
#[doc(hidden)] pub mod __privatemodule in the runtime crate, never the user-facing API. Otherwise every method used by the generated code is frozen, andcargo-semver-checkscannot detect violations.
Currently:
- Derive-only types and methods are exposed in
google_cloud_bigquery::query:google_cloud_bigquery::query::SqlValue(src/bigquery/src/query/from_sql.rs, re-exported insrc/bigquery/src/query.rs) is not returned or accepted by any user-facingRowor client API; it only exists to pass cell data intoFromSql::from_value.SqlValue::takeexplicitly documents that it is "Used by the#[derive(FromSql)]macro to extract struct fields", yet neitherSqlValuenorSqlValue::takeis marked#[doc(hidden)].FromSqlhas a rustdoc warning ("Do not implement this trait directly. ... New methods (such as Arrow conversion methods) may be added in future versions, which would break manual implementations"), butFromSqlis not sealed via a#[doc(hidden)]supertrait andFromSql::from_value(value: SqlValue)is not#[doc(hidden)]. Prose warnings do not exclude public traits or methods from SemVer orcargo-semver-checks.
- Generated code calls user-facing methods and unrooted paths directly (
src/bigquery-derive/src/lib.rs):#[derive(FromRow)]expands torow.take(...)ongoogle_cloud_bigquery::query::Rowand spellsstd::convert::TryFrom,std::result::Result,google_cloud_bigquery::query::Row, andgoogle_cloud_bigquery::error::RowErrorwithout leading::.#[derive(FromSql)]expands tovalue.take(...)ongoogle_cloud_bigquery::query::SqlValueand spellsgoogle_cloud_bigquery::query::{FromSql, SqlValue}andgoogle_cloud_bigquery::error::ConvertErrorwithout leading::.- Using dot-call syntax (
row.take(...),value.take(...)) on unprefixedrow/valuelocals instead of fully qualified function calls in__privatefreezes user-facing method signatures and risks method-resolution ambiguity if an in-scope extension trait defines.take(...). - Generated
implblocks are not enclosed inconst _: () = { ... };.
- Crate-level rustdoc on
google-cloud-bigquery-derivepublishes maintainer policy:src/bigquery-derive/src/lib.rsuses//!doc comments for internal# Compatibility/## Contract testsCI instructions instead of//comments, and does not advise users to importFromRow/FromSqlfromgoogle_cloud_bigquery::queryrather than depending ongoogle-cloud-bigquery-derivedirectly.
- Version skew note from #7424:
- #7424 bumped
google-cloud-bigqueryfrom0.19.0to1.0.0while leavinggoogle-cloud-bigquery-deriveat0.2.0. When migratinggoogle-cloud-bigquery-deriveto call::google_cloud_bigquery::__private,google-cloud-bigquery-derivemust also take a breaking bump (0.3.0or1.0.0) sogoogle-cloud-bigquery 0.19.0(which depends on^0.2.0) does not resolve a0.2.xpatch release that references__private.
- #7424 bumped
Expected Behavior
- Add
#[doc(hidden)] pub mod __privateat the root ofgoogle-cloud-bigqueryexposing only the internal types, traits, re-exports (Result,TryFrom), and helper functions needed bygoogle-cloud-bigquery-derive. - Remove
SqlValuefromgoogle_cloud_bigquery::query's public exports. - Keep
google_cloud_bigquery::query::FromSqlpublicly nameable as a trait bound (forRow::get<T: FromSql>,Row::take<T: FromSql>, and generic callers), while sealing it / movingfrom_valueonto a#[doc(hidden)]supertrait in__privateso manual external implementations are prevented at the type/doc level rather than only by a prose warning. - Update
google-cloud-bigquery-deriveto emitconst _: () = { ... };blocks referencing only::core::.../::google_cloud_bigquery::__private::...via fully qualified function calls. - Convert the maintainer
# Compatibilitysection insrc/bigquery-derive/src/lib.rsfrom//!to//comments and add brief user-facing crate docs pointing togoogle_cloud_bigquery::query::{FromRow, FromSql}. - Take a breaking version bump on
google-cloud-bigquery-derivealongsidegoogle-cloud-bigquery1.0.0.
- Ngôn ngữ chính
- Rust
- Star
- 972
- Fork
- 163
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 202
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/google-cloud-rust
-
api: storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
googleapis/google-cloud-rust#7344 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BytesValue in Any rejects unpadded and URL-safe base64Có thể đã có người làm @akasakariko đã nhận 15 ngày trước. Đang mởpriority: p2 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/google-cloud-rust#6714 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: bug
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 75/100
googleapis/google-cloud-rust#6710 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/google-cloud-rust#6709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/google-cloud-rust#6707 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/google-cloud-rust
Issue tương tự
-
bug UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
wardian-app/Wardian#1746 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug user-sprint
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Vondor/KassenSturz#967 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mailĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
rustmailer/bichon#411 ·