Skip to content

Add err.rs error-code stability test asserting frozen client-facing numbers #679

Description

@greatest0fallt1me

Description

err.rs defines many error variants whose numeric codes are part of the client-facing API. Add a snapshot test that asserts a frozen mapping of variant name to numeric code so accidental reordering or insertion in the middle of the enum causes the CI to fail loudly.

Requirements and Context

  • Snapshot table in a test file
  • Adding a new variant requires explicitly extending the table
  • Removing a variant fails the test
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b task/err-code-stability-snapshot
  2. Implement changes
    • contracts/predictify-hybrid/src/tests/err_code_stability_tests.rs
  3. Test and commit
    • cargo test -p predictify-hybrid err_code_stability
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

test: freeze err.rs error-code snapshot for client stability

Acceptance Criteria

  • All current Error variants are in the snapshot
  • CI fails on insertion-in-middle of enum
  • Doc string explains the policy

Guidelines

  • NatSpec-style /// doc comments where relevant
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / StellartestingTests and coverage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions