Simplify PR dashboard state loading#45
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors state loading in the PR dashboard tooling, replacing the transient in-band _loaded_from_dashboard (and _notification_errors) markers with explicit missing-state handling via None returns. The result is a clearer contract: a targeted single-PR refresh now skips cleanly when there is no accepted cached dashboard state (instead of falling back to a full rebuild), notification processing skips when dashboard state is absent, and Slack notification computation operates on per-PR notification records with delivery errors returned as a separate value.
Changes:
load_state_fileand cache loaders now returnNonefor missing/invalid state, and legacy_-prefixed markers are stripped on load.- Notification helpers are reworked to per-PR records (
load_notifications/save_notifications/union_merge_notifications), andnext_notificationsreturns(notifications, delivery_errors). - Single-PR refreshes skip when no accepted dashboard state exists;
compute_pr_resultsreceivesdashboard_stateas an explicit argument.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/scripts/pull-request-dashboard/state.py |
Return None for missing state, strip legacy markers, add per-PR notification load/save/merge helpers |
.github/scripts/pull-request-dashboard/notify_slack.py |
Skip on missing dashboard state, merge retry snapshot via last_notifications, rename retry-snapshot/error paths |
.github/scripts/pull-request-dashboard/notifications.py |
Rename to next_notifications, return errors separately, gate initial notifications on has_last_notifications |
.github/scripts/pull-request-dashboard/dashboard.py |
Pass dashboard_state into compute_pr_results, skip targeted refresh on cache miss, handle None in reconciliation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Misc refactoring. I split this out of a bigger (to come) PR addressing #40.
Replace transient in-band dashboard and notification state markers with explicit missing-state handling.
Targeted dashboard refreshes now skip cleanly without accepted cached state, notification processing skips without dashboard state, and Slack notification calculations operate on per-PR notification records with delivery errors returned separately.
Also a good bit of renaming to make it clearer what is going on in some places.