Skip to content

test: verify each HostError maps to the correct severity level (#227)#238

Open
Faithy5 wants to merge 3 commits into
Toolbox-Lab:mainfrom
Faithy5:fix/issue-227-severity-tests
Open

test: verify each HostError maps to the correct severity level (#227)#238
Faithy5 wants to merge 3 commits into
Toolbox-Lab:mainfrom
Faithy5:fix/issue-227-severity-tests

Conversation

@Faithy5

@Faithy5 Faithy5 commented Jun 17, 2026

Copy link
Copy Markdown

Summary

Closes #227

Adds unit tests that assert the correct Severity for a representative set of host error codes across all categories, with at least one test per severity level (Fatal, Error, Warning).

Changes

New mapping entry

  • storage.rs: Added NearExpiry (code 4, Severity::Warning) — a ledger entry approaching TTL expiry is a real Soroban concept and the canonical Warning-level case
  • storage.toml: Matching taxonomy entry with severity = "Warning"

New tests in severity_tests.rs

Test Severity covered
storage_near_expiry_maps_to_warning Warning (mapping table)
build_report_storage_near_expiry_is_warning Warning (end-to-end via build_report)
taxonomy_warning_severity_is_correctly_parsed Warning (taxonomy string parsing)
all_storage_entries_have_valid_severity Exhaustive guard for storage table

Existing tests already covered Fatal and Error. All three severity levels are now covered by real mapping entries and build_report round-trips — any regression in severity mapping will cause a clear test failure.

Faithy5 added 3 commits June 16, 2026 11:07
…-Lab#227)

- Add severity_tests.rs with 14 unit tests covering Fatal, Error, and Warning levels
- Test ErrorSeverity→Severity conversion for all four variants
- Test build_report severity via taxonomy for Budget, Auth, Context categories
- Exhaustive sweep tests for all budget and value mapping table entries
- Wire module in mappings/mod.rs
…lbox-Lab#227)

- Add NearExpiry (code 4, Warning) entry to storage mapping table and storage.toml taxonomy
- Add tests covering all three severity levels: Fatal, Error, Warning
- Add build_report round-trip tests for each severity level
- Add exhaustive all_storage_entries_have_valid_severity guard test
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.

Write Tests That Verify Each HostError Maps to the Correct Severity Level

1 participant