Skip to content

Commit e19a410

Browse files
mmckyclaude
andauthored
Tracker: list migrated files under the series they came from (#23)
* Tracker: list migrated files under the series they came from In the per-series manifest, migrated datasets were grouped under a separate data-lectures section, which hid exactly what the table is for: each series' progress (a series could never show green). Migrated files now stay listed in the series they came from — green-highlighted rows sorted to the bottom of each group — with "was: <prior hosting>" on each row. A file consumed by two series (the pandas_panel trio) appears in both groups, marked shared; the tiles still count distinct files. The per-series meters now show real progress: programming 3 of 4 migrated, python.myst 3 of 9, intro 1 of 20. Part of #20. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Address Copilot review: pending reads as queued; tighten shared wording - dataset_status() normalizes a lifecycle `pending` record to the reader-facing `queued` status (with its wave label), so the internal term never reaches the series table, and it sorts with the queued band rather than the unscheduled one (STATUS_RANK covers it as belt and braces). Regression-tested with a synthetic pending record: renders as "queued · wave PX". - series_manifest() docstring and the table lede now say a MIGRATED file consumed by two series appears in both groups — before migration a file has one home, the repo owning the bytes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent ca66447 commit e19a410

1 file changed

Lines changed: 56 additions & 15 deletions

File tree

scripts/render_audit.py

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
.meter .seg.a { background: var(--meter-a); }
207207
.meter .seg.b { background: var(--meter-b); }
208208
.meter.mini { height: 8px; max-width: 340px; margin: 6px 0 2px; border-radius: 4px; }
209+
tr.row-migrated td { background: var(--ok-bg); }
209210
/* bar list — one measure, single hue, labeled rows */
210211
.barlist { display: grid; grid-template-columns: max-content 1fr max-content; gap: 6px 12px; align-items: center; margin: 14px 0; }
211212
.barlist .lbl { font-size: 13px; }
@@ -487,29 +488,53 @@ def render_index(audit: dict) -> str:
487488

488489

489490
def dataset_status(fname: str, migration: dict) -> tuple[str, str]:
490-
"""→ (status, pilot) for any static dataset the audit sees."""
491+
"""→ (status, pilot) for any static dataset the audit sees. A record still
492+
at lifecycle `pending` reads as `queued` — same reader-facing meaning as a
493+
file named in a pending wave."""
491494
rec = (migration.get("datasets") or {}).get(fname)
492495
if rec:
493-
return rec.get("status", "pending"), rec.get("pilot", "")
496+
status = rec.get("status", "pending")
497+
return ("queued" if status == "pending" else status), rec.get("pilot", "")
494498
for wave in migration.get("pending") or []:
495499
if fname in (wave.get("datasets") or []):
496500
return "queued", wave.get("pilot", "")
497501
return "unscheduled", ""
498502

499503

504+
STATUS_RANK = {"unscheduled": 0, "pending": 1, "queued": 1, "landed": 2,
505+
"repointed": 3, "final": 3}
506+
507+
500508
def series_manifest(audit: dict) -> str:
501-
"""Every static dataset, grouped by the lecture series that owns the bytes
502-
today, with its migration status — the how-far-along view."""
509+
"""Every static dataset with its migration status, grouped by the lecture
510+
series it belongs to — migrated files stay in the series they came FROM
511+
(green rows at the bottom of each group), so each group reads as that
512+
series' progress. A MIGRATED file consumed by two series appears in both
513+
groups; before migration a file has one home — the repo owning the bytes."""
503514
migration = audit["migration"] or {}
515+
manifests = audit["manifests"]
504516
groups: dict[str, list] = {}
517+
shared: dict[str, list] = {}
505518
for d in audit["datasets"]:
506-
groups.setdefault(repo_of_record(d), []).append(d)
519+
home = repo_of_record(d)
520+
if home == "data-lectures":
521+
# migrated — list it where it was: under each series whose
522+
# lectures consume it (the manifest's consumers)
523+
homes = sorted({c["repo"].split("/")[-1]
524+
for c in manifests.get(d["file"], {}).get("consumers", [])}) \
525+
or [d["refs"][0]["repo"]]
526+
shared[d["file"]] = homes
527+
for h in homes:
528+
groups.setdefault(h, []).append(d)
529+
else:
530+
groups.setdefault(home, []).append(d)
507531
order = ["lecture-python-intro", "lecture-python-programming",
508-
"lecture-python.myst", "lecture-python-advanced.myst",
509-
"data-lectures"]
532+
"lecture-python.myst", "lecture-python-advanced.myst"]
510533
rows = ""
511534
for repo in [r for r in order if r in groups] + sorted(set(groups) - set(order)):
512-
ds = sorted(groups[repo], key=lambda x: x["file"])
535+
ds = sorted(groups[repo],
536+
key=lambda x: (STATUS_RANK.get(
537+
dataset_status(x["file"], migration)[0], 0), x["file"]))
513538
statuses = [dataset_status(d["file"], migration)[0] for d in ds]
514539
n = len(ds)
515540
n_done = sum(1 for s in statuses if s in ("repointed", "final"))
@@ -529,25 +554,41 @@ def series_manifest(audit: dict) -> str:
529554
rows += (f'<tr class="group"><td colspan="4">{esc(repo)} — '
530555
f'{n} file{"s" if n != 1 else ""} · '
531556
f'{esc(" · ".join(c for c in counts if c))}'
532-
f'<div class="meter mini" role="img" aria-label="{n_done} of {n} repointed">{segs}</div>'
557+
f'<div class="meter mini" role="img" aria-label="{n_done} of {n} migrated">{segs}</div>'
533558
f'</td></tr>')
534559
for d, status_pilot in zip(ds, (dataset_status(d["file"], migration) for d in ds)):
535560
status, pilot = status_pilot
536561
css, label = STATUS_META.get(status, ("p-embed", status))
537562
if pilot and status == "queued":
538563
label += f" · wave {pilot}"
564+
migrated = status in ("repointed", "final")
539565
pills = " ".join(pattern_pill(p) for p in d["patterns"])
540-
rows += (f'<tr><td class="mono">{esc(d["file"])}</td>'
566+
if migrated:
567+
rec = (migration.get("datasets") or {}).get(d["file"]) or {}
568+
prior = rec.get("prior_pattern")
569+
if prior:
570+
_, plabel, _ = PATTERN_META.get(prior, ("", prior, ""))
571+
pills += f'<div class="note">was: {esc(plabel)}</div>'
572+
others = [h.replace("lecture-", "") for h in shared.get(d["file"], [])
573+
if h != repo]
574+
if others:
575+
pills += (f'<div class="note">shared — also listed under '
576+
f'{esc(", ".join(others))}</div>')
577+
rows += (f'<tr{" class=\"row-migrated\"" if migrated else ""}>'
578+
f'<td class="mono">{esc(d["file"])}</td>'
541579
f'<td class="note">{esc(d["description"])}</td>'
542580
f'<td>{pills}</td>'
543581
f'<td><span class="pill {css}">{esc(label)}</span></td></tr>')
544582
return f"""
545583
<h2>All datasets by series</h2>
546-
<p class="lede">Every static file the lectures read today, grouped by the series that owns the
547-
bytes, with its migration status — the how-far-along view. <em>Not scheduled</em> means no
548-
milestone has claimed the file yet; the broad sweep (see the milestones below) eventually
549-
covers them all. Data written by the lectures themselves and live-API reads are not migration
550-
targets and are tracked on the <a href="audit.html">audit page</a>.</p>
584+
<p class="lede">Every static file the lectures read, grouped by the lecture series it belongs
585+
to. Migrated files stay listed in the series they came from — the green rows at the bottom of
586+
each group — so each group reads as that series' progress. A migrated file consumed by two
587+
series appears in both groups (marked <em>shared</em>); the tiles above count distinct files.
588+
<em>Not scheduled</em> means no milestone has claimed the file yet; the broad sweep (see the
589+
milestones below) eventually covers them all. Data written by the lectures themselves and
590+
live-API reads are not migration targets and are tracked on the
591+
<a href="audit.html">audit page</a>.</p>
551592
<div class="tablewrap"><table>
552593
<tr><th>File</th><th>Contents</th><th>Hosting today</th><th>Status</th></tr>
553594
{rows}

0 commit comments

Comments
 (0)