aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/advisory/partial_security_advisory.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-02 23:58:38 +0900
committernsfisis <nsfisis@gmail.com>2026-06-02 23:58:54 +0900
commit51843230859ef39344c0b67daa9049ead87ec49c (patch)
treef657969816da51b7f8656012e756498680ffcc23 /crates/shirabe/src/advisory/partial_security_advisory.rs
parent20dbcf11b86cb03c451ba1d5cd9efe17b68fa66d (diff)
downloadphp-shirabe-51843230859ef39344c0b67daa9049ead87ec49c.tar.gz
php-shirabe-51843230859ef39344c0b67daa9049ead87ec49c.tar.zst
php-shirabe-51843230859ef39344c0b67daa9049ead87ec49c.zip
feat(resolver): port SecurityAdvisoryPoolFilter::filter
Implement the security advisory pool filter end to end, plus the remaining actionable wirings it unblocked. - Unify the PartialSecurityAdvisory|SecurityAdvisory union as the PartialOrFullSecurityAdvisory enum and make the advisory types Clone, so advisories can be collected and stored; Pool.security_removed_versions now carries the union. This also unblocks PoolOptimizer's clone of the security-removed versions. - Thread the filter result through run_security_advisory_filter/build_pool as anyhow::Result. - Introduce typed PlatformRepositoryHandle and pass platform repos as handles through determine_requirements instead of &PlatformRepository. - Wire RuleSetGenerator's is_unacceptable_fixed_or_locked_package check and UpdateCommand's non-locked installed-packages branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/advisory/partial_security_advisory.rs')
-rw-r--r--crates/shirabe/src/advisory/partial_security_advisory.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/src/advisory/partial_security_advisory.rs b/crates/shirabe/src/advisory/partial_security_advisory.rs
index fe3c99e..1e92dec 100644
--- a/crates/shirabe/src/advisory/partial_security_advisory.rs
+++ b/crates/shirabe/src/advisory/partial_security_advisory.rs
@@ -1,7 +1,7 @@
//! ref: composer/src/Composer/Advisory/PartialSecurityAdvisory.php
+use crate::advisory::PartialOrFullSecurityAdvisory;
use crate::advisory::SecurityAdvisory;
-use crate::repository::PartialOrSecurityAdvisory;
use anyhow::Result;
use chrono::{DateTime, TimeZone, Utc};
use indexmap::IndexMap;
@@ -18,7 +18,7 @@ fn serialize_constraint<S: serde::Serializer>(
serializer.serialize_str(&c.get_pretty_string())
}
-#[derive(Debug, serde::Serialize)]
+#[derive(Debug, Clone, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct PartialSecurityAdvisory {
pub advisory_id: String,
@@ -32,7 +32,7 @@ impl PartialSecurityAdvisory {
package_name: &str,
data: &IndexMap<String, PhpMixed>,
parser: &VersionParser,
- ) -> Result<PartialOrSecurityAdvisory> {
+ ) -> Result<PartialOrFullSecurityAdvisory> {
let affected_versions_str = data["affectedVersions"].as_string().unwrap_or("");
let constraint: AnyConstraint = match parser.parse_constraints(affected_versions_str) {
@@ -81,10 +81,10 @@ impl PartialSecurityAdvisory {
.and_then(|v| v.as_string())
.map(|s| s.to_string()),
);
- return Ok(PartialOrSecurityAdvisory::Full(advisory));
+ return Ok(PartialOrFullSecurityAdvisory::Full(advisory));
}
- Ok(PartialOrSecurityAdvisory::Partial(Self {
+ Ok(PartialOrFullSecurityAdvisory::Partial(Self {
advisory_id: data["advisoryId"].as_string().unwrap_or("").to_string(),
package_name: package_name.to_string(),
affected_versions: constraint,