Skip to content

Commit f6f82c8

Browse files
clean up comments
1 parent 6a5d2f6 commit f6f82c8

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

crates/wasm-pkg-client/src/lib.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,32 @@ impl Client {
173173
let semver_check: bool = additional_options.skip_semver_check;
174174
let pkg_authority = additional_options.package;
175175

176-
// construct verificable publishing source
176+
// construct verifiable publishing source
177177
let (data, candidate) =
178178
DecodedComponent::from_publishing_source_with_package(data, pkg_authority).await?;
179179

180180
let (package, version) = (
181181
candidate.package().to_owned(),
182182
candidate.version().to_owned(),
183183
);
184-
185-
// instantiate LoaderPublisher
186184
let source = self.resolve_source(&package, registry).await?;
187185

188-
// execute pre-flight
186+
// execute pre-flight checks
189187
if !semver_check {
190-
// fetch nearest neighbors of interest
188+
// fetch nearest neighbors of interest, sorted in descending order
191189
let mut neighbors: [Option<VersionInfo>; 2] = [None, None];
192190
for version_info in
193191
fetch_semver_series(source.as_ref().as_ref(), &package, &version).await?
194192
{
195193
match version.cmp(&version_info.version) {
196194
Ordering::Equal => return Err(Error::VersionAlreadyExists(version.to_owned())),
197195
Ordering::Greater => {
196+
// incoming version is greater than neighbor
198197
neighbors[0] = Some(version_info);
199198
break;
200199
}
201200
Ordering::Less => {
201+
// incoming version is lesser than neighbor
202202
neighbors[1] = Some(version_info);
203203
}
204204
}
@@ -347,15 +347,6 @@ impl Client {
347347
// Fetch every prior release in the same semver compatibility series as
348348
// `version`, sorted in descending order.
349349
//
350-
// The "series" here is the cargo-style `^` compat range, not just
351-
// `~major.minor.*`. We can be that permissive because
352-
// `wit_component::semver_check` is *structural*: it strips every package
353-
// version to `None` before comparing, so it enforces additive-only changes
354-
// regardless of how the version numbers move. The only thing the version
355-
// numbers are used for here is *which neighbors to check against* — and the
356-
// semver contract already says everything inside a compat range must be
357-
// additive, so that's the right gate.
358-
//
359350
// X.y.z (X >= 1) -> X.* (minors are additive within a major)
360351
// 0.Y.z (Y >= 1) -> 0.Y.* (in 0.x, minor bumps are breaking)
361352
// 0.0.Z -> 0.0.Z (every patch is its own series)
@@ -379,7 +370,6 @@ async fn fetch_semver_series(
379370
.await
380371
}
381372

382-
// fetch a package from
383373
async fn fetch_and_resolve_package(
384374
source: &(dyn LoaderPublisher + Sync),
385375
package: &PackageRef,

crates/wasm-pkg-client/tests/publish_semver_check.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
//! Integration tests for publish-time semver compatibility checking (issue #128).
2-
//!
3-
//! All cases share a single `Client` + `TempDir`: each row uses a unique
4-
//! package name, so the per-row series is naturally isolated without needing
5-
//! a fresh backend.
62
73
use std::{io::Cursor, path::Path};
84
use tempfile::TempDir;

0 commit comments

Comments
 (0)