Repository navigation
test(policy,budget): pin deterministic error codes at boundary - #435
Merged
Cjay-Cyber-2 merged 4 commits intoOct 7, 2026
Merged
Cjay-Cyber-2 merged 4 commits into
Cjay-Cyber-2 merged 4 commits into
Conversation
…ilure paths Adds unit tests to contracts/policy and contracts/budget that assert the exact wire code (the literal u32 an off-chain consumer decodes) rather than only the error variant, so a table renumber or a refusal routed through the wrong gate fails in CI instead of in production. Policy: single-transaction ceiling boundary (20), malformed amounts (12), unknown policy (1), disabled policy (20), cumulative allowance ceiling (83) including a ceiling lowered below spent, lapsed allowance (84), pinned recipient (20), recipient blocklist (22), merchant blocklist (23), asset allow-list (43), and out-of-bounds amounts failing closed without panicking. Budget: exact-limit acceptance and one-unit-over BUDGET_EXCEEDED (40) on every spend entrypoint, INVALID_AMOUNT (12), NOT_FOUND (1), UNAUTHORIZED (3), lifecycle gates frozen (41), archived (42), unregistered asset (43), expired (44), not-yet-started (45), and i128 boundary spends failing with OVERFLOW (11) instead of wrapping. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Contributor
CI Checks Failed — Action NeededThe required test job does not compile. contracts/budget/src/test.rs has multiple E0308 mismatches because assertions such as lines 2355, 2389, 2402, 2419, 2429, 2437, 2481, 2509, 2529, and 2538 compare try_* results to Err(Ok(Error::...)), but the current generated client returns a nested conversion/invocation result with a different error shape. Update these assertions (and the shared_wire_code call around line 3212) to match the current try_* return types, then rerun the full workspace tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Testing
cargo test -p astroid-policycargo test -p astroid-budgetcargo test --workspaceCloses #252