| Age | Commit message (Collapse) | Author |
|
Several Preg::*() call sites lost their PHP delimiter (and in one case
the `i` modifier) during porting, since preg_*() expects the delimiter
to be preserved in the caller's pattern literal and stripped internally.
This made compile_php_pattern panic or silently misparse the pattern.
Un-ignore the Version tests that were blocked by this bug.
|
|
Model Git::runCommand's mixed $commandOutput parameter with the
RunCommandOutput trait (one impl per PHP mode: discard, by-ref capture,
callable handler), mirroring ProcessExecutor's IntoExecOutput. This moves
the is_callable($commandOutput) value-inspection into the type system and
drops the dependency on the shim's incomplete is_callable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Add a no_banned_use linter that forbids importing anyhow::Result, and
update all call sites to reference it via its fully-qualified path so
it is never confused with std::result::Result.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The CurlDownloader owned a tokio runtime and block_on'd reqwest from its
sync tick(), while the repository/installer/downloader sync bridges each
created another Runtime and block_on'd async fns that reach that leaf.
Driving one Runtime::block_on from within another panics with "Cannot
start a runtime from within a runtime", hit by `require` when fetching
p2 metadata.
Switch CurlDownloader to a blocking reqwest client (its own internal
thread, never nested) and replace the per-call Runtime::new().block_on
bridges with a no-reactor sync_executor::block_on helper. No awaited
future parks on a reactor once the only async I/O is blocking, so the
helper can be nested freely.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Port 11 categories of previously-ignored Composer tests now reachable with
the mockall crate: DownloadManager, VCS/Perforce/File downloaders,
VersionSelector, PlatformRepository, Auditor, installer/FilesystemRepository,
RootPackageLoader, util auth/http, commands, and Cache.
Extract test seams additively on concrete structs as *Interface traits
(Runtime, HhvmDetector, VersionGuesser, RepositorySet, Perforce,
BinaryInstaller) plus mock-field seams (Cache, Filesystem); consumers take
trait objects. Mocks are defined locally in the test crates via
mockall::mock!, since automock-generated mocks are cfg(test)-gated and
invisible across the integration-test boundary.
dataProviders are ported in full; tests blocked by unported shims stay
#[ignore] with documented reasons rather than reduced or weakened.
Fix product bugs surfaced by the ports:
- util/github: use the exception code, not the HTTP status, for 401/403
- advisory: serialize empty audit maps as [] to match PHP json_encode
- repository/filesystem and downloader/file: fix RefCell double-borrow panics
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Composer/PartialComposer exposed its RepositoryManager, InstallationManager,
EventDispatcher, Locker, DownloadManager, AutoloadGenerator and ArchiveManager
as concrete types, but Composer's public setters (setDownloadManager() etc.)
let plugins swap in subclasses. Introduce a *Interface trait per manager and
store each as Rc<RefCell<dyn ...Interface>> so a replacement is honored.
Only Composer's slots and the sinks fed from its accessors become trait
objects; managers injected concretely at construction keep their concrete
references, matching PHP semantics. Fluent setters on the affected classes now
return () and Locker::update_hash is de-generified to a boxed FnOnce so the
traits stay object-safe.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Port auth_helper (14), library_installer (8), console_io (7), zip_downloader (3),
git_bitbucket_driver (3) tests. Implement date_create/strtotime for the ISO8601/
RFC3339/relative formats Composer uses (unknown input -> None, no silent guess).
Fix production bugs: Question::is_assoc list-vs-assoc, auth_helper gitlab-domains
list handling, LibraryInstaller RefCell double-borrow, ZipArchive::extract_to
ErrorException propagation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Replace the Option<&mut PhpMixed> output plumbing with the IntoExecOutput
trait modelling each PHP `$output` case (forward, capture-to-buffer,
discard, callback). This lets do_execute pass a real output handler to
Process::run, captures output back via get_output, and lets Svn pass its
streaming filter handler through execute instead of skipping it.
|
|
Replace the generic cwd parameter backed by the IntoExecCwd trait with a
concrete Option<&str> across execute/execute_args/execute_tty/execute_async.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Re-evaluate the reason'd #[ignore] tests under the Phase D criterion:
a test is unportable ONLY if the APIs/types needed to WRITE it do not
exist. A test that compiles but panics at runtime (todo!() body, a
regex the regex crate cannot compile) or fails at runtime (incomplete
or incorrect impl behavior) is portable -- it is written in full and
marked with a reason-less #[ignore].
About 120 test functions move from reason'd #[ignore] to reason-less
#[ignore] (the ported-but-not-yet-passing signal). Impl crates gain
only additive __ test hatches (init_command, pool, file_downloader,
package handle link setters, artifact/path repository, repository
manager, svn); no existing logic changes. Tests whose required APIs
genuinely do not exist (mock/reflection harness, ApplicationTester,
solve() discarding SolverProblemsException, a script::Event that
cannot be passed as an originating event) keep their reason'd
#[ignore].
cargo check -p shirabe --tests passes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Redesign PhpResource into a real stream handle (File/Memory backing with
tracked position, eof, closed state) and unify the whole fopen family
(fopen/fwrite/fread/fgets/fgetc/feof/fclose/ftell/fseek/rewind/fstat/
ftruncate/fflush and stream_get_contents/stream_copy_to_stream) on
&PhpResource, replacing the split PhpMixed/PhpResource APIs and their
todo!() stubs. fopen now returns Result; read functions stay String for
now (TODO(phase-e) to move to byte strings).
Propagate the signatures through callers: Process stdout/stderr, Cursor
input, curl header/body handles (extracted into typed maps keyed by job
id), Filesystem copy/safe_copy/files_are_equal, BufferIO, error_handler,
platform, perforce, zip. The proc_open pipe paths cannot carry a
PhpResource in a PhpMixed list, so they are left as todo!() with notes.
|
|
Faithfully port every method, field and constant of Symfony's
Process.php into process.rs, replacing the reduced stub. Add the
supporting pipes module (PipesInterface/AbstractPipes/UnixPipes/
WindowsPipes), ProcessUtils and the missing process exceptions
(LogicException/InvalidArgumentException) with constructors.
Methods now return anyhow::Result where PHP throws, take the env
argument and a bool-returning callback, and borrow &mut for
status-updating accessors; all callers are updated accordingly.
Extend the php-shim with proc_open/proc_close (PHP-compatible
signatures), proc_get_status, proc_terminate, posix_kill, uniqid,
ftruncate, ftell_stream, fseek3, stream_get_contents3 and env
helpers.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The List and Array variants of PhpMixed boxed their elements
unnecessarily. Store PhpMixed values directly and update all callers
accordingly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Take config and process as shared Rc<RefCell<..>> handles matching the
struct fields and Util\Git's constructor, assigning them directly. PHP
stores the same Config object reference, so sharing the Rc is faithful;
update the three call sites to pass cloned handles.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
PHP's random_int/random_bytes are cryptographically secure, but Composer
does not rely on that property, so a non-cryptographic PRNG suffices.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
|
|
The Preg methods panic on PCRE failure (per the file header rationale),
so their anyhow::Result wrappers never carried an Err.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Rust's type system already distinguishes participating from
non-participating capture groups via Option, so the *StrictGroups
methods add no safety here. Remove them and switch callers to the
plain variants.
|
|
Convert every sprintf() call with a compile-time literal format string to
format!, implementing Display for PhpMixed (delegating to php_to_string) so
PhpMixed values render with PHP string semantics through {}. Also merge the
format!-wrapped and conditional-literal dynamic sites into single format!
calls. Genuinely runtime format strings (table styles, configurable error
messages, command synopsis, progress-bar modifiers, regex-built messages)
still go through sprintf.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Wire up ConsoleIO with HelperSet/QuestionHelper, register the
ErrorHandler with the IO instance, and fall back to a default output
in run(). Replace resolved phase-b TODOs across the console, command,
io, factory, installer, dependency_resolver, and util modules; reclassify
the remaining blockers (typed Symfony command registry, stdin resource
caching) as phase-c.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
|
|
* Catch specific exception types instead of broad/placeholder handling.
* Drop the shim Countable trait.
|
|
Implement the FileDownloader::$downloadMetadata accessors over the
existing DOWNLOAD_METADATA static, and drop now-stale TODOs on the
already-correct Platform::strlen function-local static and the
ClassLoader include-closure no-op.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Align the Symfony namespace mapping with the documented convention
(symfony::component::X -> symfony::X) and remove now-unused console
stub files. Update all import paths across the workspace.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
PHP mutator methods that the Phase B port could not call because only
&self / &dyn / Rc access was available. Resolved by the interior-mutation
APIs that already exist: handle &self setters (set_dist/source_reference,
set_requires/dev/references/stability_flags), Rc<RefCell<dyn InputInterface>>
.borrow_mut(), and get_installation_manager().borrow_mut() (build_package_map
passes an empty/canonical package list per upstream). composer.get_package()
returns &RootPackageInterfaceHandle, so the "&dyn" Phase B note was wrong.
factory's set_config_source/set_auth_config_source were already live code;
their stale TODOs are removed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Resolve the resolvable subset of category A (shared ownership / non-cloneable
PHP class) TODOs by leaning on values that are already shared behind Rc/handle
wrappers, where cloning preserves PHP reference semantics:
- solver: call IgnoreListPlatformRequirementFilter::filter_constraint with a
cloned AnyConstraint (a Clone enum) and propagate the Result
- update_command: filter PlatformRepository out of the repository manager's
handles into a CompositeRepository (array_filter equivalent)
- package_discovery_trait: pass the real platform_requirement_filter (Rc clone)
instead of substituting ignore_nothing()
- installation_manager: pass the original full operation list (Vec<Rc<_>>
clone) as all_operations
- file_downloader: swap self.io to NullIO and restore via std::mem::replace
- auditor: reuse the PackageInterfaceHandle list across the advisory and
abandoned-package queries
- process_executor: drop the unused, lossy Clone impl
- config / array_repository: demote settled RefCell-design markers to comments
Remaining category A items (factory installer wiring, purge_packages handle
bridge, installer cache identity, reinstall flow, plugin command discovery)
stay as TODOs since correct resolution needs structural refactors.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Replace TODO(phase-b) placeholders (todo!() and commented-out code)
with real implementations:
- Share JsonFile via Rc<RefCell<JsonFile>> so JsonConfigSource and the
owning command can hold the same instance (base_config_command,
config_command, repository_command, require_command, create_project,
remove_command, factory)
- Change InstallerInterface methods (is_installed, download, prepare,
cleanup, get_install_path) to &mut self so initialize_vendor_dir can
run, propagated to all installer implementations
- Pass io/config/filesystem/process by clone instead of moving or
stubbing (auth_helper, svn_driver, curl_downloader, library_installer)
- Make TransportException Clone and store it by value in VcsRepository
- Clone operations in Transaction sort, root_aliases/temporary_constraints
in RepositorySet::create_pool, and share CompletePackage via handle in
PlatformRepository
- Wire up set_option, set_requires/set_dev_requires, installation manager
setters, BumpCommand::set_composer, and clean_backups/set_local_phar
|
|
Replace the phase-b TODOs in DownloadManager::download with the actual
package.set_installation_source call, enabled by the interior mutability
of PackageInterfaceHandle. Drop the stale recursive-closure comments now
that the loop expresses the PHP $download($retry) flow.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
The VcsDownloaderBase::clean_changes stub returned Ok(None), silently
swallowing the abort that PHP's parent::cleanChanges() raises when the
working copy has uncommitted changes. Drop the stub and give Git/Svn a
private fail_on_local_changes helper that performs the getLocalChanges
check and throws, matching the default VcsDownloader::clean_changes().
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
PHP's viewDiff returns void but throws RuntimeException when git diff
fails. Model it as Result<()> and propagate via ? at the single caller
instead of panicking.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Implement ArchiveDownloader for Zip/Tar/Gzip/Xz/Phar/Rar so install()
extracts the archive (extract + rename) instead of doing FileDownloader's
plain file rename, and route install/prepare/cleanup through the mixin.
ArchiveDownloader::extract becomes &mut self to match the concrete
implementations.
Route ZipDownloader's bespoke download() (unzip-command static init) and
PathDownloader's symlink/junction/mirror download/install/remove through
the DownloaderInterface trait (path: String -> &str).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Share downloaders as Rc<RefCell<dyn DownloaderInterface>> in
DownloadManager and make DownloaderInterface/VcsDownloader take
&mut self, matching PHP's mutable-by-reference downloader objects.
This lets Git/Svn/Hg/Fossil/Perforce implement VcsDownloader and route
download/install/update/prepare/cleanup through the trait instead of
todo!(), and wires the as_* downcast hooks end-to-end.
ChangeReportInterface::get_local_changes becomes &mut self since
FileDownloader downloads to a compare dir; get_commit_logs/reapply_changes
gain &mut self / Result to match the concrete implementations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Package/CompletePackage/RootPackage
Fill the trait-impl todo!() across the package accessor layer so loaded
packages are actually usable (the ArrayLoader::load path depends on it):
- Package: implement BasePackage/PackageInterface from struct fields and
existing inherent methods; Display via get_unique_name.
- CompletePackage: delegate PackageInterface to inner Package.
- RootPackage: delegate CompletePackageInterface/PackageInterface to inner
CompletePackage; RootPackageInterface link setters delegate to Package.
Correct three unfaithful trait signatures found during implementation:
- get_target_dir returns Option<String> (PHP computes a normalized value;
a borrow cannot represent it, and AliasPackage could not implement &str
across its aliasOf handle).
- RootPackageInterface link setters take IndexMap<String, Link>, matching
Package and the real ArrayLoader caller (PHP RootPackage inherits
Package::setRequires; the Link[] docblock was imprecise).
- get_full_pretty_version takes a DisplayMode enum instead of a raw i64;
the match is now exhaustive, so it returns String without an error path.
Move mirror conversion to the boundaries: PackageInterface mirror methods
use Vec<Mirror> (the typed form, matching the inherent methods), with
array<->Mirror conversion done by the producer (ComposerRepository) and
consumer (ArrayDumper).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
These TODOs describe work already done: writeError per-line iteration
(github, remote_filesystem, svn_downloader) and reference equality via
std::ptr::eq (download_manager). No behavior change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
RuntimeException
Match PHP GitDownloader::getUnpushedChanges, which returns ?string while
throwing \RuntimeException on git command failure. Change the signature to
Result<Option<String>> and replace the three panic\!() sites with
Err(RuntimeException), mirroring the get_local_changes port. Thread ? through
the clean_changes and StatusCommand call sites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Git/Svn/Hg/Fossil/Perforce now implement ChangeReportInterface and
VcsCapableDownloaderInterface and override the as_* downcasts, so PHP-style
instanceof checks on a DownloaderInterface resolve to these sub-interfaces.
get_local_changes lives directly in the ChangeReportInterface impl
(returning anyhow::Result; GitDownloader now surfaces a RuntimeException
instead of panicking on a failed git status). get_vcs_reference is shared
via a new VcsDownloaderBase helper that each downloader delegates to.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Override DownloaderInterface's as_change_report_interface /
as_vcs_capable_downloader_interface / as_dvcs_downloader_interface so
PHP-style instanceof checks resolve to the concrete sub-interface:
FileDownloader and the six archive downloaders (Zip/Tar/Gzip/Xz/Rar/Phar)
plus PathDownloader gain ChangeReportInterface (archives/path delegate to
the inner FileDownloader), PathDownloader exposes VcsCapableDownloaderInterface,
and GitDownloader exposes DvcsDownloaderInterface.
The default None impls remain correct for downloaders that do not
implement a given sub-interface, so their stale TODO markers are dropped.
VCS downloaders' ChangeReport/VcsCapable conformance follows separately.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
getFileContent catch type
Remove 17 TODO(phase-b) markers across exception-modeling sites where the
existing single-Result closure+match already faithfully models the PHP
try/catch (catch paths only rethrow, retry, log, or silently ignore and
never yield a recoverable value, so a double Result is unnecessary).
Fix SvnDriver::get_file_content to catch only RuntimeException (matching
PHP's catch RuntimeException) and extract its .message instead of calling
e.to_string() on the anyhow::Error, which would panic while the shim
exception Display is unimplemented; other errors now propagate.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
Resolve the PHP try/catch instanceof checks that select on exception type:
TransportException-only catches in RepositorySet, SvnDriver and JsonFile;
the RuntimeException/IrrecoverableDownloadException handleError closure and
the RuntimeException update-retry catch in DownloadManager. Each uses
anyhow::Error::downcast_ref and reads the exception's message field directly
(Display is todo\!() on the shim exceptions). PHPUnit\Framework\Exception
checks in VcsDownloader are documented as intentionally always-false since
the test framework is out of scope.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|