-
Notifications
You must be signed in to change notification settings - Fork 35
include PR link and number in JSON output for socket fix. Also remove… #1063
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
Merged
Conversation
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
…s the nested data layer
|
Bugbot Autofix prepared a fix for 2 of the 2 bugs found in the latest run.
Or push these changes by commenting: Preview (46226d3a6c)diff --git a/src/commands/fix/coana-fix.mts b/src/commands/fix/coana-fix.mts
--- a/src/commands/fix/coana-fix.mts
+++ b/src/commands/fix/coana-fix.mts
@@ -111,7 +111,9 @@ async function discoverGhsaIds(
export async function coanaFix(
fixConfig: FixConfig,
-): Promise<CResult<{ fixedAll: boolean; ghsaDetails: Record<string, unknown> }>> {
+): Promise<
+ CResult<{ fixedAll: boolean; ghsaDetails: Record<string, unknown> }>
+> {
const {
all,
applyFixes,
@@ -290,7 +292,10 @@ export async function coanaFix(
}
// Read the temporary file to get the actual fixes result.
- const fixesResultJson = readJsonSync(tmpFile, { throws: false })
+ const fixesResultJson = readJsonSync(tmpFile, { throws: false }) as
+ | { fixes?: Record<string, unknown> }
+ | null
+ | undefined
// Copy to outputFile if provided.
if (outputFile) {
@@ -301,11 +306,24 @@ export async function coanaFix(
await fs.writeFile(outputFile, tmpContent, 'utf8')
}
+ // Transform to GHSA-keyed map format for consistency with PR mode.
+ const ghsaDetails: Record<string, unknown> = {
+ __proto__: null,
+ } as Record<string, unknown>
+ if (fixesResultJson && typeof fixesResultJson === 'object') {
+ const fixes = fixesResultJson.fixes
+ if (fixes && typeof fixes === 'object') {
+ for (const ghsaKey of Object.keys(fixes)) {
+ ghsaDetails[ghsaKey] = fixesResultJson
+ }
+ }
+ }
+
return {
ok: true,
data: {
fixedAll: true,
- ghsaDetails: (fixesResultJson as Record<string, unknown>) ?? {},
+ ghsaDetails,
},
}
} finally {
@@ -462,6 +480,13 @@ export async function coanaFix(
if (!modifiedFiles.length) {
debugFn('notice', `skip: no changes for ${ghsaId}`)
+ // Clean up temp file before continuing.
+ try {
+ // eslint-disable-next-line no-await-in-loop
+ await fs.unlink(tmpFile)
+ } catch {
+ // Ignore cleanup errors.
+ }
continue ghsaLoop
} |
Contributor
Author
|
@cursor review |
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.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
jdalton
approved these changes
Jan 28, 2026
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.
Various updates to the
--jsonoutput fromsocket fix:ghsaDetailswhich is an array of fix details. This map is now also constructed from the PR mode where the Coana CLI is invoked multiple times.data: { data: { ... }}from the JSON outputNotice: This PR is including multiple breaking changes, so we need to inform frequent users of
socket fixwhen we roll it out.Example of what the new JSON output looks like:
Note
Overhauls the
socket fix --jsonresponse and plumbs Coana output through both local and PR modes.data: { data?, fixed }withdata: { fixedAll, ghsaDetails[] };fixed->fixedAlland GHSA-specific details aggregated intoghsaDetails--output-file, reads result JSON, and appendspullRequestLinkandpullRequestNumberfor each created PR--output-fileand returns a single entry inghsaDetails(if present)--output-filewhen providedWritten by Cursor Bugbot for commit cf08af4. This will update automatically on new commits. Configure here.