Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

test(breg): postgres_startup needs the tooling feature its required-features does not declare

Đang mở Phù hợp với người mới
#2,307 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jeremi đang làm issue này rồi.

Từ ngày 22/10/2026.

  • #2305 của @jeremi — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, postgresql, rust
Lĩnh vực
build-system, testing

Hướng nghiên cứu

Đọc crates/registry-breg/Cargo.toml cùng với các khai báo tính năng của những đích kiểm thử tương tự, sau đó kiểm tra crates/registry-breg/tests/postgres_startup.rs quanh lời gọi runtime_pool_for_test() không được bảo vệ bằng điều kiện và phần định nghĩa hàm này trong crates/registry-breg/src/startup.rs. Tái hiện lỗi bằng lệnh được báo cáo cargo check --locked -p registry-breg --features postgres-test --test postgres_startup. Công việc hoàn tất khi tập tính năng đã khai báo biên dịch được, với kiểm thử được đặt điều kiện phù hợp hoặc các tính năng bắt buộc của đích được cập nhật.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area:breg bug

Problem

The BReg postgres_startup integration target declares required-features = ["postgres-test"], but one of its ungated tests calls a method that exists only with tooling as well. cargo test -p registry-breg --features postgres-test --test postgres_startup therefore fails to compile. CI and products/breg/scripts/test-postgres.sh always pass postgres-test,tooling,schema, so only a local run with the declared feature set hits it.

Where (line numbers on origin/main 0faf3710a; same content on jeremi/documents, where some lines shift)

  • crates/registry-breg/Cargo.toml lines 556 to 559: [[test]] name = "postgres_startup", required-features = ["postgres-test"]. Its siblings postgres_migration (lines 114 to 117) and schema_fingerprint_rehearsal (lines 239 to 242) declare ["postgres-test", "tooling"].
  • crates/registry-breg/tests/postgres_startup.rs line 874, inside prepared_server_sessions_are_named_bounded_and_pg_stat_statements_stays_unavailable_until_preloaded (lines 820 to 821), which carries no cfg: prepared.runtime_pool_for_test().
  • crates/registry-breg/src/startup.rs lines 769 to 772: runtime_pool_for_test is #[cfg(all(feature = "postgres-test", feature = "tooling"))].
  • The file already gates its other tooling-only tests (#[cfg(feature = "tooling")] at lines 974, 983, 989 and 1185), so this one looks like a missed gate rather than a policy.
  • The CI command: products/breg/scripts/test-postgres.sh line 45 (--features postgres-test,tooling,schema, which includes --test postgres_startup at line 100), called from .github/workflows/ci.yml line 1306.

What goes wrong

A contributor who runs the target with the feature set Cargo.toml declares gets a compile error (no method runtime_pool_for_test) instead of a test run. .github/scripts/check_breg_gated_tests.py does not catch this: it checks that every gated test is selected by some CI command, not that a target compiles with its own required-features.

Proposed direction

Pick one:

  • (a) Declare required-features = ["postgres-test", "tooling"] for postgres_startup, as its siblings do, and drop the now redundant #[cfg(feature = "tooling")] gates in the file. Simplest; CI already passes both.
  • (b) Gate the one test with #[cfg(feature = "tooling")], keeping the rest of the target runnable with postgres-test alone.

Optionally, add a CI or check_breg_gated_tests.py check that builds each [[test]] with exactly its required-features (cargo check --tests), so the next drift is caught.

Notes

  • Confirmed in code: the required-features line, the ungated call at line 874, the cfg on runtime_pool_for_test, and the CI and script feature sets. I checked the other imports and harness items against their gates (migration, package, postgres, startup modules are runtime; the _for_test helpers, attachment_store::test_support and audit::test_support are postgres-test; install_compiled_schema is tooling or postgres-test) and found no other tooling-only item outside a gate. I did not build it.
  • Confirmed by a build on the PR #2305 branch (cargo 1.95.0, macOS): cargo check --locked -p registry-breg --features postgres-test --test postgres_startup fails with one error, error[E0599]: no method named runtime_pool_for_test found for struct PreparedServer, at line 874, and could not compile registry-breg (test "postgres_startup") due to 1 previous error. That branch changes these files, but the three pieces involved (the required-features line, the cfg on runtime_pool_for_test, the ungated call) read the same on origin/main; main itself was not built.
Ngôn ngữ chính
Rust
Star
2
Fork
0
Merge trung bình
9 giờ 43 phút
Pull request đã merge (30 ngày)
268

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của registrystack/registry-stack

Tất cả issue của registrystack/registry-stack

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.