feat: add historical scoring with history and trend-chart commands#46
Conversation
Track repo scores over time and show trends. Adds: - Store.get_history() method with repo/days filtering - `arbiter history` command (plain, --json, --markdown output) - `arbiter trend-chart` command (ASCII sparkline per repo) - Delta calculation showing score changes between snapshots - 16 tests covering all paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8bc711d21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "timestamp >= datetime('now', ?)" | ||
| ) | ||
| params.append(f"-{days} days") |
There was a problem hiding this comment.
Normalize timestamp before applying --days cutoff
repo_snapshots.timestamp is written as YYYY-MM-DDTHH:MM:SSZ, but this filter compares it directly against datetime('now', ?) (YYYY-MM-DD HH:MM:SS). In SQLite this becomes a lexical TEXT comparison, so rows earlier on the cutoff day can still pass (because 'T' > ' '). As a result, history --days N and trend-chart --days N can include snapshots older than N days, skewing deltas and trends.
Useful? React with 👍 / 👎.
| ORDER BY timestamp ASC | ||
| LIMIT ?""", |
There was a problem hiding this comment.
Return latest snapshots when history is capped
This query sorts ascending and then applies LIMIT ?, so with the default limit=500 it returns the oldest 500 snapshots, not the most recent ones. Since cmd_history and cmd_trend_chart call get_history() without overriding limit, those commands will silently show stale data once a repo has more than 500 snapshots.
Useful? React with 👍 / 👎.
Summary
Store.get_history()method with optional repo name and days filtering for detailed snapshot queriesarbiter historycommand with plain text,--json, and--markdownoutput formats showing date, repo, score, grade, and delta from previous snapshotarbiter trend-chartcommand showing ASCII sparkline bars per repo with first/latest score and deltaTest plan
tests/test_history.pyall passarbiter history --helpandarbiter trend-chart --helpwork🤖 Generated with Claude Code