Skip to content

fix(adapters): enforce safe-integer duration ceilings and integer-exact epoch timestamps across Cedar, OPA, and AGT policy adapters (#111) - #116

Merged
rajnisht7 merged 3 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-policy-adapters-111
Nov 25, 2026
Merged

rajnisht7 merged 3 commits into
agentrust-io:mainfrom
drk-ram:drk-ram-fix-policy-adapters-111

Conversation

@drk-ram

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

Copy link
Copy Markdown
Contributor

Closes #111

Summary

  • Enforce type(evaluation_duration_ns) is int and 0 <= evaluation_duration_ns <= 9_007_199_254_740_991 in Python cedar_policy_decision, opa_decision_log, and agt_policy_decision to match TypeScript Number.isSafeInteger checks.
  • Compute _timestamp_ns in Python opa_decision_log and agt_policy_decision using exact integer epoch delta arithmetic instead of float datetime.timestamp(), and reject pre-epoch (< 1970-01-01T00:00:00Z) timestamps in both Python and TypeScript (packages/typescript/src/adapters.ts).
  • Add subTest-isolated Python and TypeScript unit tests in tests/test_adapters.py and packages/typescript/test/adapters.test.ts.

Validation

  • pytest tests/test_adapters.py tests/test_agt_adapter.py -q — passed (23 passed)

@drk-ram
drk-ram requested review from a team and imran-siddique as code owners October 25, 2026 06:47
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

🟡 Contributor Check: MEDIUM

Check Result
Profile MEDIUM
Credential LOW
Overall MEDIUM

Automated check by AgenTrust Contributor Check.

…ct epoch timestamps across Cedar, OPA, and AGT policy adapters (agentrust-io#111)

Signed-off-by: Raghuvar Karthik Durga <177662415+drk-ram@users.noreply.github.com>
@drk-ram
drk-ram force-pushed the drk-ram-fix-policy-adapters-111 branch from 996c5c9 to 94b1054 Compare November 13, 2026 01:13

@imran-siddique imran-siddique left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving at 94b1054: ran conformance, the Python suite and the TS check on this head; each new test fails against main's source; all 11 PRs in this series merge onto main together without conflicts and pass combined.

@rajnisht7
rajnisht7 enabled auto-merge (squash) November 25, 2026 06:43
@rajnisht7
rajnisht7 disabled auto-merge November 25, 2026 06:44
@rajnisht7
rajnisht7 enabled auto-merge (squash) November 25, 2026 06:53
@rajnisht7
rajnisht7 merged commit 0317c04 into agentrust-io:main Nov 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-review:MEDIUM Contributor check flagged MEDIUM risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adapters (cedar, opa, agt): Python policy adapters miss safe-integer duration ceilings and integer-exact epoch timestamp conversion

3 participants