diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-02 23:58:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-02 23:58:54 +0900 |
| commit | 51843230859ef39344c0b67daa9049ead87ec49c (patch) | |
| tree | f657969816da51b7f8656012e756498680ffcc23 /crates/shirabe/src/dependency_resolver/pool.rs | |
| parent | 20dbcf11b86cb03c451ba1d5cd9efe17b68fa66d (diff) | |
| download | php-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/dependency_resolver/pool.rs')
| -rw-r--r-- | crates/shirabe/src/dependency_resolver/pool.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/shirabe/src/dependency_resolver/pool.rs b/crates/shirabe/src/dependency_resolver/pool.rs index ddb4df5..708930c 100644 --- a/crates/shirabe/src/dependency_resolver/pool.rs +++ b/crates/shirabe/src/dependency_resolver/pool.rs @@ -8,7 +8,7 @@ use shirabe_semver::compiling_matcher::CompilingMatcher; use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::SimpleConstraint; -use crate::advisory::PartialSecurityAdvisory; +use crate::advisory::PartialOrFullSecurityAdvisory; use crate::package::BasePackage; use crate::package::BasePackageHandle; use crate::package::version::VersionParser; @@ -31,8 +31,8 @@ pub struct Pool { /// @var array<string, array<string, string>> Map of package object hash => removed normalized versions => removed pretty version pub(crate) removed_versions_by_package: IndexMap<String, IndexMap<String, String>>, /// @var array<string, array<string, array<SecurityAdvisory|PartialSecurityAdvisory>>> Map of package name => normalized version => security advisories - // TODO(phase-b): SecurityAdvisory|PartialSecurityAdvisory union — stored as PartialSecurityAdvisory base - security_removed_versions: IndexMap<String, IndexMap<String, Vec<PartialSecurityAdvisory>>>, + security_removed_versions: + IndexMap<String, IndexMap<String, Vec<PartialOrFullSecurityAdvisory>>>, /// @var array<string, array<string, string>> Map of package name => normalized version => pretty version abandoned_removed_versions: IndexMap<String, IndexMap<String, String>>, } @@ -49,7 +49,10 @@ impl Pool { unacceptable_fixed_or_locked_packages: Vec<BasePackageHandle>, removed_versions: IndexMap<String, IndexMap<String, String>>, removed_versions_by_package: IndexMap<String, IndexMap<String, String>>, - security_removed_versions: IndexMap<String, IndexMap<String, Vec<PartialSecurityAdvisory>>>, + security_removed_versions: IndexMap< + String, + IndexMap<String, Vec<PartialOrFullSecurityAdvisory>>, + >, abandoned_removed_versions: IndexMap<String, IndexMap<String, String>>, ) -> Self { let mut this = Self { @@ -151,7 +154,7 @@ impl Pool { ) { return package_with_security_advisories .iter() - .map(|advisory| advisory.advisory_id.clone()) + .map(|advisory| advisory.advisory_id().to_string()) .collect(); } } @@ -186,7 +189,7 @@ impl Pool { /// @return array<string, array<string, array<SecurityAdvisory|PartialSecurityAdvisory>>> pub fn get_all_security_removed_package_versions( &self, - ) -> &IndexMap<String, IndexMap<String, Vec<PartialSecurityAdvisory>>> { + ) -> &IndexMap<String, IndexMap<String, Vec<PartialOrFullSecurityAdvisory>>> { &self.security_removed_versions } |
