Skip to content

crates/stdlib: add binary_from attr to mark packages with fetched binaries - #157

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/checkers
Apr 24, 2026
Merged

twitchyliquid64 merged 1 commit into
mainfrom
tom/checkers

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

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

    • New binary_from attribute in the standard library that accepts and validates URL strings (http/https/ftp/git).
  • Updates

    • Standard library bumped to version 0.0.12.
  • Tests

    • Added tests covering valid binary_from URLs and invalid/unsupported schemes.

@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Bumps the stdlib crate version from 0.0.11 to 0.0.12 in workspace and package manifests, adds a new public attribute contract binary_from (String URL validator) to the minimal attribute-class schema, and updates decoder tests to exercise success and error paths for binary_from.

Changes

Cohort / File(s) Summary
Version Bump
Cargo.toml, crates/stdlib/Cargo.toml
Increment stdlib version metadata from 0.0.11 → 0.0.12 in workspace and package manifests.
Attribute Schema Extension
crates/stdlib/minimal-ncl/attr_classes.ncl
Add new public attribute contract binary_from with String type and URL-scheme validation (http/https/ftp/git).
Decoder Tests
crates/decode/src/attrs.rs
Replace/extend tests to cover binary_from error path (unsupported scheme) and success path (https://...) using the Loader API.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I found a bump upon the trail,

version hop and schema sail,
"binary_from" now hops in line,
URLs snug, validations fine,
nibble tests, release looks hale. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new binary_from attribute to mark packages with fetched binaries.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tom/checkers

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 37bef2d and 0238e28.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml
  • crates/stdlib/Cargo.toml
  • crates/stdlib/minimal-ncl/attr_classes.ncl

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
crates/decode/src/attrs.rs (1)

267-281: Strengthen the success-path assertion beyond is_ok().

assert!(res.is_ok()) proves loading succeeds, but not that binary_from survives decoding with the expected value. Consider asserting the decoded attrs record contains binary_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

📥 Commits

Reviewing files that changed from the base of the PR and between 0238e28 and ef99a5c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/decode/src/attrs.rs
  • crates/stdlib/Cargo.toml
  • crates/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

@twitchyliquid64
twitchyliquid64 enabled auto-merge (rebase) April 24, 2026 19:08

@mitodrummer mitodrummer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@twitchyliquid64
twitchyliquid64 merged commit d5f7a13 into main Apr 24, 2026
8 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/checkers branch April 24, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants