Skip to content

fix(fix): fail when Coana leaves computed fixes unapplied - #1584

Draft
Martin Torp (mtorp) wants to merge 1 commit into
v1.xfrom
martin/eng-5437-fix-not-applied
Draft

Martin Torp (mtorp) wants to merge 1 commit into
v1.xfrom
martin/eng-5437-fix-not-applied

Conversation

@mtorp

Copy link
Copy Markdown
Contributor

Part of ENG-5437. socket fix reported success whenever Coana exited 0, and local mode hardcoded fixedAll: true. So a run where Coana skipped a directory and changed nothing still printed "Finished!" and exited 0.

The matching Coana change (coana-tech/coana-package-manager#2541) lists fixes it could not apply under notApplied in its --output-file, uses the new type no-fixes-applied when nothing was applied, and exits with 5.

What changes

  • Local mode: exit 5 from Coana is treated as a result, not a crash. socket fix still reads and copies the output file, then fails with "No computed fixes were applied" or "Some computed fixes were not applied". The cause lists each unapplied fix with its reason. fixedAll is false. A non-empty notApplied with exit 0 is treated the same way.
  • PR mode: exit 5 logs a warning listing the unapplied fixes and falls through to the existing check for changed files. So a PR still opens for whatever was applied, and nothing opens when nothing changed. Other Coana failures are handled as before.
  • Any other non-zero Coana exit is unchanged.

This is safe to merge before the Coana change ships, because the current Coana never exits 5 or writes notApplied. It takes effect once the Coana version is bumped.

Testing

New tests in handle-fix-limit.test.mts cover exit 5 with nothing applied, exit 5 with some applied (and --output-file still written), a clean run, and an unrelated Coana failure. The fix tests pass, except handle-fix-id.test.mts, which fails locally on GitHub API mocks and is untouched here.

Expected reviewer effort: High-level design decisions

socket fix reported success whenever Coana exited 0, and hardcoded
fixedAll: true. Coana now lists fixes it could not apply under
notApplied in its --output-file and exits 5. socket fix treats that
exit as a result rather than a crash: it still copies the output file,
then fails with each unapplied fix and its reason, and sets fixedAll
to false. In PR mode it warns and opens a PR for whatever was applied.

Refs ENG-5437

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant