aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-26 02:26:08 +0900
committernsfisis <nsfisis@gmail.com>2026-06-26 02:26:08 +0900
commit8c4dc6cd48457f154eb067f296d79ef911573c91 (patch)
tree10acc2f4f64813f9b206d474306e5680234ec73d
parent6c89c720d9e4728c288e3c66ffb7dcb4cba5121c (diff)
downloadphp-shirabe-8c4dc6cd48457f154eb067f296d79ef911573c91.tar.gz
php-shirabe-8c4dc6cd48457f154eb067f296d79ef911573c91.tar.zst
php-shirabe-8c4dc6cd48457f154eb067f296d79ef911573c91.zip
fix(check-platform-reqs-command): add PlatformRepository to existing composite
execute nested the already-built InstalledRepository inside a second InstalledRepository, tripping the assertion that an InstalledRepository may not contain another. PHP adds a PlatformRepository to the existing composite via addRepository; do the same. Un-ignores CheckPlatformReqsCommandTest::test_failed_platform_requirement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/table.rs18
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs10
-rw-r--r--crates/shirabe/src/advisory/auditor.rs28
-rw-r--r--crates/shirabe/src/command/base_command.rs7
-rw-r--r--crates/shirabe/src/command/check_platform_reqs_command.rs11
-rw-r--r--crates/shirabe/src/command/licenses_command.rs25
-rw-r--r--crates/shirabe/tests/command/check_platform_reqs_command_test.rs11
7 files changed, 43 insertions, 67 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
index 9d4d168..59da457 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
@@ -455,10 +455,7 @@ impl Table {
}
/// Adds a row to the table, and re-renders the table.
- pub fn append_row(
- &mut self,
- row: Row,
- ) -> anyhow::Result<Result<&mut Self, RuntimeException>> {
+ pub fn append_row(&mut self, row: Row) -> anyhow::Result<Result<&mut Self, RuntimeException>> {
if !Self::output_is_console_section(&self.output) {
return Ok(Err(RuntimeException(shirabe_php_shim::RuntimeException {
message: format!(
@@ -515,11 +512,7 @@ impl Table {
let rows: Vec<Row>;
if self.horizontal {
let mut horizontal_rows: IndexMap<i64, Vec<Cell>> = IndexMap::new();
- let header0 = self
- .headers
- .first()
- .map(|h| h.cells())
- .unwrap_or_default();
+ let header0 = self.headers.first().map(|h| h.cells()).unwrap_or_default();
for (i, header) in header0.into_iter().enumerate() {
let i = i as i64;
horizontal_rows.insert(i, vec![header]);
@@ -787,12 +780,7 @@ impl Table {
}
/// Renders table row.
- fn render_row(
- &self,
- row: Vec<Cell>,
- cell_format: String,
- first_cell_format: Option<String>,
- ) {
+ fn render_row(&self, row: Vec<Cell>, cell_format: String, first_cell_format: Option<String>) {
let mut row_content = self.render_column_separator(BORDER_OUTSIDE);
let columns = self.get_row_columns(&row);
let last = columns.len() as i64 - 1;
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
index eee532e..2f7c7cb 100644
--- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
@@ -8,14 +8,14 @@ use crate::symfony::console::helper::Helper;
use crate::symfony::console::helper::ProgressBar;
use crate::symfony::console::helper::SymfonyQuestionHelper;
use crate::symfony::console::helper::Table;
-use crate::symfony::console::helper::table::{Cell, Row};
use crate::symfony::console::helper::TableCell;
use crate::symfony::console::helper::TableSeparator;
+use crate::symfony::console::helper::table::{Cell, Row};
use crate::symfony::console::input::InputInterface;
use crate::symfony::console::output::ConsoleOutputInterface;
use crate::symfony::console::output::OutputInterface;
-use crate::symfony::console::output::console_output::ConsoleOutput;
use crate::symfony::console::output::TrimmedBufferOutput;
+use crate::symfony::console::output::console_output::ConsoleOutput;
use crate::symfony::console::output::output_interface::OUTPUT_NORMAL;
use crate::symfony::console::question::ChoiceQuestion;
use crate::symfony::console::question::ConfirmationQuestion;
@@ -271,9 +271,9 @@ impl SymfonyStyle {
style.set_cell_header_format("<info>%s</info>".to_string());
let mut table = Table::new(output);
- let _ = table.set_style(
- crate::symfony::console::helper::table::StyleName::Style(style),
- );
+ let _ = table.set_style(crate::symfony::console::helper::table::StyleName::Style(
+ style,
+ ));
table
}
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs
index fd54595..6c520fb 100644
--- a/crates/shirabe/src/advisory/auditor.rs
+++ b/crates/shirabe/src/advisory/auditor.rs
@@ -467,10 +467,13 @@ impl Auditor {
table
.set_horizontal(true)
.set_headers(headers.into_iter().map(|h| h.into()).collect());
- table.add_row(ConsoleIO::sanitize(
- PhpMixed::List(row.into_iter().map(PhpMixed::String).collect()),
- false,
- ).into());
+ table.add_row(
+ ConsoleIO::sanitize(
+ PhpMixed::List(row.into_iter().map(PhpMixed::String).collect()),
+ false,
+ )
+ .into(),
+ );
table
.set_column_width(1, 80)
.set_column_max_width(1, 80)
@@ -589,13 +592,16 @@ impl Auditor {
} else {
"none".to_string()
};
- table.add_row(ConsoleIO::sanitize(
- PhpMixed::List(vec![
- PhpMixed::String(self.get_package_name_with_link(pkg.clone().into())),
- PhpMixed::String(replacement),
- ]),
- false,
- ).into());
+ table.add_row(
+ ConsoleIO::sanitize(
+ PhpMixed::List(vec![
+ PhpMixed::String(self.get_package_name_with_link(pkg.clone().into())),
+ PhpMixed::String(replacement),
+ ]),
+ false,
+ )
+ .into(),
+ );
}
table.render();
diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs
index f754d0a..f3c88e5 100644
--- a/crates/shirabe/src/command/base_command.rs
+++ b/crates/shirabe/src/command/base_command.rs
@@ -583,12 +583,7 @@ impl BaseCommand for BaseCommandData {
.expect("Table::set_style I/O cannot fail")
.expect("'compact' is a built-in table style");
renderer
- .set_rows(
- table
- .into_iter()
- .map(Into::into)
- .collect(),
- )
+ .set_rows(table.into_iter().map(Into::into).collect())
.render();
let _ = TableSeparator::new();
}
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs
index 2ab66c5..a7f5d9c 100644
--- a/crates/shirabe/src/command/check_platform_reqs_command.rs
+++ b/crates/shirabe/src/command/check_platform_reqs_command.rs
@@ -285,13 +285,10 @@ impl Command for CheckPlatformReqsCommand {
let mut requires_sorted: Vec<(String, Vec<Link>)> = requires.into_iter().collect();
requires_sorted.sort_by(|a, b| a.0.cmp(&b.0));
- let installed_repo_with_platform = InstalledRepository::new(vec![
- crate::repository::RepositoryInterfaceHandle::new(installed_repo),
- crate::repository::RepositoryInterfaceHandle::new(PlatformRepository::new(
- vec![],
- indexmap::IndexMap::new(),
- )?),
- ]);
+ installed_repo.add_repository(crate::repository::RepositoryInterfaceHandle::new(
+ PlatformRepository::new(vec![], indexmap::IndexMap::new())?,
+ ));
+ let installed_repo_with_platform = installed_repo;
let mut results: Vec<CheckResult> = vec![];
let mut exit_code = 0;
diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs
index e8d62cc..f2672bd 100644
--- a/crates/shirabe/src/command/licenses_command.rs
+++ b/crates/shirabe/src/command/licenses_command.rs
@@ -201,11 +201,7 @@ impl Command for LicensesCommand {
let mut table = Table::new(output);
table.set_style("compact".into())??;
- table.set_headers(vec![
- "Name".into(),
- "Version".into(),
- "Licenses".into(),
- ]);
+ table.set_headers(vec!["Name".into(), "Version".into(), "Licenses".into()]);
for package in &packages {
let link = PackageInfo::get_view_source_or_homepage_url(package.clone());
let name = if let Some(link) = link {
@@ -227,14 +223,17 @@ impl Command for LicensesCommand {
} else {
pkg_licenses.join(", ")
};
- table.add_row(PhpMixed::List(vec![
- PhpMixed::String(name),
- PhpMixed::String(package.get_full_pretty_version(
- true,
- crate::package::DisplayMode::SourceRefIfDev,
- )),
- PhpMixed::String(licenses_str),
- ]).into());
+ table.add_row(
+ PhpMixed::List(vec![
+ PhpMixed::String(name),
+ PhpMixed::String(package.get_full_pretty_version(
+ true,
+ crate::package::DisplayMode::SourceRefIfDev,
+ )),
+ PhpMixed::String(licenses_str),
+ ])
+ .into(),
+ );
}
table.render();
}
diff --git a/crates/shirabe/tests/command/check_platform_reqs_command_test.rs b/crates/shirabe/tests/command/check_platform_reqs_command_test.rs
index 1e19259..a9196b7 100644
--- a/crates/shirabe/tests/command/check_platform_reqs_command_test.rs
+++ b/crates/shirabe/tests/command/check_platform_reqs_command_test.rs
@@ -48,11 +48,7 @@ fn run_platform_reqs_are_satisfied_case(
#[test]
#[serial]
-#[ignore = "src porting bug: check_platform_reqs_command.rs:288-294 wraps the existing \
- InstalledRepository inside a SECOND InstalledRepository (instead of PHP line 89 \
- `$installedRepo->addRepository(new PlatformRepository(...))`), tripping the \
- add_repository assertion at installed_repository.rs:367 (\"An InstalledRepository can \
- not contain a repository of type installed repo ...\"). Cannot fix from test files."]
+#[ignore = "reaches a RefCell re-entrancy panic at crates/shirabe/src/downloader/file_downloader.rs:136 (\"RefCell already borrowed\") on the platform-package resolution path; src borrow bug, not fixable from the test"]
fn test_platform_reqs_are_satisfied() {
// 'Disables checking of require-dev packages requirements.'
run_platform_reqs_are_satisfied_case(
@@ -105,11 +101,6 @@ fn test_exception_thrown_if_no_lockfile_found() {
#[test]
#[serial]
-#[ignore = "src porting bug: check_platform_reqs_command.rs:288-294 wraps the existing \
- InstalledRepository inside a SECOND InstalledRepository (instead of PHP line 89 \
- `$installedRepo->addRepository(new PlatformRepository(...))`), tripping the \
- add_repository assertion at installed_repository.rs:367 (\"An InstalledRepository can \
- not contain a repository of type installed repo ...\"). Cannot fix from test files."]
fn test_failed_platform_requirement() {
let tear_down = init_temp_composer(
Some(&serde_json::json!({