Package com.tnsai.accountability
Class InMemoryReputationLedger
java.lang.Object
com.tnsai.accountability.InMemoryReputationLedger
- All Implemented Interfaces:
ReputationLedger
Default
ReputationLedger (TNS-298) — derives scores directly
from a backing LiabilitySink on every query. Suitable for
fleets with manageable record volume; production deployments with
millions of records should swap in a cached / incrementally-aggregated
ledger.
Scoring policy
Each record contributes either a "pass" or a "miss":- Pass — outcome is non-error AND the action is permitted by its declared scope (allowed action type + permitted target).
- Miss — anything else: error outcome, scope-violating action.
LiabilityClass.NONE/LiabilityClass.LOW— weight 1LiabilityClass.MEDIUM— weight 3LiabilityClass.HIGH— weight 9LiabilityClass.REGULATORY— weight 27
1.0 - (weighted_misses / weighted_total), clamped
to [0.0, 1.0]. Custom ledgers can swap policies without
touching this default.- Since:
- 0.10.0 (TNS-298)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRecords that contributed toReputationLedger.scoreOf(java.lang.String), scoped to the trailingwindow.Aggregate reputation foragentId.
-
Constructor Details
-
InMemoryReputationLedger
-
-
Method Details
-
scoreOf
Description copied from interface:ReputationLedgerAggregate reputation foragentId. ReturnsReputationScore.unknown(java.lang.String, java.time.Instant)for agents the ledger has no records on (innocent-until-proven default).- Specified by:
scoreOfin interfaceReputationLedger
-
historyOf
Description copied from interface:ReputationLedgerRecords that contributed toReputationLedger.scoreOf(java.lang.String), scoped to the trailingwindow. Useful for "show me what dropped this agent's score in the last hour" operator queries; auditors typically prefer the underlyingLiabilitySink.query(com.tnsai.accountability.AuditQuery)directly for unbounded ranges.- Specified by:
historyOfin interfaceReputationLedger
-