Skip to content

Overview: freshness badge — orange past a week, red past two#24

Merged
mmcky merged 1 commit into
mainfrom
dashboard/freshness-indicator
Jul 17, 2026
Merged

Overview: freshness badge — orange past a week, red past two#24
mmcky merged 1 commit into
mainfrom
dashboard/freshness-indicator

Conversation

@mmcky

@mmcky mmcky commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #23, from Matt's review of the live dashboard.

The overview page now shows an up-to-dateness badge under the header. The generated date is baked into the static page, but the age is computed in the viewer's browser at view time — a color baked in at build time would itself go stale, defeating the purpose.

Age Badge
≤ 7 days green — ● up to date — last updated today (2026-07-17)
> 7 days orange — ⚠ last updated 10 days ago (2026-07-07) — the weekly rebuild is overdue
> 14 days red — ✗ stale — last updated 20 days ago (2026-06-27); the scheduled rebuild has stopped

Since the site rebuilds on every push and weekly on schedule, a badge that has turned orange or red is an operational signal that the Actions workflow has quietly stopped — the exact silent-rot failure mode the dashboard exists to prevent. Every state carries an icon and words, never color alone; with JavaScript disabled the badge degrades to the plain generated date.

All three states verified by rendering the page with backdated generated values (screenshots reviewed in both the build and this PR's development).

🤖 Generated with Claude Code

The front page now carries a last-updated badge under the header. The
generated date is baked into the page, but the AGE is computed in the
viewer's browser at view time — a baked-in color would itself go stale.
Within 7 days it reads green ("up to date — last updated N days ago");
past 7 days it turns orange ("the weekly rebuild is overdue"); past 14,
red ("the scheduled rebuild has stopped"). With the weekly cron in
place, orange/red are an ops signal that CI has quietly failed, which
is exactly the dashboard's failure mode to guard against. Icon + words
on every state, never color alone.

Part of #20.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 03:56
@mmcky
mmcky merged commit db81f6b into main Jul 17, 2026
4 checks passed

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.

Pull request overview

Adds a client-computed “freshness” badge to the audit dashboard overview header so viewers can immediately see whether the static site content is up to date (green), overdue (orange), or stale (red) based on the baked-in generated date.

Changes:

  • Introduces .freshness styling plus warn/critical variants.
  • Renders a new header badge with data-generated=... and an inline JS snippet to compute age and set text/state at view time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/render_audit.py
Comment on lines +476 to +488
var gen = new Date(el.dataset.generated + 'T00:00:00Z');
var days = Math.floor((Date.now() - gen.getTime()) / 86400000);
if (isNaN(days)) return;
var age = days <= 0 ? 'today' : days === 1 ? 'yesterday' : days + ' days ago';
if (days > 14) {{
el.classList.add('crit');
el.textContent = '✗ stale — last updated ' + age + ' (' + el.dataset.generated + '); the scheduled rebuild has stopped';
}} else if (days > 7) {{
el.classList.add('warn');
el.textContent = '⚠ last updated ' + age + ' (' + el.dataset.generated + ') — the weekly rebuild is overdue';
}} else {{
el.textContent = '● up to date — last updated ' + age + ' (' + el.dataset.generated + ')';
}}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in follow-up PR #25 — as a documented push-back rather than the suggested change. The run stamp is date-only (midnight UTC) and the weekly cron fires Mondays at 05:17 UTC, so comparing raw milliseconds against the 7-day threshold would flip the badge orange every Monday between 00:00 and the cron completing — a built-in weekly false alarm. Flooring to full calendar days is deliberate: orange means a full scheduled run has been missed, which is the signal the badge exists to give. The reasoning is now a code comment beside the calculation so it survives future reviews.

mmcky added a commit that referenced this pull request Jul 17, 2026
…#25)

* Freshness badge: say "audit ran", document the floored-day thresholds

Every build re-runs the full scan, so the badge date IS the last audit
run — the wording now says so ("audit ran / audit up to date — last ran
…"), answering the natural reader question of whether the audit itself
is automated (it is: weekly cron + on push + on dispatch).

Also documents why the age thresholds floor to full calendar days
rather than comparing raw milliseconds (Copilot's suggestion on #24):
the run stamp is date-only at midnight UTC and the cron fires Mondays
05:17 UTC, so raw-ms "> 7 days" would flip the badge orange every
Monday between 00:00 and the cron completing — a weekly false alarm.
Floored days means orange = a full scheduled run has been missed.

Follow-up to #24.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Derive the repo count in page copy from the audit payload

The freshness tooltip and both page ledes hard-coded "8" repos; the
count now comes from audit["repos"], so a manifest change to the
scanned set cannot silently falsify the copy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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