refactor: unify per-key reporter ids behind OperationId#6025
Merged
baszalmstra merged 2 commits intoprefix-dev:mainfrom May 6, 2026
Merged
refactor: unify per-key reporter ids behind OperationId#6025baszalmstra merged 2 commits intoprefix-dev:mainfrom
baszalmstra merged 2 commits intoprefix-dev:mainfrom
Conversation
8 tasks
758a067 to
dd1aeb1
Compare
Generic OperationId + OperationRegistry + task-local + spawn hook shared across pixi reporter implementations. The registry records each id's parent (read from the task-local at allocation time) so reporter implementations can walk ancestry via parent_of() / ancestors() without exposing a context type.
Replace the umbrella Reporter trait + 8 per-key id types with a single OperationId allocated by reporter implementations from a shared OperationRegistry. The registry records each id's parent (read from a task-local at allocation time) so reporter implementations can walk ancestry via parent_of() / ancestors() without the dispatcher exposing any context type. The new pixi_compute_reporters crate hosts OperationId, OperationRegistry, the task-local + scope helper, and the SpawnHook that propagates the active id across compute spawns. Per-key reporter traits in pixi_command_dispatcher now return OperationId; their on_started / on_finished take OperationId. Other changes folded in: - Drop the umbrella Reporter trait; per-key reporters are registered separately on the dispatcher builder. - Drop ClearReporter; CLI sites hold their own Arc<TopLevelProgress> and call on_clear() directly. - Fold the rattler install reporter factory into PixiInstallReporter + InstantiateBackendReporter (each gains create_install_reporter()). - Push TopLevelProgress construction up to CLI entry points; Workspace::update_lock_file and get_update_lock_file_and_prefix(es) take Option<Arc<TopLevelProgress>>. - pixi_global::Project carries its own progress in a paired OnceCell. - Test EventReporter allocates via the registry; ContextSnapshot is gone, EventTree walks parents through registry.parent_of(). - Regenerate simple_test snapshot for the new (shared) id numbering.
dd1aeb1 to
d06b2e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Current the
Reportertrait creates a coupling between computations in the command dispatcher crate. It bundles different reports and usesReporterContextwhich also couples different computations together.Adds a
pixi_compute_reporterscrate withOperationId,OperationRegistry, a task-local for the active id, and aSpawnHookthat propagates it across compute spawns. The registry records each id's parent at allocation time, so reporter implementations walk ancestry viaparent_of()/ancestors()without the dispatcher exposing a context type.Replaces the
Reportertrait + 8 per-key id types with a singleOperationId. Per-key reporter traits inpixi_command_dispatchernow returnOperationId;on_started/on_finishedtakeOperationId.Groundwork for splitting
pixi_command_dispatcherinto per-key crates: each per-key crate now needs onlypixi_compute_engineandpixi_compute_reportersfor parent tracking, not the dispatcher.Folded in: drop
ClearReporter(CLI sites hold their ownArc<TopLevelProgress>and callon_clear()directly); fold the rattler install factory intoPixiInstallReporterandInstantiateBackendReporter; pushTopLevelProgressconstruction up to CLI entry points (Workspace::update_lock_fileandget_update_lock_file_and_prefix(es)takeOption<Arc<TopLevelProgress>>);pixi_global::Projectholds its progress in a pairedOnceCell.How Has This Been Tested?
cargo test -p pixi_command_dispatcher --test integration: 36 passed.simple_testwithslow_integration_testsand a freshPIXI_CACHE_DIR: produces the expected nested event tree (including the conda solve nested underInstantiate backend). Snapshot regenerated for the new shared id numbering.AI Disclosure
Tools: Claude Code
Checklist: