Skip to content

test: add task expiration detection coverage - #176

Merged
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
coderolisa:feat/task-expiration-detection
Aug 30, 2026
Merged

test: add task expiration detection coverage#176
Abd-Standard merged 1 commit into
Core-Foundry:mainfrom
coderolisa:feat/task-expiration-detection

Conversation

@coderolisa

Copy link
Copy Markdown
Contributor

Closes #155

Add a reusable expiration-checking function with comprehensive tests to detect tasks that have passed their deadline.

Changes:

  • Add expiration.rs module with is_task_expired() helper function
  • Refactor submission.rs to use the expiration helper consistently
  • Add 7 unit tests for expiration edge cases (past, future, boundary)
  • Add 4 integration tests verifying expiration in submission flow

The helper uses the existing Task.deadline field and compares it with the current ledger timestamp. A task is expired when current_time > deadline.

Boundary behavior: Tasks at exactly the deadline timestamp are NOT considered expired (deadline is inclusive). This follows the existing convention where env.ledger().timestamp() > task.deadline triggers TaskExpired error.

All 38 tests pass, including existing regression test

Checklist

General

  • Branch is up to date with main
  • PR title follows Conventional Commits format (e.g. feat: add reputation system)
  • PR description is complete with issue reference (Closes #<issue-number>)
  • One logical change per PR (no unrelated changes bundled in)

Testing

  • Tests added or updated to cover the changes
  • All tests pass (cargo test for contracts, npm run build for frontend)
  • No compiler warnings (cargo clippy -- -D warnings)

Documentation

  • Public API changes are documented with /// doc comments (Rust) or JSDoc (TypeScript)
  • CONTRIBUTING.md, README.md, or other docs updated if needed
  • CONTRACT_API.md updated if contract interface changed

Code Quality

  • Code follows the project style (cargo fmt / ESLint)
  • No any types introduced in TypeScript
  • No hardcoded secrets, keys, or environment-specific values

Smart Contract (if applicable)

  • require_auth() called on all state-changing operations
  • Events emitted for all state changes
  • Storage keys don't collide with existing keys
  • Deadline and input validation is complete
  • No unintended token transfer paths introduced

Frontend (if applicable)

  • Components are under 150 lines
  • UI is responsive and accessible
  • Screenshots or recordings included for visual changes

Add a reusable expiration-checking function with comprehensive tests to
detect tasks that have passed their deadline.

Changes:
- Add expiration.rs module with is_task_expired() helper function
- Refactor submission.rs to use the expiration helper consistently
- Add 7 unit tests for expiration edge cases (past, future, boundary)
- Add 4 integration tests verifying expiration in submission flow

The helper uses the existing Task.deadline field and compares it with
the current ledger timestamp. A task is expired when current_time >
deadline.

Boundary behavior: Tasks at exactly the deadline timestamp are NOT
considered expired (deadline is inclusive). This follows the existing
convention where env.ledger().timestamp() > task.deadline triggers
TaskExpired error.

All 38 tests pass, including existing regression tests.
@Abd-Standard
Abd-Standard merged commit f547d47 into Core-Foundry:main Aug 30, 2026
2 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.

Create a Grant Expiration Management System

2 participants