Repository navigation
feat: counterparty risk, compliance snapshots, notification ownership, freeze windows - #296
Merged
BigDella merged 5 commits intoOct 19, 2026
Conversation
… alerts Resolves Parcel-Protocol#177 Also registers the notification audit actions in SENSITIVE_ACTIONS. Without them recordAudit silently dropped mandatory override and preference events.
|
@fortezzalaboratory 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! 🚀 |
|
This October PR is currently conflicting/dirty against the base branch and was not merged. Please update the branch, resolve conflicts, rerun CI, and request a fresh review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds four policy and audit modules for Utix: counterparty risk scoring, immutable compliance snapshots, notification preference ownership with mandatory-alert auditing, and operational freeze windows with an audited emergency bypass.
Issues Resolved
Closes #175
Closes #176
Closes #177
Closes #178
Changes
#175 - Add counterparty risk scoring and visibility controls
core/policy/counterparty-risk.tsfeeds profile signals (account age, disputes, fraud flag, bulk transfers) through the existingassessRiskengine, so the score is reproducible from documented inputs. States arelow,medium,high,unknown, with a maintainer override that replaces the state while keeping the score for review.toPublicRiskSummaryreturns only id and state, so thresholds and signals never reach non-maintainers.#176 - Create immutable compliance snapshot for critical lifecycle events
core/audit/compliance-snapshot.tsstores canonical (sorted-key) JSON with a schema version and a SHA-256 integrity hash.ComplianceSnapshotStore.captureis idempotent per event id, andreadis restricted to the maintainer scope and verifies the hash before returning.CRITICAL_SNAPSHOT_EVENTSdeclares which audit actions require a snapshot.#177 - Implement participant notification preferences with mandatory alert overrides
Preference edits now require the recipient as the actor. Other edits are audited as denied and throw. Mandatory alerts already bypassed opt-out in
publish. This change also adds the notification audit actions toSENSITIVE_ACTIONS, becauserecordAuditsilently rejected unknown actions, so mandatory overrides were not actually being recorded.#178 - Add operational freeze window for risky maintenance actions
core/policy/freeze-window.tsvalidates windows (known action scopes,startsAt < endsAt), blocks listed actions while active (end instant is exclusive), and allows an emergency bypass only for the exact window id with a named approver and justification. Every bypass and refused bypass is audited (freeze.bypassed,freeze.bypass_denied).Assumptions
counterparty-risk.ts.updatePreferencesandresetPreferencestake an optionalactorargument that defaults to the recipient, so existing callers keep working.How to Test
npm run test -- core/policy core/audit core/notificationscounterparty-risk.test.ts,freeze-window.test.ts,compliance-snapshot.test.tsandmandatory-preferences.test.tspass.Follow-Up
docs/.