Skip to content

Commit 8f4d150

Browse files
mikolalysenkoclaude
andcommitted
fix CI: admit maven at the vendor service gate; clippy manual_strip
- Add "maven" to SERVICE_ECOSYSTEMS in the vendor dispatch gate. The maven backend has a full service path (prebuilt jar download + registry pom) and its own errors advise --vendor-source=service, which the gate dead-ended with vendor_service_unsupported_ecosystem. Unblocks the PR #117 regression guard service_mode_gate_admits_maven failing on all platforms. Also syncs the stale ecosystem list in the comment and refusal message (both omitted nuget and maven). - vex/product.rs: use strip_prefix instead of manual starts_with + slice (clippy::manual_strip, -D warnings). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 73439b3 commit 8f4d150

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

crates/socket-patch-cli/src/commands/vendor.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,25 @@ pub(crate) async fn dispatch_vendor_one(
109109
let eco = ecosystem_dir_for_purl(purl)?;
110110

111111
// Prebuilt service downloads now cover every vendorable ecosystem: npm,
112-
// pypi, cargo, golang, composer, and gem. Gem's `.gem` archive doesn't
113-
// carry the eval-able stub gemspec a bundler path source wants, so the
114-
// converter generates it and serves it as a `gem-stub-gemspec` second
115-
// artifact alongside the `.gem` (the gem backend downloads + verifies both).
112+
// pypi, cargo, golang, composer, gem, nuget, and maven. Gem's `.gem`
113+
// archive doesn't carry the eval-able stub gemspec a bundler path source
114+
// wants, so the converter generates it and serves it as a
115+
// `gem-stub-gemspec` second artifact alongside the `.gem` (the gem backend
116+
// downloads + verifies both).
116117
// Under fail-closed `service` mode, refuse any not-covered ecosystem with a
117118
// clear message rather than silently building (which would violate the
118119
// contract). Under `auto`/`build` they fall through to the local build.
119-
const SERVICE_ECOSYSTEMS: &[&str] =
120-
&["npm", "pypi", "cargo", "golang", "composer", "gem", "nuget"];
120+
const SERVICE_ECOSYSTEMS: &[&str] = &[
121+
"npm", "pypi", "cargo", "golang", "composer", "gem", "nuget", "maven",
122+
];
121123
if let Some(cfg) = service {
122124
if cfg.source.requires_service() && !SERVICE_ECOSYSTEMS.contains(&eco) {
123125
return Some(VendorOutcome::Refused {
124126
code: "vendor_service_unsupported_ecosystem",
125127
detail: format!(
126128
"--vendor-source=service is not supported for `{eco}` \
127-
(prebuilt downloads cover npm, pypi, cargo, golang, composer, and gem); \
129+
(prebuilt downloads cover npm, pypi, cargo, golang, composer, \
130+
gem, nuget, and maven); \
128131
use --vendor-source=auto or --vendor-source=build"
129132
),
130133
});

crates/socket-patch-core/src/vex/product.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ fn scan_toml_section(content: &str, section: &str) -> Option<(String, String)> {
140140
if line.is_empty() || line.starts_with('#') {
141141
continue;
142142
}
143-
if line.starts_with('[') {
143+
if let Some(rest) = line.strip_prefix('[') {
144144
// A header may carry a trailing comment (`[package] # x`)
145145
// and whitespace inside the brackets (`[ package ]`) —
146146
// both valid TOML that cargo and tomllib accept. Anything
147147
// else after the closing bracket means a different (or
148148
// malformed) section.
149-
in_section = match line[1..].split_once(']') {
149+
in_section = match rest.split_once(']') {
150150
Some((inner, after)) => {
151151
let after = after.trim_start();
152152
(after.is_empty() || after.starts_with('#')) && inner.trim() == section

0 commit comments

Comments
 (0)