aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-registry
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-05 17:29:12 +0900
committernsfisis <nsfisis@gmail.com>2026-05-05 17:29:12 +0900
commit49b0884701a84731652fc934d428932ff6029bd4 (patch)
tree7477029b8ed686b9b3b06d960cab2b54ba87b579 /crates/mozart-registry
parent4623874d1c95414dcd5ae194d2561f2d98b40982 (diff)
downloadphp-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.gz
php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.zst
php-mozart-49b0884701a84731652fc934d428932ff6029bd4.zip
chore: remove redundant comments
Diffstat (limited to 'crates/mozart-registry')
-rw-r--r--crates/mozart-registry/src/cache.rs34
-rw-r--r--crates/mozart-registry/src/lockfile.rs8
-rw-r--r--crates/mozart-registry/src/packagist.rs16
-rw-r--r--crates/mozart-registry/src/resolver.rs50
4 files changed, 0 insertions, 108 deletions
diff --git a/crates/mozart-registry/src/cache.rs b/crates/mozart-registry/src/cache.rs
index 9b7d165..62efd02 100644
--- a/crates/mozart-registry/src/cache.rs
+++ b/crates/mozart-registry/src/cache.rs
@@ -12,10 +12,6 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::time::{SystemTime, UNIX_EPOCH};
-// ─────────────────────────────────────────────────────────────────────────────
-// CacheConfig
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Configuration for the Mozart cache system.
pub struct CacheConfig {
/// Root cache directory (e.g. `~/.cache/mozart`).
@@ -93,10 +89,6 @@ fn dirs_cache_dir() -> PathBuf {
PathBuf::from("/tmp")
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Cache
-// ─────────────────────────────────────────────────────────────────────────────
-
/// A single cache bucket (a directory on disk).
#[derive(Clone)]
pub struct Cache {
@@ -328,10 +320,6 @@ fn collect_files(dir: &Path, out: &mut Vec<(PathBuf, u64, u64)>) -> anyhow::Resu
Ok(())
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Probabilistic GC trigger
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Return `true` with a probability of 1 in 50 (based on system time nanos).
///
/// Used to decide whether to run GC after an install/update operation.
@@ -343,18 +331,12 @@ pub fn gc_is_necessary() -> bool {
nanos.is_multiple_of(50)
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Tests
-// ─────────────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
use std::time::Duration;
use tempfile::tempdir;
- // ──────────── sanitize_key ────────────
-
#[test]
fn test_sanitize_key_replaces_slash() {
assert_eq!(Cache::sanitize_key("vendor/package"), "vendor~package");
@@ -380,8 +362,6 @@ mod tests {
);
}
- // ──────────── read/write roundtrip (string) ────────────
-
#[test]
fn test_write_read_roundtrip_string() {
let dir = tempdir().unwrap();
@@ -392,8 +372,6 @@ mod tests {
assert_eq!(result.as_deref(), Some("hello world"));
}
- // ──────────── read/write roundtrip (bytes) ────────────
-
#[test]
fn test_write_read_roundtrip_bytes() {
let dir = tempdir().unwrap();
@@ -405,8 +383,6 @@ mod tests {
assert_eq!(result, Some(data));
}
- // ──────────── clear removes all entries ────────────
-
#[test]
fn test_clear_removes_all_entries() {
let dir = tempdir().unwrap();
@@ -423,8 +399,6 @@ mod tests {
assert!(cache.read("key2").is_none());
}
- // ──────────── disabled cache returns None ────────────
-
#[test]
fn test_disabled_cache_returns_none() {
let dir = tempdir().unwrap();
@@ -438,8 +412,6 @@ mod tests {
assert!(cache.read_bytes("key").is_none());
}
- // ──────────── GC with TTL expiration ────────────
-
#[test]
fn test_gc_ttl_expiration() {
let dir = tempdir().unwrap();
@@ -471,8 +443,6 @@ mod tests {
assert!(cache.read("new-key").is_some(), "fresh file should remain");
}
- // ──────────── GC with size limit ────────────
-
#[test]
fn test_gc_size_limit() {
let dir = tempdir().unwrap();
@@ -504,8 +474,6 @@ mod tests {
);
}
- // ──────────── gc_vcs (top-level subdir TTL deletion) ────────────
-
#[test]
fn test_gc_vcs_removes_old_subdirs() {
let dir = tempdir().unwrap();
@@ -531,8 +499,6 @@ mod tests {
assert!(new_mirror.exists(), "fresh mirror should remain");
}
- // ──────────── age ────────────
-
#[test]
fn test_age_existing_entry() {
let dir = tempdir().unwrap();
diff --git a/crates/mozart-registry/src/lockfile.rs b/crates/mozart-registry/src/lockfile.rs
index 3ddc6a2..dd73020 100644
--- a/crates/mozart-registry/src/lockfile.rs
+++ b/crates/mozart-registry/src/lockfile.rs
@@ -442,10 +442,6 @@ fn check_requirement_set(
}
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Lock file generation
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Input for lock file generation.
pub struct LockFileGenerationRequest {
/// Resolved packages from the dependency resolver.
@@ -1305,8 +1301,6 @@ mod tests {
assert!(!lock.is_fresh(r#"{"require": {}}"#));
}
- // ──────────── Lock file generation tests ────────────
-
fn make_packagist_version(
version: &str,
version_normalized: &str,
@@ -1872,8 +1866,6 @@ mod tests {
}
}
- // ──────────── get_missing_requirement_info tests ────────────
-
fn make_locked(name: &str, version: &str) -> LockedPackage {
LockedPackage {
name: name.to_string(),
diff --git a/crates/mozart-registry/src/packagist.rs b/crates/mozart-registry/src/packagist.rs
index 504aa34..6f9b24a 100644
--- a/crates/mozart-registry/src/packagist.rs
+++ b/crates/mozart-registry/src/packagist.rs
@@ -267,10 +267,6 @@ pub async fn fetch_package_versions(
parse_p2_response(&body, package_name)
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Packagist search API
-// ─────────────────────────────────────────────────────────────────────────────
-
/// A single search result from the Packagist search API.
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct SearchResult {
@@ -371,10 +367,6 @@ pub async fn search_packages(
Ok((all_results, total))
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Security Advisories API
-// ─────────────────────────────────────────────────────────────────────────────
-
/// A single security advisory from the Packagist API.
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct SecurityAdvisory {
@@ -557,8 +549,6 @@ mod tests {
assert_eq!(versions[1].version, "1.0.0");
}
- // ──────────── branch_aliases() tests ────────────
-
#[test]
fn test_branch_aliases_present() {
let json = r#"{
@@ -652,8 +642,6 @@ mod tests {
assert!(aliases.is_empty());
}
- // ──────────── __unset sentinel handling ────────────────────────────────
-
#[test]
fn parse_p2_response_unset_fields() {
// Packagist metadata minifier uses "__unset" to mark deleted fields.
@@ -705,8 +693,6 @@ mod tests {
assert!(versions[1].suggest.is_none());
}
- // ──────────── minified metadata expansion ──────────────────────────────
-
#[test]
fn parse_p2_response_minified_expand() {
// Mirrors the Composer MetadataMinifierTest: 3 versions where only
@@ -865,8 +851,6 @@ mod tests {
assert!(versions[1].replace.is_empty());
}
- // ──────────── SecurityAdvisory parsing tests ─────────────────────────────
-
#[test]
fn test_parse_security_advisories_response() {
let json = r#"{
diff --git a/crates/mozart-registry/src/resolver.rs b/crates/mozart-registry/src/resolver.rs
index 5dbe74f..dc9c6dd 100644
--- a/crates/mozart-registry/src/resolver.rs
+++ b/crates/mozart-registry/src/resolver.rs
@@ -20,10 +20,6 @@ use mozart_sat_resolver::{
};
use mozart_semver::{Version, VersionConstraint};
-// ─────────────────────────────────────────────────────────────────────────────
-// Version helpers
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Strip a `@stability` suffix from a constraint string and return the
/// cleaned constraint plus the parsed stability. Mirrors Composer's
/// `RootPackageLoader::extractStabilityFlags` (single-constraint case):
@@ -355,10 +351,6 @@ fn strip_inline_reference(s: &str) -> String {
s.to_string()
}
-// ─────────────────────────────────────────────────────────────────────────────
-// PackageName
-// ─────────────────────────────────────────────────────────────────────────────
-
/// A normalized package name (lowercase, e.g. "monolog/monolog").
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PackageName(pub String);
@@ -387,10 +379,6 @@ impl PackageName {
}
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Platform configuration
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Platform package configuration.
/// Maps package names to version strings (normalized, e.g. "8.1.0.0").
pub struct PlatformConfig {
@@ -447,10 +435,6 @@ impl PlatformConfig {
}
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Error types
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Error returned by the public `resolve()` function.
#[derive(Debug)]
pub enum ResolveError {
@@ -490,10 +474,6 @@ impl fmt::Display for ResolveError {
impl std::error::Error for ResolveError {}
-// ─────────────────────────────────────────────────────────────────────────────
-// Stability filter
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Check if a version passes the minimum-stability filter for the given package.
fn passes_stability_filter(
package_name: &str,
@@ -526,10 +506,6 @@ fn should_skip_platform_dep(
.any(|p| mozart_core::matches_wildcard(dep_name, p))
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Packagist → PoolPackageInput conversion
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Mirrors `Composer\Package\CompletePackage::isAbandoned`: any
/// `abandoned: true` or `abandoned: "<replacement>"` value is truthy.
/// `abandoned: false` and an empty string both register as not-abandoned.
@@ -684,10 +660,6 @@ fn packagist_to_pool_inputs(
results
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Public API types
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Input to the resolver.
pub struct ResolveRequest {
/// Root package name from composer.json "name" field (e.g. "laravel/laravel").
@@ -831,10 +803,6 @@ pub struct ResolvedPackage {
pub alias_of_normalized: Option<String>,
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Public resolve() function
-// ─────────────────────────────────────────────────────────────────────────────
-
/// Run the dependency resolver.
///
/// Returns a list of resolved packages (excluding root and platform packages),
@@ -1629,16 +1597,10 @@ pub async fn resolve(request: &ResolveRequest) -> Result<Vec<ResolvedPackage>, R
}
}
-// ─────────────────────────────────────────────────────────────────────────────
-// Tests
-// ─────────────────────────────────────────────────────────────────────────────
-
#[cfg(test)]
mod tests {
use super::*;
- // ──────────── Version parsing helpers ────────────
-
fn v(major: u64, minor: u64, patch: u64, build: u64) -> Version {
Version {
major,
@@ -1663,8 +1625,6 @@ mod tests {
}
}
- // ──────────── parse_normalized ────────────
-
#[test]
fn test_parse_normalized_stable() {
let ver = parse_normalized("1.2.3.0").unwrap();
@@ -1787,8 +1747,6 @@ mod tests {
);
}
- // ──────────── PackageName ────────────
-
#[test]
fn test_package_name_is_platform() {
assert!(PackageName("php".to_string()).is_platform());
@@ -1807,8 +1765,6 @@ mod tests {
assert!(!PackageName("monolog/monolog".to_string()).is_root());
}
- // ──────────── Stability filter ────────────
-
#[test]
fn test_stability_filter() {
let stable_v = v(1, 0, 0, 0);
@@ -1914,8 +1870,6 @@ mod tests {
assert!(!should_skip_platform_dep("monolog/monolog", false, &list));
}
- // ──────────── Branch alias tests ────────────
-
#[test]
fn test_parse_branch_alias_target_x_dev() {
let ver = parse_branch_alias_target("2.x-dev").unwrap();
@@ -1944,8 +1898,6 @@ mod tests {
assert!(parse_branch_alias_target("").is_none());
}
- // ──────────── SAT solver integration tests (offline) ────────────
-
#[test]
fn test_sat_resolve_simple_offline() {
use mozart_sat_resolver::*;
@@ -1997,8 +1949,6 @@ mod tests {
assert!(result.installed.contains(&2));
}
- // ──────────── End-to-end tests (require network, marked #[ignore]) ────────────
-
#[tokio::test]
#[ignore]
async fn test_resolve_monolog_e2e() {