Repository navigation
crates/stdlib: add binary_from attr to mark packages with fetched binaries - #157
Conversation
📝 WalkthroughWalkthroughBumps the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@crates/stdlib/minimal-ncl/attr_classes.ncl`:
- Around line 54-58: The binary_from attribute currently uses validate = String
but must enforce an absolute http(s) URL; update the binary_from entry (name =
"binary from", desc = ..., validate = ...) to use the project's URL
validator/contract (or a new validator) that ensures the value is an absolute
URL with scheme http or https rather than any string; locate the binary_from
block in attr_classes.ncl and replace the String validator with the shared URL
contract (or implement and reference a new Url/HttpUrl validator) so only valid
http(s) URLs are accepted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 17929bad-f0df-4d2d-9f08-6182e06c6ecc
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
Cargo.tomlcrates/stdlib/Cargo.tomlcrates/stdlib/minimal-ncl/attr_classes.ncl
0238e28 to
ef99a5c
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/decode/src/attrs.rs (1)
267-281: Strengthen the success-path assertion beyondis_ok().
assert!(res.is_ok())proves loading succeeds, but not thatbinary_fromsurvives decoding with the expected value. Consider asserting the decoded attrs record containsbinary_from == "https://example.com/bersh.exe".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/decode/src/attrs.rs` around lines 267 - 281, Test attr_binary_from_ok currently only checks success; change it to unwrap or match the Loader::finish() result and assert the decoded Attrs record's binary_from field equals "https://example.com/bersh.exe". Locate the test function attr_binary_from_ok and the use of Loader::new / LoadOptions::for_test / finish(), then replace assert!(res.is_ok()) with code that extracts the Ok value (or panics on Err) and asserts the Attrs struct's binary_from (or its optional/string representation) is exactly the expected URL.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@crates/decode/src/attrs.rs`:
- Around line 267-281: Test attr_binary_from_ok currently only checks success;
change it to unwrap or match the Loader::finish() result and assert the decoded
Attrs record's binary_from field equals "https://example.com/bersh.exe". Locate
the test function attr_binary_from_ok and the use of Loader::new /
LoadOptions::for_test / finish(), then replace assert!(res.is_ok()) with code
that extracts the Ok value (or panics on Err) and asserts the Attrs struct's
binary_from (or its optional/string representation) is exactly the expected URL.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4a995b1c-3764-469e-9d65-946e499f9a4f
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
Cargo.tomlcrates/decode/src/attrs.rscrates/stdlib/Cargo.tomlcrates/stdlib/minimal-ncl/attr_classes.ncl
✅ Files skipped from review due to trivial changes (2)
- crates/stdlib/Cargo.toml
- Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (1)
- crates/stdlib/minimal-ncl/attr_classes.ncl
Intended for stuff like
claude-code, which is closed-source and downloaded from a URL.Lets us mark this fact, also we can surface it in the pkgs website.
Summary by CodeRabbit
New Features
binary_fromattribute in the standard library that accepts and validates URL strings (http/https/ftp/git).Updates
Tests
binary_fromURLs and invalid/unsupported schemes.