Skip to content

intent_bridge: normalize integer-by-value timestamps to int and bound now by JCS_SAFE_INTEGER - #573

Merged
imran-siddique merged 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-intent-bridge-integer-normalization
Oct 19, 2026
Merged

imran-siddique merged 1 commit into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-intent-bridge-integer-normalization

Conversation

@drk-ram

@drk-ram drk-ram commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

What this changes

Contributor: Raghuvar Durga (@drk-ram)
Closes #568

In src/agentrust_trace/intent_bridge.py:

  1. _bind_successor_observation validated after["observed_at"] with _integer_value(...) into observed_at (int), then returned the caller's after dictionary unchanged. When after["observed_at"] was a whole-valued float (such as 150.0), sign_successor_artifact emitted "observed_at": 150.0 (float) in the returned artifact dictionary and verify_successor_artifact returned a bound envelope whose "observed_at" remained 150.0 (float). _bind_successor_observation now returns {**after, "observed_at": observed_at} without mutating after in place.
  2. verify_bridge validated authorization["authorized_at"] and authorization["expires_at"] with _integer_value(...) into timestamp (int), then discarded timestamp and returned authorization with float values when 100.0 or 200.0 was supplied. verify_bridge now stores the normalized int values in a shallow copy normalized_auth = dict(authorization) and returns normalized_auth without mutating the caller's bridge["authorization"] in place.
  3. verify_bridge now bounds now by JCS_SAFE_INTEGER (2**53 - 1), raising IntentBridgeError("now must be a non-negative integer Unix timestamp within the JCS safe-integer range") when now > JCS_SAFE_INTEGER.

Type of change

  • Editorial (typo, link fix, clarification: no normative effect)
  • Non-breaking spec change (new optional field, new platform profile, informative addition)
  • Breaking spec change (requires 14-day comment period and Project Lead sign-off)
  • Schema change
  • Example addition

Spec section

Section 3.2.2 (integer-by-value and JCS safe-integer domain in the reference library's intent_bridge module).

Tests for a fix

tests/test_intent_bridge_integer_normalization.py:

  • test_verify_bridge_normalizes_whole_float_timestamps_to_int_without_mutating_input (fails on main with AssertionError: assert <class 'float'> is int)
  • test_sign_successor_artifact_normalizes_whole_float_observed_at_to_int (fails on main with AssertionError: assert <class 'float'> is int)
  • test_verify_successor_artifact_normalizes_whole_float_observed_at_to_int (fails on main with AssertionError: assert <class 'float'> is int)
  • test_verify_bridge_bounds_now_by_jcs_safe_integer (fails on main with AssertionError: Regex pattern did not match because now=JCS_SAFE_INTEGER + 1 and now=10**20 were not rejected by the now range check)

Validation commands run:

  • pytest tests/test_intent_bridge.py tests/test_intent_bridge_integer_normalization.py tests/test_successor_observation.py tests/test_integer_by_value.py tests/test_public_functions_raise_what_they_document.py: passed (510 passed)
  • python tools/sweep_public_surface.py --strict: passed (89 parameters swept, 141 accepted junk values, 0 unfiled leak(s))
  • python tools/review_bar.py --base origin/main --head HEAD: passed (7 fail on behaviour, 0 fail on a missing name or file, 0 pass or skip)
  • python tools/check_dashes.py: passed (no dashes outside examples/, spec/trace-v0.1.md)
  • ruff check src/agentrust_trace/intent_bridge.py tests/test_intent_bridge_integer_normalization.py: passed (All checks passed!)
  • mypy --strict src/agentrust_trace/intent_bridge.py tests/test_intent_bridge_integer_normalization.py: passed (Success: no issues found in 2 source files)

Checklist

  • DCO sign-off on all commits (git commit -s)
  • CHANGELOG.md updated (for any normative change)
  • Breaking changes marked with <!-- CHANGED: #NNN: description --> in spec text
  • Backward compatibility statement included (for breaking changes)

… now

Normalize authorized_at, expires_at, and observed_at to Python int in verify_bridge, sign_successor_artifact, and verify_successor_artifact without mutating caller inputs in place, and bound verify_bridge's now parameter by JCS_SAFE_INTEGER (2**53 - 1).

Closes agentrust-io#568

Signed-off-by: Raghuvar Durga <177662415+drk-ram@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@drk-ram
drk-ram requested review from a team, lywinged and rajnisht7 as code owners October 19, 2026 03:43

@dinakarjs dinakarjs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 3b3651a. Integer-by-value timestamp outputs are normalized on copied containers, signed JCS equivalence is preserved, and the caller's float-valued inputs remain unchanged. now is explicitly bounded to the safe-integer domain without changing the expiry equality refusal.

Independent Linux/Python 3.12.14, matching hash-locked dependencies and exact-checkout imports: 510 selected bridge/successor/integer/public-error tests pass. Additional control verifies normalized int output against unchanged float-valued caller input; bool, negative, fractional, NaN, Inf and above-safe-range now values all refuse. Source diff and DCO checked; returned technical CI succeeds, Dependabot skipped. No blocking finding in this normalization/range change; no live authority, dispatch or hardware claim. Reviewed with OpenAI Codex assistance.

@imran-siddique
imran-siddique merged commit 754b68e into agentrust-io:main Oct 19, 2026
18 of 20 checks passed
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.

intent_bridge: normalize integer-by-value timestamps (authorized_at, expires_at, observed_at) to int and bound now by JCS_SAFE_INTEGER

3 participants