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.
[jsweep] Clean update_handler_factory.cjs #42900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[jsweep] Clean update_handler_factory.cjs #42900
Changes from all commits
c98111fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing symmetric absence assertion:
before_stateis never asserted absent when onlycaptureAfteris configured, creating an asymmetry with thecaptureBefore-only test which explicitly assertsexpect(result.after_state).toBeUndefined().💡 Suggested fix
Add after
expect(result.after_state).toEqual({ title: "After title" }):Without this, a regression where
attachExecutionState's falsy guard is tightened (e.g. changed frombeforeState ?tobeforeState !== null ?) and a non-nullbeforeStateleaks into the result would go undetected. The captureBefore-only test correctly covers the symmetric case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/tdd] Missing symmetric assertion: this test checks that
after_stateis set correctly, but does not assertbefore_stateis absent — unlike its sibling test that explicitly checksexpect(result.after_state).toBeUndefined().💡 Suggested addition
Add after line 404:
Without this, a regression where
attachExecutionStateleaks anull/ emptybefore_statefield would go undetected.@copilot please address this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weak cross-repo assertions: Two gaps make this test unable to catch silent cross-repo routing failures.
💡 Suggested fixes
1. Pin the target repo in the log assertion:
The current assertion accepts any string containing
"Cross-repo update":If
resolveAndValidateReporesolved to the wrong repo (e.g. default context repo), the log message would still contain"Cross-repo update"and the test would pass. Change to:2. Assert
result.reporeflects the cross-repo target:The handler always attaches
repo:${effectiveContext.repo.owner}/${effectiveContext.repo.repo}`` to the success result. IfeffectiveContext.repois not overridden (cross-repo routing silently broken), `result.repo` would contain the workflow's own repo. Capture and assert it:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/tdd] The cross-repo log test asserts only that
core.infowas called with a string containing "Cross-repo update", but the production code also conditionally logs whenrepoResult.repo !== workflowRepo(i.e. with norepofield). A complementary test for the implicit path would make the logging contract explicit.💡 Suggested additional test
This covers the second branch of the condition at line 189 of
update_handler_factory.cjs.@copilot please address this.
Uh oh!
There was an error while loading. Please reload this page.