Skip to content

Commit c253824

Browse files
mmckyclaude
andauthored
Freshness badge: say "audit ran", document the floored-day thresholds (#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>
1 parent db81f6b commit c253824

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

scripts/render_audit.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,29 +462,32 @@ def render_index(audit: dict) -> str:
462462
<header class="doc">
463463
<p class="eyebrow">QuantEcon · generated data audit · Python lecture family</p>
464464
<h1>Lecture data — audit &amp; migration dashboard</h1>
465-
<p class="meta">Every dataset referenced by lecture source across the 8 synced Python-family repos,
465+
<p class="meta">Every dataset referenced by lecture source across the {len(audit["repos"])} synced Python-family repos,
466466
regenerated from each repo's <code>main</code> by
467467
<a href="{DL}/blob/main/scripts/build_audit.py">a script</a> — not maintained by hand.
468468
Companion to the migration of lecture data into
469469
<a href="{DL}">QuantEcon/data-lectures</a>.</p>
470470
<span id="freshness" class="freshness" data-generated="{esc(audit["generated"])}"
471-
title="Rebuilt on every change to data-lectures and weekly on schedulea badge older than a week means the scheduled rebuild has stopped.">
472-
generated {esc(audit["generated"])}</span>
471+
title="Every build re-runs the full audit scan across the {len(audit["repos"])} lecture repos — this date IS the last audit run. It runs on every change to data-lectures, weekly on schedule, and on demand; a badge older than a week means the scheduled run has stopped succeeding.">
472+
audit ran {esc(audit["generated"])}</span>
473473
<script>
474474
(function () {{
475475
var el = document.getElementById('freshness');
476476
var gen = new Date(el.dataset.generated + 'T00:00:00Z');
477+
// Full calendar days since the (date-only, midnight-UTC) run stamp —
478+
// deliberately floored. Raw-ms thresholds would flip the badge orange
479+
// every Monday between 00:00 UTC and the 05:17 cron completing.
477480
var days = Math.floor((Date.now() - gen.getTime()) / 86400000);
478481
if (isNaN(days)) return;
479482
var age = days <= 0 ? 'today' : days === 1 ? 'yesterday' : days + ' days ago';
480483
if (days > 14) {{
481484
el.classList.add('crit');
482-
el.textContent = '✗ stale — last updated ' + age + ' (' + el.dataset.generated + '); the scheduled rebuild has stopped';
485+
el.textContent = '✗ audit stale — last ran ' + age + ' (' + el.dataset.generated + '); scheduled runs have stopped succeeding';
483486
}} else if (days > 7) {{
484487
el.classList.add('warn');
485-
el.textContent = '⚠ last updated ' + age + ' (' + el.dataset.generated + ') — the weekly rebuild is overdue';
488+
el.textContent = '⚠ audit last ran ' + age + ' (' + el.dataset.generated + ') — the weekly run is overdue';
486489
}} else {{
487-
el.textContent = '● up to date — last updated ' + age + ' (' + el.dataset.generated + ')';
490+
el.textContent = '● audit up to date — last ran ' + age + ' (' + el.dataset.generated + ')';
488491
}}
489492
}})();
490493
</script>
@@ -1104,7 +1107,7 @@ def render_audit_page(audit: dict) -> str:
11041107
<header class="doc">
11051108
<p class="eyebrow">Full audit · regenerated from each repo's <code>main</code></p>
11061109
<h1>Dataset registry — Python lecture family</h1>
1107-
<p class="meta">Every dataset referenced by lecture source across the 8 synced repos.
1110+
<p class="meta">Every dataset referenced by lecture source across the {len(audit["repos"])} synced repos.
11081111
The successor to the hand-built {PREV_SNAPSHOT} audit — same taxonomy, now generated.</p>
11091112
</header>
11101113
<div class="stats">

0 commit comments

Comments
 (0)