Repository navigation
conformance: align TR-ENV, TR-APR, TR-TXN and TR-SIG with §3.2.2 integer-by-value and safe-integer bounds (#516) - #521
Merged
imran-siddique merged 1 commit intoOct 15, 2026
Conversation
…ger-by-value and safe-integer bounds - Decide `iat` (`TR-ENV-002`), `appraisal.timestamp` (`TR-APR-004`), and `tool_transcript.call_count` (`TR-TXN-002`) by mathematical integer value within the RFC 8785 safe-integer range `[-9007199254740991, 9007199254740991]` (accepting whole-valued floats such as `1785000000.0` and `1.785e9` and excluding booleans, fractional floats, non-finite floats, and values past `2^53 - 1`). - Refuse whole-valued floats outside `[-9007199254740991, 9007199254740991]` in `tr_sig._canonical_json` before `rfc8785.dumps` and catch `RecursionError` in `tr_sig._canonical_body`, matching `agentrust_trace.sign._canonical_bytes`. - Update `conformance/docs/modules/tr-apr.md` (`TR-APR-004`) to distinguish whole-valued floats from fractional floats and numbers outside the safe range (agentrust-io#448 item 24). - Add unit tests and boundary coverage across `test_tr_env.py`, `test_tr_apr.py`, `test_tr_txn.py`, and `test_tr_sig.py`. Closes agentrust-io#516 Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Oct 15, 2026
imran-siddique
approved these changes
Oct 15, 2026
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.
What this changes
Closes #516
Aligns the conformance suite (
conformance/src/trace_tests/modules/) and its module documentation withspec/trace-v0.2.md§3.2.2 ("What counts as an integer"),agentrust_trace.sign, andtrust-record-verify:conformance/src/trace_tests/modules/tr_env.py(TR-ENV-002): Decidesiatby mathematical integer value within[1700000000, 9007199254740991], accepting whole-valued floats (1785000000.0,1.785e9) and rejecting booleans, fractional floats (1785000000.5), non-finite floats, and values outside the RFC 8785 safe-integer range (9007199254740992,1.0e21).conformance/src/trace_tests/modules/tr_apr.py(TR-APR-004) &conformance/docs/modules/tr-apr.md: Decidesappraisal.timestampby mathematical integer value within[-9007199254740991, 9007199254740991]before checking the future skew window, and updates theTR-APR-004table row inconformance/docs/modules/tr-apr.mdto distinguish whole-valued floats from fractional numbers and out-of-range values (Implementation findings from the Go verifier (#444): 26 items #448 item 24).conformance/src/trace_tests/modules/tr_txn.py(TR-TXN-002): Decidestool_transcript.call_countby mathematical integer value within[0, 9007199254740991].conformance/src/trace_tests/modules/tr_sig.py(_canonical_json/_canonical_body): Walks containers beforerfc8785.dumps(d)to raiserfc8785.IntegerDomainErroron whole-valued floats outside[-9007199254740991, 9007199254740991](9007199254740992.0,1.0e+21) and catchesRecursionErrorin_canonical_body, matchingagentrust_trace.sign._canonical_bytes.Contributor: Raghuvar Durga (@drk-ram)
Cold-reader review noted that while
test_tr_txn.pypinned both inclusive endpoints (0/0.0/-0.0and9007199254740991/9007199254740991.0),test_tr_env.pyandtest_tr_apr.pydid not pin the inclusive boundary values1_700_000_000/1_700_000_000.0(with1_699_999_999/1_699_999_999.0just below) and9007199254740991/9007199254740991.0(verifying that the upper safe-integer bound passes the range check and reaches the future-timestamp check). Addedtest_iat_at_safe_integer_upper_bound_reaches_future_check,_IAT_MINboundary cases intest_tr_env.py, andtest_a_timestamp_at_safe_integer_upper_bound_reaches_future_checkintest_tr_apr.py.Type of change
Spec section
spec/trace-v0.2.md§3.2.2 ("What counts as an integer"), enforced inconformance/src/trace_tests/modules/(TR-ENV-002,TR-APR-004,TR-TXN-002,TR-SIG-001,TR-SIG-005).Tests for a fix
conformance/tests/unit/test_tr_env.py:test_iat_whole_float_passes,test_iat_at_safe_integer_upper_bound_reaches_future_check,test_iat_non_integer_or_outside_safe_integer_range_failsconformance/tests/unit/test_tr_apr.py:test_a_whole_float_or_in_range_timestamp_passes,test_a_timestamp_outside_the_safe_integer_range_fails,test_a_timestamp_at_safe_integer_upper_bound_reaches_future_checkconformance/tests/unit/test_tr_txn.py:test_whole_float_and_safe_bound_call_counts_are_valid,test_fractional_or_out_of_safe_range_call_count_failsconformance/tests/unit/test_tr_sig.py:test_whole_float_past_safe_integer_range_is_refused_in_canonicalization,test_whole_float_inside_safe_integer_range_canonicalizes_by_value,test_deeply_nested_record_fails_closed_without_raising,test_number_spelling_vectors_match_expected_conformance_verdictsValidation commands run:
python tools/check_dashes.py-> passed (no dashes outside examples/, spec/trace-v0.1.md)python -m pytest conformance/tests -q-> passed (761 passed, 5 xpassed)python -m pytest tests/test_integer_by_value.py -q-> passed (158 passed)Checklist
git commit -s)CHANGELOG.mdupdated (for any normative change)<!-- CHANGED: #NNN: description -->in spec text