Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [Unreleased]

### Changed
- `socket fix` now exits with code 5 when it computed fixes it could not apply, matching the Coana CLI. Automation can tell this apart from a failed run, which still exits with 1. The `--output-file` JSON lists the unapplied fixes under `notApplied`.

## [1.8.3](https://github.com/SocketDev/socket-cli/releases/tag/v1.8.3) - 2026-10-15

### Changed
Expand Down
2 changes: 2 additions & 0 deletions src/commands/fix/coana-fix.mts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ function readWrittenFiles(outputFile: string): Set<string> | undefined {
type CoanaFixResult = CResult<{ fixedAll: boolean; ghsaDetails: unknown[] }>

// Coana exits with this code after writing an --output-file that lists computed fixes it left unapplied.
// Local mode exits with it too, so automation can tell unapplied fixes from a failed run.
const COANA_FIXES_NOT_APPLIED_EXIT_CODE = 5

type NotAppliedFix = {
Expand Down Expand Up @@ -585,6 +586,7 @@ async function coanaFixWithFacts(
if (!fixCResult.ok || notApplied.length) {
return {
ok: false,
code: COANA_FIXES_NOT_APPLIED_EXIT_CODE,
message:
fixesResultJson?.type === 'no-fixes-applied'
? 'No computed fixes were applied'
Expand Down
2 changes: 2 additions & 0 deletions src/commands/fix/handle-fix-limit.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ describe('socket fix --pr-limit behavior verification', () => {

expect(result).toEqual({
ok: false,
code: 5,
message: 'No computed fixes were applied',
cause: expect.stringContaining('no supported lockfile found'),
data: {
Expand Down Expand Up @@ -642,6 +643,7 @@ describe('socket fix --pr-limit behavior verification', () => {
})

expect(result.ok).toBe(false)
expect(result.code).toBe(5)
expect(result.message).toBe('Some computed fixes were not applied')
expect(result.data).toEqual({ fixedAll: false, ghsaDetails: [output] })
expect(JSON.parse(await fs.readFile(outputFile, 'utf8'))).toEqual(output)
Expand Down
Loading