Skip to content

fix(core): score empty traces as incomplete#22

Open
JSap0914 wants to merge 1 commit into
WasmAgent:mainfrom
JSap0914:codex/empty-trace-completeness-19
Open

fix(core): score empty traces as incomplete#22
JSap0914 wants to merge 1 commit into
WasmAgent:mainfrom
JSap0914:codex/empty-trace-completeness-19

Conversation

@JSap0914

@JSap0914 JSap0914 commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes #19.

computeTraceCompleteness() treated an empty event array as fully complete by returning 100. That made an empty or failed trace look partially audited instead of marking trace completeness as missing.

This changes the empty-trace branch to return 0 and adds a regression test through computeRiskScore().

Verification

  • RED before fix: bun test packages/core/src/scoring/index.test.ts -t "returns zero trace completeness" failed with Expected: 0, Received: 100.
  • GREEN after fix: bun test packages/core/src/scoring/index.test.ts -> 16 pass.
  • Manual API proof: bun -e "import { computeRiskScore } from './packages/core/src/scoring/index.ts'; const score = await computeRiskScore([], 'empty-run'); console.log(JSON.stringify({run_id: score.run_id, trace_completeness: score.components.trace_completeness, evidence_admission_score: score.evidence_admission_score.score}));" -> {"run_id":"empty-run","trace_completeness":0,"evidence_admission_score":50}.
  • git diff --check passed.

Notes

I also ran broader local checks after building packages/schema:

  • bun run --cwd packages/core test still has two unrelated failures in policy-audit and report tests.
  • bun run --cwd packages/core typecheck still fails on pre-existing bun:test type resolution and unrelated implicit-any diagnostics.
  • bun run lint reports existing repository-wide Biome formatting/lint drift.

Copilot AI review requested due to automatic review settings July 5, 2026 02:32
@JSap0914 JSap0914 requested a review from telleroutlook as a code owner July 5, 2026 02:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

bug(scoring): computeTraceCompleteness returns 100 for empty event array, inflating EAS on failed/empty runs

2 participants