Skip to content

refactor: move scoring into top-level score package (run, aggregate, viz) - #246

Merged
luca-belli merged 2 commits into
mainfrom
refactor/top-level-score-package
Oct 9, 2026
Merged

luca-belli merged 2 commits into
mainfrom
refactor/top-level-score-package

Conversation

@luca-belli

@luca-belli luca-belli commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Moves scoring out of judge/ into a top-level score/ package, as adopted in docs/ARCHITECTURE-SPINE.md, using the module-naming convention from #248. No behavior change.

Before After
judge/score.py → run_scoring score/run.py, re-exported: from score import run_scoring
judge/score.py → score_results, score_results_by_risk, print_scores, … score/aggregate.py
judge/score_viz.py score/viz.py
tests/unit/judge/test_score.py tests/unit/score/test_aggregate.py
  • _scores_output_dir / _save_results_json become public (scores_output_dir, save_results_json), because score/run.py and scripts/pool_vera_scores.py use them across modules.
  • Fixed the 3 pyright errors in score/; uv run pyright score now reports 0 errors.
  • tests/integration/test_scoring.py (live only) ran python -m judge.score, which has had no CLI since chore: move the legacy scripts into legacy/ (v2.0.2) #243. It now runs python -m legacy.score.
  • Docs: AGENTS.md, docs/architecture.md, docs/ARCHITECTURE-SPINE.md, TODO, .claude/commands/*, CHANGELOG "Breaking / migration" entry.

Behavior unchanged

I compared each of the 18 top-level functions and constants in the old score.py with their counterparts in run.py/aggregate.py, after parsing the code so formatting doesn't count. The only differences are the two helper renames, df[mask] → df.loc[mask] (same rows; gives pyright a DataFrame type), and tight_layout(rect=[…]) → rect=(…) (same values). test_score_parity.py, which checks that vera score and the legacy script produce the same scores on a checked-in sample evaluation, passes.

Follow-up (not in this PR)

score/ still imports judge.score_utils, judge.constants, and judge.utils, so the spine's rule that judge/ and score/ never import each other isn't met yet. That split, and the import-linter contract, belong to the scoring-split work in the upcoming roadmap PR.

Test plan

  • uv run pytest -m "not live" (1181 passed)
  • uv run ruff check ., ruff format --check ., uv run pyright score
  • uv run python vera.py score --help, uv run python -m legacy.score --help
  • Live tests/integration/test_scoring.py not run (needs API keys)

🤖 Generated with Claude Code

docs/ARCHITECTURE-SPINE.md adopts score/ as a top-level package owning
aggregation and visualization. Move judge/score.py and judge/score_viz.py
there, update callers, patch targets, and docs. Point the live scoring
test at legacy.score, since judge.score lost its CLI in #243.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luca-belli
luca-belli requested a review from a team as a code owner October 8, 2026 19:54
Avoid repeating the package name (score.score, score_viz). run.py holds
the run_scoring entry point, re-exported from score/__init__; aggregate.py
holds score computation; viz.py the charts. Make scores_output_dir and
save_results_json public, since run.py and the pool script use them.
Fix the three pyright errors in score/, which is now clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luca-belli luca-belli changed the title refactor: move scoring into top-level score package refactor: move scoring into top-level score package (run, aggregate, viz) Oct 8, 2026

@jgieringer jgieringer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

love it, especially things like score.viz

@luca-belli
luca-belli merged commit 2999ebf into main Oct 9, 2026
3 checks passed
@luca-belli
luca-belli deleted the refactor/top-level-score-package branch October 9, 2026 18:23
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.

2 participants