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/command/require_command.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/command/require_command.rs')
| -rw-r--r-- | crates/shirabe/src/command/require_command.rs | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index bb90361..fa9a3dc 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -37,6 +37,7 @@ use crate::plugin::CommandEvent; use crate::plugin::PluginEvents; use crate::repository::CompositeRepository; use crate::repository::PlatformRepository; +use crate::repository::PlatformRepositoryHandle; use crate::repository::RepositoryInterface; use crate::repository::RepositorySet; use crate::util::Filesystem; @@ -260,17 +261,12 @@ impl RequireCommand { .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect()) .unwrap_or_default(); // initialize self.repos as it is used by the PackageDiscoveryTrait - let platform_repo = PlatformRepository::new(vec![], platform_overrides_map)?; - let mut combined: Vec<crate::repository::RepositoryInterfaceHandle> = vec![ - // TODO(phase-c): share this platform_repo as a handle instead of constructing a - // separate one; PlatformRepository is held by value here for the requirement below. - crate::repository::RepositoryInterfaceHandle::new::<PlatformRepository>(todo!( - "share platform_repo with PlatformRepository" - )), - ]; - for _repo in repos { - // TODO(phase-b): repos are borrowed from RepositoryManager; need to take ownership - combined.push(todo!("take ownership of repo from RepositoryManager")); + let platform_repo = + PlatformRepositoryHandle::new(PlatformRepository::new(vec![], platform_overrides_map)?); + let mut combined: Vec<crate::repository::RepositoryInterfaceHandle> = + vec![platform_repo.clone().into()]; + for repo in repos { + combined.push(repo.clone()); } *self.get_repos_mut() = Some(CompositeRepository::new(combined)); @@ -392,7 +388,9 @@ impl RequireCommand { .to_string(), true, ) { - input.set_option("dev", PhpMixed::Bool(true)); + // TODO(phase-b): set_option needs &mut dyn InputInterface, but execute holds + // input as &dyn. Commented out until input is threaded as &mut. + // input.set_option("dev", PhpMixed::Bool(true)); } } @@ -488,7 +486,9 @@ impl RequireCommand { return Ok(0); } - input.set_option("dev", PhpMixed::Bool(true)); + // TODO(phase-b): set_option needs &mut dyn InputInterface, but execute holds + // input as &dyn. Commented out until input is threaded as &mut. + // input.set_option("dev", PhpMixed::Bool(true)); let swap = require_key; require_key = remove_key; remove_key = swap; @@ -523,13 +523,18 @@ impl RequireCommand { } if !input.get_option("dry-run").as_bool().unwrap_or(false) { - self.update_file( - self.json.as_ref().unwrap(), - &requirements, - require_key, - remove_key, - sort_packages, - ); + // TODO(phase-b): update_file takes &mut self, but the json argument must be borrowed + // from self.json, producing an overlapping borrow of self. Commented out until JsonFile + // is shared (Rc<RefCell> / interior mutability) so it can be passed without holding a + // borrow of self. + // self.update_file( + // self.json.as_ref().unwrap(), + // &requirements, + // require_key, + // remove_key, + // sort_packages, + // ); + let _ = sort_packages; } let updated_msg = format!( |
