Skip to content

Conversation

@dankeboy36
Copy link
Contributor

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When a client archives a sketch via gRPC and the archiveTarget already exists, the CLI correctly errors, but with the incorrect status code. The status code is 3 (illegal argument) instead of 6 (already exists).
Currently, clients must parse the error message if they want to handle the archive -> fail -> archive with override flow. This might not work reliably with translations.

What is the new behavior?

The CLI errors with the correct already exists status code when archiving a sketch, and the archive target already exists.

Does this PR introduce a breaking change, and is titled accordingly?

Actually, this is a breaking change, but I do not know if any client is explicitly handling status code 3. The Arduino IDE 2.x just wipes the target if it exists: https://github.com/arduino/arduino-ide/blob/4d6cfad0ff603a106efd68ffe015d6fc7449f5fc/arduino-ide-extension/src/node/sketches-service-impl.ts#L637-L639

Other information

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.49%. Comparing base (350b0ce) to head (c0d8d27).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
commands/cmderrors/cmderrors.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3050      +/-   ##
==========================================
- Coverage   69.49%   69.49%   -0.01%     
==========================================
  Files         253      253              
  Lines       19166    19172       +6     
==========================================
+ Hits        13320    13324       +4     
- Misses       4615     4617       +2     
  Partials     1231     1231              
Flag Coverage Δ
unit 69.49% <71.42%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cmaglie cmaglie force-pushed the fix/correct-status-code-when-archive-already-exists branch from ab99f73 to c0d8d27 Compare December 9, 2025 15:08
@cmaglie cmaglie self-assigned this Dec 9, 2025
@cmaglie cmaglie added type: enhancement Proposed improvement topic: gRPC Related to the gRPC interface labels Dec 9, 2025
@cmaglie cmaglie merged commit 8c79888 into arduino:master Dec 9, 2025
100 checks passed
@cmaglie cmaglie added the conclusion: resolved Issue was resolved label Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conclusion: resolved Issue was resolved topic: gRPC Related to the gRPC interface type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants