Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion scenarios/cbor-decoding/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,30 @@ def prepare(_scenario, entries):
}
datasets = {commit for change in dataset_changes.values() for commit in [change["latest"], *change["by_commit"].values()] if commit}
ledger_commits = {dataset: ledger_commit(dataset) for dataset in sorted(datasets)}
return {"ledger_commits": ledger_commits, "dataset_changes": dataset_changes}, entries, None
return {"ledger_commits": ledger_commits, "dataset_changes": dataset_changes}, entries, dataset_changes


def is_outdated(report, dataset_changes):
"""Whether a report was made with an older dataset than the latest one of its era. Mirrors the pill of the scenario
page: a report that names no dataset is outdated, and nothing is outdated when the dataset changes are unknown."""
if not (report and report.get("protocol_version")):
return False
try:
changes = dataset_changes.get(build_common.era_of_protocol(report["protocol_version"]))
except ValueError:
return False
if not changes or not changes["latest"]:
return False
if not report.get("dataset_commit"):
return True
own = changes["by_commit"].get(report["dataset_commit"])
return bool(own) and own != changes["latest"]


def outdated(entry, dataset_changes):
"""Whether any report of a node, in any era, is outdated."""
reports = [entry["report"], *(result["report"] for result in entry.get("eras", {}).values())]
return any(is_outdated(report, dataset_changes) for report in reports)


def score(report, _context, _node_id=None):
Expand Down
1 change: 1 addition & 0 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def build_node_catalog(nodes, scenarios, builders, scenario_entries, scenario_co
"passed": passed,
"total": total,
"configured": report is not None,
"outdated": builder.outdated(entry, scenario_contexts[scenario_id]) if hasattr(builder, "outdated") else False,
})
cards.append({
"id": node["id"],
Expand Down
2 changes: 2 additions & 0 deletions shared/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ h2 { font-size: var(--text-lg); }
.card-score { margin-top: var(--space-md); }
.freshness { position: relative; padding: 0.1rem 0.55rem; border: var(--border-sm) solid currentColor; border-radius: 999px; font: 600 var(--text-xs) var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; cursor: help; }
.freshness:focus-visible { outline: var(--border-md) solid currentColor; outline-offset: 2px; }
.score-with-pill { display: inline-flex; align-items: center; gap: var(--space-sm); }
.outdated-pill { padding: 0 0.4rem; border: var(--border-sm) solid currentColor; border-radius: 999px; color: var(--color-warning); font: 600 0.6rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; cursor: help; }
.freshness.latest { color: var(--color-success); }
.freshness.outdated { color: var(--color-warning); }
.freshness-tip { position: absolute; top: calc(100% + 0.5rem); right: 0; z-index: 10; width: 14rem; padding: var(--space-sm) var(--space-md); border: var(--border-sm) solid currentColor; background: var(--color-surface-hover); box-shadow: var(--outline-md) var(--outline-md) var(--color-outline); color: var(--color-text); font: 400 var(--text-xs) / 1.5 var(--font-sans); letter-spacing: 0; text-transform: none; visibility: hidden; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
Expand Down
9 changes: 6 additions & 3 deletions shared/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ function renderNodes(nodes) {
repository ? `<a href="${esc(repository)}" target="_blank" rel="noopener">Source code</a>` : '',
].filter(Boolean).join('');
const score = node.conformance || {};
const scenarioScores = (node.scenario_scores || []).map((scenario) =>
`<div class="key-value"><span>${esc(scenario.title)}</span><strong>${scenario.percentage === null ? '-' : `${scenario.percentage}%`}</strong></div>`
).join('');
const scenarioScores = (node.scenario_scores || []).map((scenario) => {
const pill = scenario.outdated
? '<span class="outdated-pill" title="At least one report was made with an older version of the dataset">Outdated</span>'
: '';
return `<div class="key-value"><span>${esc(scenario.title)}</span><span class="score-with-pill">${pill}<strong>${scenario.percentage === null ? '-' : `${scenario.percentage}%`}</strong></span></div>`;
}).join('');
return `<article class="panel node-card">
<img class="node-logo" src="${esc(node.logo)}" alt="${esc(node.name)} logo">
<div class="node-card-body">
Expand Down
Loading