Skip to content

feat(hitl): implement structured AuditingData schema and validation policy#1553

Open
YuvikaLimboo wants to merge 1 commit intomofa-org:mainfrom
YuvikaLimboo:feature/auditing-layer
Open

feat(hitl): implement structured AuditingData schema and validation policy#1553
YuvikaLimboo wants to merge 1 commit intomofa-org:mainfrom
YuvikaLimboo:feature/auditing-layer

Conversation

@YuvikaLimboo
Copy link
Copy Markdown

@YuvikaLimboo YuvikaLimboo commented Mar 30, 2026

📋 Summary
This PR introduces a high-integrity Auditing Layer to the mofa-kernel. It transitions the system from "stringly-typed" metadata to a deterministic, schema-backed AuditingData structure. This is a foundational requirement for my GSoC 2026 Proposal (Idea #17 : Human loop pauses at any node for manual review).

🔗 Related Issues
Closes : #1502
Related to GSoC 2026 Idea: #17 (Human loop pauses at any node for manual review)

🧠 Context
To support enterprise-grade AI agents in high-stakes environments (Fintech/Web3), we need a "Holy Trinity" Validation Pipeline. This PR solves the problem of fragile HashMap lookups by enforcing:

Context Capture: via the new AuditingData struct.

Policy Enforcement: via the AuditValidationPolicy.

Safety Constraints: via defined AuditError enums.

🛠️ Changes
crates/mofa-kernel/src/hitl/context.rs: Added AuditingData struct and with_auditing_data builder.

crates/mofa-kernel/src/hitl/error.rs: Defined AuditError enum for structured security reporting.

crates/mofa-kernel/src/hitl/policy.rs: Implemented AuditValidationPolicy and integration tests.

🧪 How you Tested
Ran internal integration tests for serialization: cargo test -p mofa-kernel hitl

Verified AuditValidationPolicy correctly triggers HITL requests based on metadata presence.

Confirmed zero regressions in existing HITL logic.

📸 Screenshots / Logs (if applicable)
Plaintext
test_auditing_data_integration: PASSED
test_audit_validation_policy_triggers: PASSED
⚠️ Breaking Changes
[x] No breaking changes

🧹 Checklist
Code Quality
[x] Code follows Rust idioms and project conventions

[x] cargo fmt run

[x] cargo clippy passes without warnings

Testing
[x] Tests added/updated

[x] cargo test passes locally without any error

🧩 Additional Notes for Reviewers
This implementation is designed to be modular so that other developers can adopt the AuditingData schema for their own specific application domains without modifying the core kernel logic.

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.

[ENHANCEMENT] Standardize structured AuditingData in ReviewContext for financial transparency

1 participant