chore: inline details around exit codes #6455
Open
+40
−0
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.
Pull Request Submission Checklist
What does this PR do?
This PR introduces comprehensive inline documentation for the CLI exit code strategy. It establishes a formal "Source of Truth" within the codebase regarding the design philosophy, technical constraints (8-bit limits), and the nature of exit codes as a stable public API contract.
Key additions include:
constantspackage to the implementation logic inbehavior.Where should the reviewer start?
Start with
cliv2/cmd/cliv2/behavior/maperrortoexitcode.goto review the design philosophy and constraints added to theMapErrorCatalogToExitCodefunction. Then verify the cross-reference incliv2/internal/constants/constants.go.How should this be manually tested?
This is a documentation-only change to existing files. Verify that the comments are correctly picked up by
go doc:What's the product update that needs to be communicated to CLI users?
No functional change to the product; this PR improves internal maintainability and contributor alignment with Snyk's public API stability standards.
Risk assessment (Low | Medium | High)?
Low. This PR adds documentation/comments only and does not modify the execution logic of the mapping function or the value of the constants.
Any background context you want to provide?
As the CLI matures, it is essential to prevent "exit code sprawl." By documenting that exit codes are a stable contract and suggesting JSON for granular details, we reduce the likelihood of accidental breaking changes and maintain a clean interface for CI/CD automation.