Add Write-xJobProgress: mirror background job progress - #2
Merged
Conversation
Graduates the WIP/JobProgress.ps1 stub into a real, tested function: mirrors Write-Progress calls happening inside a Start-Job scriptblock into the caller's session, tracking the latest record per distinct ActivityId (not just the last record overall) across all ChildJobs, preserving ParentActivityId nesting, and assigning collision-free Write-Progress ids from the same counter New-xProgress uses. It's a lightweight write-only passthrough for now, with an -xParentIdentity nesting fast-follow noted for later. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMneU2siSsontUQczn8wGt
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMneU2siSsontUQczn8wGt
…ogress Every existing test mocked Write-Progress, so the module's real integration with the built-in cmdlet was never exercised (only Write-xJobProgress.Tests.ps1 used real background jobs). Add IntegrationTests-tagged coverage that runs the real functions inside real Start-Job jobs over a real temp file-tree fixture and asserts on the job's real, unmocked ProgressRecord output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EMneU2siSsontUQczn8wGt
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.
Summary
Write-xJobProgress, graduating theWIP/JobProgress.ps1stub into a real exported function that mirrorsWrite-Progresscalls made inside aStart-Job/Invoke-Command -AsJobscriptblock into the caller's session.ActivityIdacross allChildJobs(not justChildJobs[0]), preservingParentActivityIdnesting, and falls back to the job's own.Progressfor job types with no child jobs.Write-Progress -Idvalues by drawing from the same counterNew-xProgressalready uses, keyed internally byJob.InstanceId(not the recyclable.Id) so a reused job id can never inherit a stale mapping.Running, and never reprocesses a retired job's leftover progress records on a later call.$script:ProgressTrackerregistration, no throttling/timer semantics. A-xParentIdentityparameter to nest job progress under a caller's own xProgress instance is flagged as a fast-follow in AGENTS.md/README (the internal id map is already independent of the tracker, so this is additive later).xProgress.psd1(exports, version bump to 1.1.0, release notes),README.md,en-us/about_xProgress.help.txt, andAGENTS.mdto document the new function and retire the stale WIP note.Test plan
Invoke-ScriptAnalyzer -Path *.psm1 -Recurse— no new findings (only the 3 pre-existingShouldProcesswarnings)Invoke-Pester -Path ./Tests -Output Detailed— 134/134 passing, including 8 new tests inTests/Write-xJobProgress.Tests.ps1using realStart-Job/Wait-Job(parameter shape, single activity, stable id across calls, concurrent/nested activities, zero-ChildJobs fallback, empty progress, completion cleanup, id-collision isolation from live xProgress instances)Write-xJobProgress, no exceptions, both jobs completed cleanly