Skip to content

fix(agent): validate mandate timestamp ordering - #287

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
olu-cmd:Validate_mandate
Aug 31, 2026
Merged

fix(agent): validate mandate timestamp ordering#287
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
olu-cmd:Validate_mandate

Conversation

@olu-cmd

@olu-cmd olu-cmd commented Aug 31, 2026

Copy link
Copy Markdown

Closes #274

Goal

Reject signed mandates whose issued, expiry, and commit timestamps are logically inconsistent.

Changes

  • Added validateMandateTimestampOrdering in services/agent/src/mandate.ts:52
  • Enforces issuedAt <= commitDeadline <= expiresAt and issuedAt <= expiresAt
  • Equality is explicitly allowed (> not >=) — defines exact boundary behavior
  • Wired into createSessionMandate (fail-fast) and verifySessionMandate (after signature, before expiry checks)
  • Error messages are stable MandateError: "issuedAt must be <= expiresAt", "issuedAt must be <= commitDeadline", "commitDeadline must be <= expiresAt"

Tests

Added focused tests in services/agent/src/mandate.test.ts:

  • rejects issuedAt > expiresAt
  • rejects issuedAt > commitDeadline
  • rejects commitDeadline > expiresAt
  • allows issuedAt == commitDeadline == expiresAt
  • createSessionMandate rejects ordering violations at creation

pnpm --filter @sub-rosa/agent test — 15 pass
pnpm --filter @sub-rosa/agent typecheck — pass

Reject signed mandates whose issued, expiry, and commit timestamps
are logically inconsistent. Enforce issuedAt <= commitDeadline <=
expiresAt with exact equality allowed. Add focused tests for each
invalid ordering and equality-boundary behavior.

Closes Sub-Rosa-Issue#274
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@olu-cmd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@karagozemin
karagozemin merged commit 9f84664 into Sub-Rosa-Issue:main Aug 31, 2026
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.

Validate mandate timestamp ordering

2 participants