Repository navigation
fix(provenance): type issued_at and tool_count as integer and decide by value (#485) - #520
Merged
imran-siddique merged 1 commit intoOct 15, 2026
Conversation
…by value (agentrust-io#485) Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
imran-siddique
approved these changes
Oct 15, 2026
imran-siddique
left a comment
Member
There was a problem hiding this comment.
This is the #485 ruling as written: both members decided by value, the bool and range guards kept, and the 1760000000.0 / 1760000000.5 pair in place. I'm taking the two server-provenance-v1.md rows as the maintainer correction I said I would carry, so they land here rather than separately. Checked together with #518, #519 and #521: all four merge cleanly onto main and the combined tree passes everything main passes.
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 #485
Contributor: Raghuvar Durga (@drk-ram)
Per maintainer direction on #485 (
@imran-siddique— option 1, decide by value per TRACE v0.2 §3.2.2):spec/server-provenance-v1.md(§3 field table, inherited byspec/server-provenance-v2.md§1):Types both
issued_atandtool_catalog.tool_countas non-negative integers:| issued_at | yes | Non-negative integer: Unix seconds when this record was signed <!-- CHANGED: #485 - type issued_at as integer --> || tool_catalog.tool_count | yes | Non-negative integer: number of tools. Redundant with the hash by design: a consumer that sees a plausible count and an unexpected hash learns more than one that sees only a mismatch <!-- CHANGED: #485 - type tool_catalog.tool_count as integer --> |Per
@imran-siddique, the spec sentence is carried as a maintainer correction andCHANGELOG.mdis left untouched.src/agentrust_trace/provenance.py:issued_at(in_check_structure, used by bothbuild_recordandverify_record) andtool_catalog.tool_count(in_tool_count, used by bothverify_recordandcheck_tool_catalog) by value via_integer_value(spec/trace-v0.2.md§3.2.2), wrappingValueErrorinProvenanceErrorand preserving theboolexclusion, the>= 0bound, and the<= JCS_SAFE_INTEGERbound.build_recordstores the validated integer valuestamped_atreturned by_check_structure, whileverify_recordandcheck_tool_catalogaccept whole-valued float spellings (1760000000.0,1.76e9,1.0,1e0) over the same RFC 8785 canonical bytes and signature as their integer spellings.Tests (
tests/test_provenance.py,tests/test_provenance_tool_count.py,tests/test_integer_by_value.py):1760000000.0/1.76e9forissued_at;1.0/1e0and2.0/2e0fortool_catalog.tool_count) beside fractional (1760000000.5/17600000005e-1,1.5/15e-1), boolean, string, negative (-1,-1.0), and out-of-range (9007199254740992,9007199254740992.0,1e21) values refused across v1 and v2.Cold-reader review: A fresh
code-reviewagent inspected the diff against issue #485,spec/server-provenance-v1.md,spec/server-provenance-v2.md,spec/trace-v0.2.md§3.2.2, andsrc/agentrust_trace/sign.py. It verified that_check_structureand_tool_countpreserve thebool, non-negative (>= 0), andJCS_SAFE_INTEGERguards while deciding integer membership by value, thatcheck_tool_catalogstill checks hash mismatches ahead oftool_count, and that paired positive/negative test cases cover both v1 and v2; no defects were found and no post-review changes were required.Type of change
Spec section
spec/server-provenance-v1.md§3 ("The record", inherited byspec/server-provenance-v2.md§1), applyingspec/trace-v0.2.md§3.2.2 ("What counts as an integer").Tests for a fix
Running
python tools/review_bar.py --base 6666574 --head HEADreports 53 fail on behaviour, 0 fail on a missing name or file:tests/test_provenance.py::test_issued_at_is_decided_by_value_in_pairs[1760000000.0-1760000000.5]and[1760000000.0-1760000000.5]/[9007199254740991.0-9007199254740992.0]: fails onmainbecausebuild_recordandverify_recordrejected whole-valuedfloattimestamps (1760000000.0,1.76e9,float(JCS_SAFE_INTEGER)).tests/test_provenance_tool_count.py::test_whole_float_tool_count_verifies_and_matches_live_catalog[2.0]and[2.0]: fails onmainbecause_tool_countrejected whole-valuedfloatcounts (2.0,2e0).tests/test_provenance_tool_count.py::test_verify_record_refuses_out_of_range_tool_count_in_both_spellingsandtests/test_provenance_tool_count.py::test_check_tool_catalog_alone_refuses_malformed_count: fail onmainforJCS_SAFE_INTEGER + 1,float(JCS_SAFE_INTEGER + 1), and1e21because_tool_countpreviously lacked theJCS_SAFE_INTEGERbound.tests/test_integer_by_value.py::test_provenance_integer_members_written_as_whole_floats_are_the_values_signed,test_a_provenance_issued_at_that_is_not_a_non_negative_integer_is_refused_with_its_reason, andtest_a_provenance_tool_count_that_is_not_a_non_negative_integer_is_refused_with_its_reason: fail onmainacross v1 and v2.Validation commands run and passed:
pytest tests/test_provenance.py tests/test_provenance_clock.py tests/test_provenance_tool_count.py tests/test_integer_by_value.py tests/test_public_functions_raise_what_they_document.py tests/test_requirement_keywords_are_attributable.py— passed (665 passed)python tools/sweep_public_surface.py --strict— passed (89 parameters swept, 141 accepted junk values, 0 unfiled leak(s))ruff check src tests scripts— passed (All checks passed!)python tools/check_dashes.py— passed (no dashes outside examples/, spec/trace-v0.1.md)mypy src/agentrust_trace— passed (Success: no issues found in 15 source files)Checklist
git commit -s)CHANGELOG.mdupdated (for any normative change)<!-- CHANGED: #NNN: description -->in spec text