Skip to content

feat: event schema registry and circuit-breaker resume policy - #691

Merged
greatest0fallt1me merged 2 commits into
Predictify-org:masterfrom
Abd-Standard:schema/registry
Jun 27, 2026
Merged

feat: event schema registry and circuit-breaker resume policy#691
greatest0fallt1me merged 2 commits into
Predictify-org:masterfrom
Abd-Standard:schema/registry

Conversation

@Abd-Standard

Copy link
Copy Markdown
Contributor

Closes #601

Closes #606

#601 – EventSchemaRegistry in events.rs

  • Add EventSchemaEntry {topic, schema_version} contracttype
  • Add EventSchemaRegistry::get_schema(env, name) as single source of truth for oracle_result and dispute_created topics (v1)
  • emit_oracle_result / emit_dispute_created now read topic+version from the registry instead of inline literals; topic tuple gains schema_version
  • Tests: lookup hit, lookup miss, version mismatch, emit smoke tests

#606 – HalfOpen cooldown and admin resume in circuit_breaker.rs

  • Add half_open_since: u64 to CircuitBreakerState (zero when not HalfOpen)
  • Add CircuitBreaker::request_resume(env, admin): Open -> HalfOpen with cooldown; errors if breaker is not Open
  • record_success: probe count only increments after recovery_timeout has elapsed since half_open_since; auto-closes on threshold
  • record_failure: re-opens from HalfOpen and clears half_open_since
  • Expose request_resume as a contract entrypoint in lib.rs
  • Tests: cooldown-not-elapsed, probe-failure-reopens, probe-success-threshold-closes

Predictify-org#601 – EventSchemaRegistry in events.rs
- Add EventSchemaEntry {topic, schema_version} contracttype
- Add EventSchemaRegistry::get_schema(env, name) as single source of
  truth for oracle_result and dispute_created topics (v1)
- emit_oracle_result / emit_dispute_created now read topic+version from
  the registry instead of inline literals; topic tuple gains schema_version
- Tests: lookup hit, lookup miss, version mismatch, emit smoke tests

Predictify-org#606 – HalfOpen cooldown and admin resume in circuit_breaker.rs
- Add half_open_since: u64 to CircuitBreakerState (zero when not HalfOpen)
- Add CircuitBreaker::request_resume(env, admin): Open -> HalfOpen with
  cooldown; errors if breaker is not Open
- record_success: probe count only increments after recovery_timeout has
  elapsed since half_open_since; auto-closes on threshold
- record_failure: re-opens from HalfOpen and clears half_open_since
- Expose request_resume as a contract entrypoint in lib.rs
- Tests: cooldown-not-elapsed, probe-failure-reopens,
  probe-success-threshold-closes
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Abd-Standard 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

@greatest0fallt1me
greatest0fallt1me merged commit 804639b into Predictify-org:master Jun 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants