-
-
Notifications
You must be signed in to change notification settings - Fork 0
Enhance provenance display and refine completions in numan #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
fa1c937
e1d28e5
2afc50e
1ac335b
18d662f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,11 @@ pub fn format_info(pkg: &Package, platform: &Platform, nu: Option<&NuVersion>) - | |
| } | ||
| _ => {} | ||
| } | ||
| out.push_str("Status: verified upstream artifact\n"); | ||
| if pkg.id.owner == "numan-maintained" { | ||
| out.push_str("Status: numan-maintained fork (not a verified upstream artifact)\n"); | ||
|
Comment on lines
+38
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For an actual Useful? React with 👍 / 👎. |
||
| } else { | ||
| out.push_str("Status: verified upstream artifact\n"); | ||
| } | ||
| out.push_str(&format!("Description: {}\n", pkg.description)); | ||
| out.push_str(&format!("Repository: {}\n", pkg.repo)); | ||
| if !pkg.tags.is_empty() { | ||
|
|
@@ -79,6 +83,10 @@ pub fn format_info(pkg: &Package, platform: &Platform, nu: Option<&NuVersion>) - | |
| )); | ||
| } | ||
|
|
||
| if ver.provenance.as_deref() == Some("commit-snapshot") { | ||
| out.push_str(" note: built from a commit snapshot, not a tagged release\n"); | ||
| } | ||
|
|
||
| if let Some(ref source) = ver.source { | ||
| out.push_str(&format!(" source git: {}\n", source.git)); | ||
| out.push_str(&format!(" source rev: {}\n", source.rev)); | ||
|
|
@@ -161,6 +169,7 @@ mod tests { | |
| }), | ||
| dependencies: BTreeMap::new(), | ||
| activation: None, | ||
| provenance: None, | ||
| }], | ||
| } | ||
| } | ||
|
|
@@ -195,6 +204,32 @@ mod tests { | |
| assert!(out.contains("cargo_name: nu_plugin_highlight"), "{out}"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn format_info_notes_commit_snapshot_provenance() { | ||
| let mut pkg = sample_plugin(false); | ||
| pkg.versions[0].provenance = Some("commit-snapshot".to_string()); | ||
| let out = format_info(&pkg, &linux_platform(), None); | ||
| assert!( | ||
| out.contains("built from a commit snapshot, not a tagged release"), | ||
| "{out}" | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn format_info_omits_provenance_note_when_absent() { | ||
| let pkg = sample_plugin(false); | ||
| let out = format_info(&pkg, &linux_platform(), None); | ||
| assert!(!out.contains("commit snapshot"), "{out}"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn format_info_omits_provenance_note_for_other_values() { | ||
| let mut pkg = sample_plugin(false); | ||
| pkg.versions[0].provenance = Some("tagged-release".to_string()); | ||
| let out = format_info(&pkg, &linux_platform(), None); | ||
| assert!(!out.contains("commit snapshot"), "{out}"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn format_info_omits_source_lines_when_absent() { | ||
| let pkg = sample_plugin(false); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a custom registry is configured as the default, its index can assign any package the
numan-maintainedowner, andfind_package()returns that package without preserving registry or signer identity. This branch therefore presents a third party's package as a Numan-maintained fork solely from an unreserved string; only emit this ownership claim when the package came from the verified official trust root, or qualify it with the actual registry identity.AGENTS.md reference: AGENTS.md:L148-L148
Useful? React with 👍 / 👎.