Classify an age-in-minutes reading against fixed freshness thresholds.

data freshness Freshness reports avoid live clocks by using a fixed age signal and deterministic thresholds.

Data Freshness Report

ageMinutes
data_freshness.js
Replay: real traced execution (multi-file project)
const ageMinutes = 18;
const maxAge = 30;
let freshness = "stale";

if (ageMinutes <= 10) {
    freshness = "fresh";
} else if (ageMinutes <= maxAge) {
    freshness = "aging";
}

console.log(`age=${ageMinutes} max=${maxAge} status=${freshness}`);
const ageMinutes = 5;
const maxAge = 30;
let freshness = "stale";

if (ageMinutes <= 10) {
    freshness = "fresh";
} else if (ageMinutes <= maxAge) {
    freshness = "aging";
}

console.log(`age=${ageMinutes} max=${maxAge} status=${freshness}`);
const ageMinutes = 45;
const maxAge = 30;
let freshness = "stale";

if (ageMinutes <= 10) {
    freshness = "fresh";
} else if (ageMinutes <= maxAge) {
    freshness = "aging";
}

console.log(`age=${ageMinutes} max=${maxAge} status=${freshness}`);
  1. ageMinutes ← 18, maxAge ← 30, freshness ← stale

    1const ageMinutes→ 18 = 18;  //@ageMinutes=5, 452const maxAge→ 30 = 30;3let freshness→ stale = "stale";
  2. if (ageMinutes <= maxAge)

    6    freshness = "fresh";7} else if (ageMinutes18 <= maxAge30) {8    freshness = "aging";9}
  3. console.log(`age=${ageMinutes} max=${maxAge} status=${freshness}`);

    8    freshness = "aging";9}1011console.log(`age=${ageMinutes18} max=${maxAge30} status=${freshnessaging}`);
    outputage=18 max=30 status=aging
  1. ageMinutes ← 5, maxAge ← 30, freshness ← stale

    1const ageMinutes→ 5 = 5;2const maxAge→ 30 = 30;3let freshness→ stale = "stale";
  2. if (ageMinutes <= 10)

    2const maxAge = 30;3let freshness = "stale";45if (ageMinutes5 <= 10) {6    freshness = "fresh";7} else if (ageMinutes <= maxAge) {
  3. console.log(`age=${ageMinutes} max=${maxAge} status=${freshness}`);

    8    freshness = "aging";9}1011console.log(`age=${ageMinutes5} max=${maxAge30} status=${freshnessfresh}`);
    outputage=5 max=30 status=fresh
  1. ageMinutes ← 45, maxAge ← 30, freshness ← stale

    1const ageMinutes→ 45 = 45;2const maxAge→ 30 = 30;3let freshness→ stale = "stale";45if (ageMinutes <= 10) {6    freshness = "fresh";7} else if (ageMinutes <= maxAge) {8    freshness = "aging";9}1011console.log(`age=${ageMinutes45} max=${maxAge30} status=${freshnessstale}`);
    outputage=45 max=30 status=stale