-
Notifications
You must be signed in to change notification settings - Fork 418
Version issue-creation REST calls in handle_agent_failure #38017
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -421,6 +421,11 @@ describe("handle_agent_failure", () => { | |
|
|
||
| expect(createCommentMock).not.toHaveBeenCalled(); | ||
| expect(createIssueMock).toHaveBeenCalledOnce(); | ||
| expect(createIssueMock).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| headers: { "X-GitHub-Api-Version": "2022-11-28" }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing header assertion for the 💡 Suggested additionIn the daily-cap test block (the one that asserts expect(createIssueMock).toHaveBeenCalledWith(
expect.objectContaining({
headers: { "X-GitHub-Api-Version": "2022-11-28" },
})
);This mirrors the pattern already used at line 424 for the main issue creation path.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 6c00eee. The daily-cap rollup test now asserts the |
||
| }) | ||
| ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/tdd] This assertion covers one of the four patched call sites, leaving two paths — parent issue creation ( 💡 Suggested additionsIn the test for the parent issue creation path: expect(createIssueMock).toHaveBeenCalledWith(
expect.objectContaining({
headers: { "X-GitHub-Api-Version": "2022-11-28" },
})
);And similarly in the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 6c00eee. Added explicit header coverage for the missing parent-issue and daily-cap create paths in |
||
| expect(searchMock).toHaveBeenCalledWith(expect.objectContaining({ q: expect.stringContaining('"gh-aw-agentic-workflow:"') })); | ||
| expect(searchMock).toHaveBeenCalledWith(expect.objectContaining({ q: expect.stringContaining('"workflow_id: test-workflow" in:body') })); | ||
| }); | ||
|
|
@@ -3160,6 +3165,7 @@ describe("handle_agent_failure", () => { | |
| expect(createCall.title).toBe(CASCADE_ROLLUP_TITLE); | ||
| expect(createCall.labels).toContain(CASCADE_ROLLUP_LABEL); | ||
| expect(createCall.labels).toContain("agentic-workflows"); | ||
| expect(createCall.headers).toEqual({ "X-GitHub-Api-Version": "2022-11-28" }); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/tdd] Minor style inconsistency: this assertion uses direct property access ( 💡 Consistent patternIf the test already has access to the call arguments via
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 6c00eee. The header assertions in |
||
|
|
||
| // All 10 issues labeled | ||
| expect(addLabelsMock).toHaveBeenCalledTimes(10); | ||
|
|
||
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.
ensureParentIssuecreate path has zero header test coverage: the header is added here, but no test ever reaches this branch — every existing test mockssearch.issuesAndPullRequeststo return an existing parent issue, which causesensureParentIssueto short-circuit before reachingissues.create. The header change at this callsite is functionally unverified.💡 Suggested fix
Add a test where the search mock returns an empty result for the parent-issue query, forcing
ensureParentIssueto hit the create path, and assert:A minimal setup is a search mock that returns
{ total_count: 0, items: [] }only when the query contains"[aw] Failed runs".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.
Addressed in 6c00eee. Added a test that enables grouped reports, forces the
[aw] Failed runscreate path, and verifies the version header on that parent issue creation.