Skip to content

fix(listing-audit): stop crediting over-called severity as accurate#65

Merged
projectamazonph merged 1 commit into
mainfrom
fix/listing-audit-severity-overcalling
Jul 20, 2026
Merged

fix(listing-audit): stop crediting over-called severity as accurate#65
projectamazonph merged 1 commit into
mainfrom
fix/listing-audit-severity-overcalling

Conversation

@projectamazonph

@projectamazonph projectamazonph commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Closes #51.

Summary

  • findingsAccuracy() used severityAtLeast(), which counted a student marking a warning issue as critical as a true positive — over-calling severity is a real skill deficiency in Amazon PPC work, not accuracy.
  • severityCalibration() (the sibling criterion) already does exact-match scoring correctly; findingsAccuracy() now does too, so the two dimensions are properly orthogonal (per the issue's suggested fix).
  • Removed severityAtLeast() — dead code once findingsAccuracy() no longer uses it.
  • Added engine.test.ts (didn't exist before) with a regression test for both over- and under-calling.

Test plan

  • pnpm typecheck clean
  • pnpm lint clean
  • pnpm test — 286/286 passing (was 283 before the 3 new tests)

Summary by CodeRabbit

  • Bug Fixes

    • Listing audit scoring now requires findings to match the reference severity exactly.
    • Correctly awards partial credit when a finding overstates or understates severity.
  • Tests

    • Added coverage for exact, higher, and lower severity matches to help ensure consistent scoring behavior.

)

findingsAccuracy() used severityAtLeast(), which counted a student
marking a "warning" issue as "critical" as a true positive. In Amazon
PPC work, over-calling severity wastes client time and is a real skill
deficiency, not accuracy — severityCalibration() already scores exact
matches correctly, so accuracy should too. Removed severityAtLeast()
(now unused) and added a regression test.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Ck2wurvqhL2r3cCAzmuhU
Copilot AI review requested due to automatic review settings July 20, 2026 04:28

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.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Listing audit accuracy now requires exact severity matches instead of accepting higher-ranked severities. New tests cover exact, over-called, and under-called severity scoring.

Changes

Listing Audit Accuracy

Layer / File(s) Summary
Exact severity matching
src/engine/listing-audit/engine.ts
findingsAccuracy counts true positives only for equal student and reference severities and removes severityAtLeast.
Severity accuracy regression tests
src/engine/listing-audit/engine.test.ts
Adds grading scenarios and assertions for exact, over-called, and under-called severity results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fix: stopping over-called severity from counting as accurate.
Linked Issues check ✅ Passed The PR implements exact severity matching for findingsAccuracy and removes severityAtLeast, matching issue #51.
Out of Scope Changes check ✅ Passed The changes stay focused on listing-audit severity scoring and regression tests, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/listing-audit-severity-overcalling

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/engine/listing-audit/engine.ts`:
- Around line 90-91: Replace the em dash in the comment near the exact severity
match logic in src/engine/listing-audit/engine.ts lines 90-91 with a comma or
period. Also replace the em dash in src/engine/listing-audit/engine.test.ts line
53 with a comma or period; no other changes are needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 736171ac-e4e3-4389-a688-2227bf61ce7f

📥 Commits

Reviewing files that changed from the base of the PR and between 78f1931 and 2475ff1.

📒 Files selected for processing (2)
  • src/engine/listing-audit/engine.test.ts
  • src/engine/listing-audit/engine.ts

Comment on lines +90 to +91
// Exact severity match only — over-calling severity (e.g. warning as
// critical) is a real skill deficiency in Amazon PPC work, not accuracy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove em dashes from the changed comments.

  • src/engine/listing-audit/engine.ts#L90-L91: replace the em dash with a comma or period.
  • src/engine/listing-audit/engine.test.ts#L53-L53: replace the em dash with a comma or period.

As per coding guidelines, TypeScript code must not use em dashes.

📍 Affects 2 files
  • src/engine/listing-audit/engine.ts#L90-L91 (this comment)
  • src/engine/listing-audit/engine.test.ts#L53-L53
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/engine/listing-audit/engine.ts` around lines 90 - 91, Replace the em dash
in the comment near the exact severity match logic in
src/engine/listing-audit/engine.ts lines 90-91 with a comma or period. Also
replace the em dash in src/engine/listing-audit/engine.test.ts line 53 with a
comma or period; no other changes are needed.

Source: Coding guidelines

@projectamazonph
projectamazonph merged commit d23c9be into main Jul 20, 2026
5 checks passed
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.

Listing audit: severityAtLeast grants credit for over-calling severity

2 participants