🤖 Auto-filed from milestone doc bullet.
Repo: WasmAgent/open-agent-audit
Milestone: Milestone 2: Audit Core Pipeline
Bullet:
Implement computeRiskScore(events, runId) with configurable risk weights.
Problem
The computeRiskScore(events, runId) function is not yet implemented. This function is needed to calculate a risk score based on audit events, which is a core component of the audit pipeline.
Approach
Implement the computeRiskScore function that:
- Takes
events (array of audit events) and runId (audit run identifier) as parameters
- Calculates a risk score based on configurable risk weights for different event types/severities
- Returns a numeric risk score (likely 0-100 or similar normalized scale)
The function should be implemented in packages/core/src/drift-guard/index.ts, following the existing module patterns. Risk weights should be configurable (likely via a config parameter or environment-based configuration) to allow different weightings for:
- Event severity levels (critical, high, medium, low, info)
- Event types/categories
- Frequency factors
Files expected to change
packages/core/src/drift-guard/index.ts — Add computeRiskScore function implementation
packages/core/src/drift-guard/index.test.ts — Add tests for computeRiskScore function
Acceptance criteria
- Command
bun install --frozen-lockfile && bun run build && bun run test passes
computeRiskScore(events, runId) function is implemented and accepts the specified parameters
- Risk weights are configurable (not hardcoded)
- Tests cover basic functionality including different event scenarios
- No unrelated files touched (git status --short output limited to the intended changes)
Notes for the implementer
This issue was auto-created by SweepMilestoneBulletToIssue. The bullet text is verbatim from the milestone doc. The function should integrate with the existing drift-guard module and follow the codebase's patterns for configuration and error handling.
🤖 Auto-filed from milestone doc bullet.
Repo: WasmAgent/open-agent-audit
Milestone: Milestone 2: Audit Core Pipeline
Bullet:
Problem
The
computeRiskScore(events, runId)function is not yet implemented. This function is needed to calculate a risk score based on audit events, which is a core component of the audit pipeline.Approach
Implement the
computeRiskScorefunction that:events(array of audit events) andrunId(audit run identifier) as parametersThe function should be implemented in
packages/core/src/drift-guard/index.ts, following the existing module patterns. Risk weights should be configurable (likely via a config parameter or environment-based configuration) to allow different weightings for:Files expected to change
packages/core/src/drift-guard/index.ts— AddcomputeRiskScorefunction implementationpackages/core/src/drift-guard/index.test.ts— Add tests forcomputeRiskScorefunctionAcceptance criteria
bun install --frozen-lockfile && bun run build && bun run testpassescomputeRiskScore(events, runId)function is implemented and accepts the specified parametersNotes for the implementer
This issue was auto-created by SweepMilestoneBulletToIssue. The bullet text is verbatim from the milestone doc. The function should integrate with the existing drift-guard module and follow the codebase's patterns for configuration and error handling.