Skip to content

fix: resolve duplicate error codes in MeshKit - #1112

Open
SuryanshGarg04 wants to merge 2 commits into
meshery:masterfrom
SuryanshGarg04:fix/duplicate-error-codes-1106
Open

SuryanshGarg04 wants to merge 2 commits into
meshery:masterfrom
SuryanshGarg04:fix/duplicate-error-codes-1106

Conversation

@SuryanshGarg04

@SuryanshGarg04 SuryanshGarg04 commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR resolves the pre-existing duplicate integer error codes identified in MeshKit.

Fixes: #1106

The conflicting allocations were reviewed against Git history to determine which error should retain its existing code. The remaining conflicting errors were assigned fresh codes using errorutil, rather than manually assigning replacement values.

What Changed

  • Removed the identified duplicate integer error-code allocations.
  • Preserved the historically appropriate allocation for each conflict.
  • Renumbered the remaining conflicting errors using errorutil update.
  • Updated next_error_code through the allocator.
  • Renamed utils/csv/errors.go to utils/csv/error.go so the existing errorutil allocation workflow could process the affected CSV error declaration.
  • Updated affected references and documentation where required.

Validation

  • errorutil analyze reports 0 duplicate integer error codes.
  • errorutil check continues to detect newly introduced duplicate allocations.
  • Valid errorutil-generated allocations remain accepted.
  • go build ./... passes.
  • go test ./... passes.
  • go vet ./... passes.
  • Repository-wide reference checks were performed for the renumbered codes and affected constants.

Scope

This PR is limited to cleaning up the existing duplicate error-code allocations.

It does not change:

  • errorutil check validation semantics.
  • The existing allocation mechanism.
  • Merge Queue or merge-time allocation.
  • The repository's component-level error-code ownership model.
  • errorutil update behavior for declarations outside error.go.

This cleanup is separate from the validation work in #1080, #1105, #1107, and #21009.

Outcome

MeshKit no longer contains the pre-existing duplicate integer error-code allocations identified in this issue. Future duplicate allocations remain covered by the allocation-aware validation introduced in the related work.

Summary by CodeRabbit

  • Bug Fixes
    • Updated error identifiers across encoding, file handling, model conversion, entity updates, registry operations, CSV conversion, compression, byte conversion, and Kubernetes utilities.
    • Corrected the next available error-code marker to reflect the updated identifier range.

Signed-off-by: Suryansh Garg <suryanshgarg04@gmail.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: b9777659-aa03-44a5-b519-68d565fe1b88

📥 Commits

Reviewing files that changed from the base of the PR and between 4021148 and bc5b692.

📒 Files selected for processing (11)
  • broker/nats/error.go
  • encoding/error.go
  • files/error.go
  • helpers/component_info.json
  • models/converter/error.go
  • models/meshmodel/entity/error.go
  • registry/error.go
  • utils/csv/error.go
  • utils/error.go
  • utils/kubernetes/expose/error.go
  • utils/kubernetes/kompose/error.go

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change renumbers error identifiers across multiple MeshKit components and updates the configured next error code to 11344. No error handling or control flow changed.

Changes

Error Code Updates

Layer / File(s) Summary
Core error code renumbering
broker/nats/error.go, encoding/error.go, files/error.go, models/.../error.go
Broker, encoding, file, and model error constants now use the meshkit-11328 through meshkit-11336 range.
Registry and utility error code renumbering
registry/error.go, utils/error.go, utils/csv/error.go, utils/kubernetes/*/error.go
Registry, CSV, compression, conversion, and Kubernetes error constants now use the meshkit-11337 through meshkit-11343 range.
Next error code allocation
helpers/component_info.json
The configured next_error_code value changed from 11328 to 11344.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 293bd

No actionable merge-blocking risk remains from these changes.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 10 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: resolving duplicate error codes in MeshKit.
Linked Issues check ✅ Passed The PR satisfies the coding requirements in issue #1106. It preserves selected historical allocations and moves the remaining conflicts to unique codes in the valid range. It updates affected declarat…
Out of Scope Changes check ✅ Passed The changes stay within issue #1106. They perform historical duplicate cleanup, update affected error-code declarations, update the allocation cursor, and rename the CSV declaration file for the exist…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 10 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SuryanshGarg04

Copy link
Copy Markdown
Member Author

@coderabbitai do a full review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

@SuryanshGarg04 I will perform a complete review of PR #1112.

✅ Action performed

Full review finished.

Signed-off-by: Suryansh Garg <132171202+SuryanshGarg04@users.noreply.github.com>

@lekaf974 lekaf974 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@everleepham

Copy link
Copy Markdown
Contributor

Hi @SuryanshGarg04 , I'm working on a MeshKit PR (#1198) that adds new error codes to broker/nats, and I noticed that meshkit-11327 is duplicated (ErrUnsubscribeCode and ErrUnmarshalSchemaAssetCode). I wanted to open an issue but then I found #1106 and saw that you had already opened this PR to fix it, nice work! It was approved in october but it hasn't been merged yet. Is there anything left to do here? Happy to help if you need a hand.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix pre-existing duplicate error codes in MeshKit

4 participants