| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: f9eda925-fb6b-4ccd-8e74-f19c2e0dcc14 📥 CommitsReviewing files that changed from the base of the PR and between a6f57bb and 9f877e1. 📒 Files selected for processing (5)
📝 Walkthrough WalkthroughRefactors version and Git metadata handling to build-time: build.rs now emits new environment variables and formatted timestamps; version.rs exposes compile-time constants derived from env!; sys and settings are updated to read the new constants instead of runtime helper functions. ChangesBuild-time version metadata refactoring
Sequence Diagram(s)sequenceDiagram
participant Build as build.rs (build script)
participant Env as compile env (RUSTPYTHON_*)
participant Version as crates::vm::version (compile-time)
participant Runtime as sys/settings (runtime)
Build->>Env: emit RUSTPYTHON_GIT_IDENTIFIER, RUSTPYTHON_BUILD_INFO, RUSTPYTHON_VERSION_LEFT/RIGHT, RUSTPYTHON_RELEASE_LEVEL_N
Env-->>Version: env! reads (MAJOR/MINOR/..., GIT_IDENTIFIER, RUSTPYTHON_BUILD_INFO, VERSION_LEFT/RIGHT)
Version->>Runtime: expose constants (RUSTPYTHON_VERSION, GIT_IDENTIFIER, WINVER)
Runtime->>Version: read constants for sys.version, sys._git, settings::version()
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem🚥 Pre-merge checks | ✅ 4 | ❌ 1 ❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches 🧪 Generate unit tests (beta)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands and usage tips. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)crates/vm/build.rs (1)73-81: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win
Use SOURCE_DATE_EPOCH and UTC timezone for reproducible build metadata.
The git_timestamp() function uses SystemTime::now() as a fallback, and get_git_timestamp_datetime() converts that Unix epoch to DateTime<Local> (line 129), then formats it with patterns like "%b %e %Y" (line 136) and "%H:%M:%S" (line 141). This embeds local timezone information and current system time into RUSTPYTHON_BUILD_INFO, producing different formatted timestamps across equivalent builds in different timezones or at different times. The code already references reproducible-builds.org on line 98 but does not honor the spec. The reproducible-builds standard requires checking SOURCE_DATE_EPOCH and using stable (UTC) timezone rendering to ensure identical sources produce identical binaries.
Suggested fix🤖 Prompt for AI Agents-use chrono::{Local, prelude::DateTime}; +use chrono::{Utc, prelude::DateTime}; use core::time::Duration; @@ fn git_timestamp() -> String { - git(&["log", "-1", "--format=%ct"]).unwrap_or_else(|_| { - SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap_or_default() - .as_secs() - .to_string() - }) + env::var("SOURCE_DATE_EPOCH") + .ok() + .or_else(|| git(&["log", "-1", "--format=%ct"]).ok()) + .unwrap_or_else(|| { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap_or_default() + .as_secs() + .to_string() + }) } @@ -fn get_git_timestamp_datetime() -> DateTime<Local> { +fn get_git_timestamp_datetime() -> DateTime<Utc> { let timestamp = git_timestamp().parse::<u64>().unwrap_or_default(); let datetime = UNIX_EPOCH + Duration::from_secs(timestamp); - datetime.into() + DateTime::<Utc>::from(datetime) }Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/vm/build.rs` around lines 73 - 81, The git_timestamp()/get_git_timestamp_datetime() logic must honor SOURCE_DATE_EPOCH and always render timestamps in UTC for reproducible builds: change git_timestamp() to first look for the SOURCE_DATE_EPOCH env var and use that value (as a Unix epoch string) if present; only fall back to the git log output or SystemTime::now() when SOURCE_DATE_EPOCH is absent; update get_git_timestamp_datetime() to parse the epoch into a UTC DateTime (use chrono::Utc or equivalent) instead of DateTime<Local> and format with UTC-based patterns so RUSTPYTHON_BUILD_INFO is produced deterministically across timezones and builds.
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@crates/vm/build.rs`: - Around line 207-214: The match arm in function release_to_n currently uses unreachable!() for unknown release strings, causing an opaque panic; update release_to_n to explicitly panic with a clear, actionable message (including the received release value and that it came from RUSTPYTHON_RELEASE_LEVEL) so typos/invalid values produce a descriptive error instead of an opaque build-script panic. --- Outside diff comments: In `@crates/vm/build.rs`: - Around line 73-81: The git_timestamp()/get_git_timestamp_datetime() logic must honor SOURCE_DATE_EPOCH and always render timestamps in UTC for reproducible builds: change git_timestamp() to first look for the SOURCE_DATE_EPOCH env var and use that value (as a Unix epoch string) if present; only fall back to the git log output or SystemTime::now() when SOURCE_DATE_EPOCH is absent; update get_git_timestamp_datetime() to parse the epoch into a UTC DateTime (use chrono::Utc or equivalent) instead of DateTime<Local> and format with UTC-based patterns so RUSTPYTHON_BUILD_INFO is produced deterministically across timezones and builds.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 049c90f6-085c-49b0-a376-3faee648595a
📥 CommitsReviewing files that changed from the base of the PR and between 883ce9d and a6f57bb.
📒 Files selected for processing (5)
Sorry, something went wrong.
| fn release_to_n(release: &str) -> usize { | ||
| match release { | ||
| "alpha" => 0xA, | ||
| "beta" => 0xB, | ||
| "candidate" => 0xC, | ||
| "final" => 0xD, | ||
| _ => unreachable!(), | ||
| } |
There was a problem hiding this comment.
⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
Make invalid release levels fail with an actionable message.
Line 213 turns a typo in RUSTPYTHON_RELEASE_LEVEL into an opaque build-script panic. An explicit panic message here is much easier to diagnose.
Suggested fix fn release_to_n(release: &str) -> usize {
match release {
"alpha" => 0xA,
"beta" => 0xB,
"candidate" => 0xC,
"final" => 0xD,
- _ => unreachable!(),
+ _ => panic!("unsupported RUSTPYTHON_RELEASE_LEVEL: {release}"),
}
}‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn release_to_n(release: &str) -> usize { | |
| match release { | |
| "alpha" => 0xA, | |
| "beta" => 0xB, | |
| "candidate" => 0xC, | |
| "final" => 0xD, | |
| _ => unreachable!(), | |
| } | |
| fn release_to_n(release: &str) -> usize { | |
| match release { | |
| "alpha" => 0xA, | |
| "beta" => 0xB, | |
| "candidate" => 0xC, | |
| "final" => 0xD, | |
| _ => panic!("unsupported RUSTPYTHON_RELEASE_LEVEL: {release}"), | |
| } | |
| } |
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/vm/build.rs` around lines 207 - 214, The match arm in function release_to_n currently uses unreachable!() for unknown release strings, causing an opaque panic; update release_to_n to explicitly panic with a clear, actionable message (including the received release value and that it came from RUSTPYTHON_RELEASE_LEVEL) so typos/invalid values produce a descriptive error instead of an opaque build-script panic.
Sorry, something went wrong.
`version.rs` essentially consists of constants that can be baked in at compile time. I moved most of `version.rs` to `build.rs`. The constants are passed via rustc's environment then stored in the binary.
There was a problem hiding this comment.
tysm!
Sorry, something went wrong.
`version.rs` essentially consists of constants that can be baked in at compile time. I moved most of `version.rs` to `build.rs`. The constants are passed via rustc's environment then stored in the binary.
| Back | FazBrowse Home | New Git URL |
version.rs essentially consists of constants that can be baked in at compile time. I moved most of version.rs to build.rs. The constants are passed via rustc's environment then stored in the binary.
Summary by CodeRabbit
Refactor
Chores