Description
events.rs emits many domain events but observability tooling has no stable, machine-parseable schema. Introduce a StructuredLogEntry event with a schema_id: Symbol, a severity enum (Info/Warn/Error), and a typed fields map so off-chain indexers can decode entries deterministically. Wire it as the low-level primitive that higher-level emitters delegate to.
Requirements and Context
- New
StructuredLogEntry event type in events.rs with a schema_id registry constant
- Emitter helper
EventEmitter::emit_structured(env, schema_id, severity, fields)
- Backwards-compatible — existing typed events continue to fire
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/structured-log-entry-events
- Implement changes
contracts/predictify-hybrid/src/events.rs
contracts/predictify-hybrid/src/tests/structured_log_entry_tests.rs
- Document schema ids in
docs/
- Test and commit
cargo test -p predictify-hybrid structured_log_entry
- Cover edge cases
- Include test output and notes in the PR
Example commit message
feat: add StructuredLogEntry event primitive with stable schema id
Acceptance Criteria
Guidelines
- NatSpec-style
/// doc comments on all new public items
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
events.rsemits many domain events but observability tooling has no stable, machine-parseable schema. Introduce aStructuredLogEntryevent with aschema_id: Symbol, aseverityenum (Info/Warn/Error), and a typedfieldsmap so off-chain indexers can decode entries deterministically. Wire it as the low-level primitive that higher-level emitters delegate to.Requirements and Context
StructuredLogEntryevent type inevents.rswith aschema_idregistry constantEventEmitter::emit_structured(env, schema_id, severity, fields)Suggested Execution
contracts/predictify-hybrid/src/events.rscontracts/predictify-hybrid/src/tests/structured_log_entry_tests.rsdocs/cargo test -p predictify-hybrid structured_log_entryExample commit message
Acceptance Criteria
StructuredLogEntryis emittable from at least three existing call sitesschema_idconstants are exported and documentedGuidelines
///doc comments on all new public items