Repository navigation
Harness: static checks for the dispatcher's copied blocks, callback guards and empty catches - #59
Merged
Merged
Conversation
…and empty catches The dispatcher's three poll/finalize passes and its force-stop/teardown pair are copies on purpose; a one-sided edit now fails the harness. Every `& $callback` call must sit in the continue/break guard, and every empty catch must say why. Each check also runs on a copy broken in one spot. Gives the one empty catch without a reason (in Resolve-PkFileSystemPath's caller-scope lookup) its comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also catches callbacks called through an index, a property, a dot-source or .Invoke(), and empty catches whose body spans blank lines; exempts $ScriptBlock only in Invoke-PkRun. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Three rules in the kit were only enforced by comments and review, so a one-sided edit could slip through with every test still green:
finallyteardown. "Keep in sync" was only a comment.Invoke-PkCallbackor its inlineddo { } while ($false)guard plus the loop warning, so acontinue/breakin the callback can't escape into the kit's loops. A new call site that forgot it was only caught if someone also remembered to add a behavior test for it.catch { }has to say why it swallows. One didn't: the caller-scope path lookup inResolve-PkFileSystemPath.What changed
New harness section AN reads
ParallelKit.ps1and checks:-JobAbortCleanupfor a job whose-JobFinalizewas running.&/.call of a callback (by variable, index or property) has the reset flag, thedo { } while ($false)guard and the warning after it;.Invoke()on a callback is refused. The kit's own helpers captured into variables are on an allow-list.Each check also runs on a copy of the kit broken in one spot, so a check that has stopped seeing anything fails too.
The kit itself only gains the missing reason comment on that one catch; no behavior change.
Testing
line 1242: } catch { }) and passes with the comment added.🤖 Generated with Claude Code