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
4 changes: 2 additions & 2 deletions atlas/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Input row fields: legacy data from a scout census on 2026-10-15 (NOT evidence
A published card is marked closed in one of two ways, and the card says which. A single failed page load is never proof of closure, and a blocked or JavaScript-only page (401/403/429/503, Cloudflare challenge) counts as reachable.

1. **Human review** (this protocol, step 6): an official shutdown/sunset statement, or at least two independent signals (e.g. the domain fails by two methods AND no activity anywhere for 90+ days). Cards closed this way are never reopened automatically: a re-registered or parked domain can answer HTTP 200 too. Reopening needs a new check.
2. **Automated weekly check** (`atlas/refresh.py`): each week the primary URL is fetched with several attempts plus alternate URLs (http/https, www). A failed check counts as a new week only when at least 7 days have passed since the previous counted failed check (`last_counted_at` in `refresh-state.json`), so a manual run, a retry or a second run in the same week never adds a week; an older entry without that field uses its `first_failed_at` when it has exactly one failed week; when the previous count time is unknown the check does not count and `interval_baseline_at` marks where the 7 days start. The first failed week only marks the entry as suspected in `atlas/data/refresh-state.json`; nothing is published. A second consecutive failed week marks the card closed (`include_closed_history`) with a `site_reachable` claim (`direct_observation`, outcome `contradicted`) and a `status_history` record `by: atlas/refresh.py`. The card then shows "Closed by automated check since <date>". If the site answers again in a later weekly check, the card reopens automatically (back to live, with a new claim and history record). The checker validates every redirect and connects to the exact DNS addresses it validated, without using system proxies; private, local, cloud-internal and special platform addresses are refused and count as failed attempts. JSON reads are capped at 1 MB per response and 25 MB per aggregate source read; aggregate processing is capped at 100,000 rows and 50 pages. Pagination offsets must be decimal values of at most 12 digits.
2. **Automated weekly check** (`atlas/refresh.py`): each week the primary URL is fetched with several attempts plus alternate URLs (http/https, www). A failed check counts as a new week only when at least 7 days have passed since the previous counted failed check (`last_counted_at` in `refresh-state.json`), so a manual run, a retry or a second run in the same week never adds a week; an older entry without that field uses its `first_failed_at` when it has exactly one failed week; when the previous count time is unknown the check does not count and `interval_baseline_at` marks where the 7 days start. The weekly report lists entries that hold 2 or more failed weeks and were neither counted nor closed in that run in their own table ("Failed weeks on record (2 or more)"), separate from first-week suspects; it shows the recorded count, `first_failed_at`, the recorded last counted check (or "none recorded"/"unreadable"), the baseline and any `closed_at` in the state, read from the fields, and changes none of them. The first failed week only marks the entry as suspected in `atlas/data/refresh-state.json`; nothing is published. A second consecutive failed week marks the card closed (`include_closed_history`) with a `site_reachable` claim (`direct_observation`, outcome `contradicted`) and a `status_history` record `by: atlas/refresh.py`. The card then shows "Closed by automated check since <date>". If the site answers again in a later weekly check, the card reopens automatically (back to live, with a new claim and history record). The checker validates every redirect and connects to the exact DNS addresses it validated, without using system proxies; private, local, cloud-internal and special platform addresses are refused and count as failed attempts. JSON reads are capped at 1 MB per response and 25 MB per aggregate source read; aggregate processing is capped at 100,000 rows and 50 pages. Pagination offsets must be decimal values of at most 12 digits.

### Between live and closed: reachability notes

Expand All @@ -34,7 +34,7 @@ A note needs two reads of the matching page type (`own_content`, `challenge`, `e

In both cases the page, the URL and the permanent ID are kept.

The same weekly run also re-reads the numbers listed in [`refresh-sources.json`](refresh-sources.json) from the operators' or measurers' public JSON (since 2026-11-01 this includes the 30-day x402-list settlement figures of 27 x402 cards). A changed number is a re-observation: the claim gets the new value, its UTC time and the source's own quote; the old value, text, source and window move into the claim's history, which is never rewritten. When the source states when it computed the figure (x402-list's `traction.as_of`), that time is kept as `source_as_of`, separate from our read time; a last-settlement time is kept as `last_settlement_seen_at` and is never treated as the data's as-of. A non-finite number (NaN, Infinity, or a digit string too long for a number) is never accepted, and the files are written all-or-nothing (temp file, then atomic replace), so a failed write keeps the old file. A source that cannot be read, or a list row that is missing, changes nothing.
The same weekly run also re-reads the numbers listed in [`refresh-sources.json`](refresh-sources.json) from the operators' or measurers' public JSON (since 2026-11-01 this includes the 30-day x402-list settlement figures of 27 x402 cards). The weekly report flags a changed number whose source URL or window text differs from the record it replaces, so it is checked before being read as growth or decline; only the labels are compared, and a label difference does not by itself show a different measurement. A changed number is a re-observation: the claim gets the new value, its UTC time and the source's own quote; the old value, text, source and window move into the claim's history, which is never rewritten. When the source states when it computed the figure (x402-list's `traction.as_of`), that time is kept as `source_as_of`, separate from our read time; a last-settlement time is kept as `last_settlement_seen_at` and is never treated as the data's as-of. A non-finite number (NaN, Infinity, or a digit string too long for a number) is never accepted, and the files are written all-or-nothing (temp file, then atomic replace), so a failed write keeps the old file. A source that cannot be read, or a list row that is missing, changes nothing.

**Confirmed dates** (proposed by Hark in the pilot report on [issue #273](https://github.com/commonworld-one/commonworld/issues/273#issuecomment-6564079672); the maintainer chose the #273 direction on 2026-11-01, which does not imply approval of every implementation detail). Every fact the weekly checks read again and find unchanged gets a check record, `confirmed_at` (UTC), and the card shows "Observed <date> · Confirmed <date>". A re-check never changes `observed_at`: only a real change of the value (or of the statement or source dates read with it) is a new observation, and then the old record, with its last `confirmed_at`, moves into history and the new one starts without a confirmation. Today this covers a number re-read from its mapping with the same value, a supported `site_reachable` claim whose own source URL answered below HTTP 400, a replication record re-read with the same counts, and a stored homepage screenshot that a new weekly capture shows with no visible change (`atlas/tools/screens.py`; the image and `captured_at` stay). Facts that no weekly check re-reads keep only their observed date. A blocked answer (403, 429, a challenge page), a failed read or a too-young screenshot confirms nothing.

Expand Down
63 changes: 58 additions & 5 deletions atlas/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,18 @@ def apply_number(entry, m, val, quote, methods, ts, fields=None):
return what, old['value']


def comparison_of(claim, what):
"""How the new record of a re-observed number relates to the record it replaced (the last history entry apply_number wrote):
'same' when source URL and window label are both unchanged, else 'source', 'window' or 'source+window' for what changed.
None when there is no earlier record to compare with ('new'). Only labels are compared; no value or date is inferred."""
hist = (claim or {}).get('history') or []
if what == 'new' or not hist:
return None
old = hist[-1]
diff = [k for k in ('source_url', 'window') if old.get(k) != claim.get(k)]
return 'same' if not diff else '+'.join('source' if k == 'source_url' else 'window' for k in diff)


def _same_url(a, b):
return isinstance(a, str) and isinstance(b, str) and a.rstrip('/') == b.rstrip('/')

Expand Down Expand Up @@ -1140,7 +1152,10 @@ def job(e):
st['closed_at'] = ts
changed_slugs.add(slug)
else:
rep['suspected'].append({'slug': slug, 'url': r['via'], 'error': r['error'], 'methods': r['methods']})
rep['suspected'].append({'slug': slug, 'url': r['via'], 'error': r['error'], 'methods': r['methods'],
'failed_weeks': st['failed_weeks'], 'first_failed_at': st['first_failed_at'],
'closed_at': st.get('closed_at'), 'interval_baseline_at': st.get('interval_baseline_at'),
'last_counted_at': st.get('last_counted_at')})
else:
if st and st.get('failed_weeks'):
rep['recovered'].append({'slug': slug, 'was_failed_weeks': st['failed_weeks']})
Expand Down Expand Up @@ -1207,7 +1222,8 @@ def job(e):
if what != 'same':
changed_slugs.add(e['slug'])
rep['numbers'].append({'slug': e['slug'], 'id': m['id'], 'kind': m['kind'], 'basis': m['basis'], 'unit': m['unit'],
'old': old, 'new': val, 'action': what, 'source': m['url']})
'old': old, 'new': val, 'action': what, 'source': m['url'],
'comparison': comparison_of(c, what)})
if m.get('on_change_note'):
rep['notes'].append(f'{e["slug"]}: {m["on_change_note"]}')

Expand Down Expand Up @@ -1265,9 +1281,11 @@ def summary_md(rep, snap_path):
c = rep['counts']
L += [f'| checked | {sum(c.values())} |', f'| reachable (2xx/3xx) | {c.get("ok", 0)} |', f'| blocked / needs browser (401/403/429/503…) | {c.get("blocked", 0)} |',
f'| failed this week | {c.get("fail", 0)} |',
f'| **died** (2nd failed week → closed history) | {len(rep["died"])} |', f'| suspected down (1st failed week) | {len(rep["suspected"])} |',
f'| **died** (2nd failed week → closed history) | {len(rep["died"])} |', f'| suspected down (1st failed week) | {sum(1 for r in rep["suspected"] if r.get("failed_weeks", 1) < 2)} |',
f'| 2 or more failed weeks on record, not counted this run, not closed | {sum(1 for r in rep["suspected"] if r.get("failed_weeks", 1) >= 2)} |',
f'| recovered from suspected | {len(rep["recovered"])} |', f'| **revived** (closed by refresh → live) | {len(rep["revived"])} |',
f'| domain moved (needs human review) | {len(rep["moved"])} |', f'| number changes | {len(rep["numbers"])} |',
f'| of which source URL or window text differs from the replaced record | {sum(1 for r in rep["numbers"] if r.get("comparison") not in (None, "same"))} |',
f'| statements out of step with their number (needs a human) | {len(rep.get("note_drift", []))} |',
f'| replication count changes | {sum(1 for r in rep.get("replications", []) if r["action"] != "same")} |',
f'| facts confirmed unchanged (confirmed_at set, observed_at kept) | {len(rep.get("confirmed", [])) + sum(1 for r in rep.get("replications", []) if r["action"] == "same")} |', '']
Expand All @@ -1282,11 +1300,46 @@ def table(title, rows, cols):
L.append('')
pg = lambda s: f'[{s}](https://commonworld.one/atlas/platforms/{s}/)'
table('Died (status → closed history; page and URL kept)', rep['died'], [('entry', lambda r: pg(r['slug'])), ('url', lambda r: r['url']), ('first failed', lambda r: r['first_failed_at'][:10]), ('last error', lambda r: r['error'])])
table('Suspected down (first failed week; nothing published)', rep['suspected'], [('entry', lambda r: pg(r['slug'])), ('url', lambda r: r['url']), ('error', lambda r: r['error'])])
table('Suspected down (first failed week; nothing published)', [r for r in rep['suspected'] if r.get('failed_weeks', 1) < 2],
[('entry', lambda r: pg(r['slug'])), ('url', lambda r: r['url']), ('error', lambda r: r['error'])])
older = [r for r in rep['suspected'] if r.get('failed_weeks', 1) >= 2]
if older:
def last_count(r):
v = r.get('last_counted_at')
if v is None:
return 'none recorded'
try:
_parse_ts(v)
return v
except (ValueError, TypeError):
return 'unreadable: ' + str(v)[:40]

def baseline(r):
b = r.get('interval_baseline_at')
return '—' if not b else (b + (' (set this run)' if b == rep['run_at'] else ''))
L += ['### Failed weeks on record (2 or more) that this run did not count and did not close', '',
'For each entry below the state holds 2 or more failed weeks, this run\'s failed check added no week and closed nothing, and nothing is published. '
'The columns show what the state says: when the last counted check was recorded (none recorded or unreadable means the 7-day interval could not be '
'measured, so `interval_baseline_at` marks where it starts), the first failed date, and any `closed_at` already in the state. '
'A later failed check that is at least 7 days after the last counted check (or after the baseline) adds a week, and with 2 or more weeks the card then closes. '
'Counts and `first_failed_at` are not changed by this report.', '']
L.append('| entry | url | error | failed weeks on record | first failed | last counted check | interval baseline | closed_at in state (card still live) |')
L.append('|---|---|---|---:|---|---|---|---|')
for r in older:
L.append('| ' + ' | '.join(str(x).replace('|', '\\|').replace('\n', ' ') for x in (
pg(r['slug']), r['url'], r['error'], r['failed_weeks'], (r.get('first_failed_at') or '—')[:10], last_count(r), baseline(r),
r['closed_at'] if r.get('closed_at') else '—')) + ' |')
L.append('')
table('Revived', rep['revived'], [('entry', lambda r: pg(r['slug'])), ('url', lambda r: r['url']), ('HTTP', lambda r: r['status'])])
table('Recovered (was suspected)', rep['recovered'], [('entry', lambda r: pg(r['slug'])), ('failed weeks before', lambda r: r['was_failed_weeks'])])
table('Redirects to another domain (flag only, data unchanged)', rep['moved'], [('entry', lambda r: pg(r['slug'])), ('status', lambda r: r['status']), ('canonical', lambda r: r['canonical']), ('now ends at', lambda r: r['final_url']), ('previously seen', lambda r: r['previous'] or '—')])
table('Number changes (re-observations; old value kept in claim history)', rep['numbers'], [('entry', lambda r: pg(r['slug'])), ('claim', lambda r: r['id']), ('basis', lambda r: r['basis']), ('change', lambda r: r['action']), ('old', lambda r: '—' if r['old'] is None else fmt_value(r['old'])), ('new', lambda r: fmt_value(r['new'])), ('unit', lambda r: r['unit']), ('source', lambda r: r['source'])])
moved_basis = sum(1 for r in rep['numbers'] if r.get('comparison') not in (None, 'same'))
if moved_basis:
L += [f'**{moved_basis} of {len(rep["numbers"])} number changes below have a source URL or window text that differs from the record they replace '
'(column "same source and window text"). The label difference alone does not show the measurement changed, so check it before reading old to new as growth or decline; '
'the old value, source and window stay in the claim history.**', '']
table('Number changes (re-observations; old value kept in claim history)', rep['numbers'], [('entry', lambda r: pg(r['slug'])), ('claim', lambda r: r['id']), ('basis', lambda r: r['basis']), ('change', lambda r: r['action']),
('same source and window text', lambda r: {None: '—', 'same': 'yes'}.get(r.get('comparison'), 'no: ' + str(r.get('comparison')) + ' differs')), ('old', lambda r: '—' if r['old'] is None else fmt_value(r['old'])), ('new', lambda r: fmt_value(r['new'])), ('unit', lambda r: r['unit']), ('source', lambda r: r['source'])])
L.append(replications_md(rep, heading=False))
if rep['notes']:
L.append('### Needs a human'); L.append(''); L += [f'- {n}' for n in rep['notes']]; L.append('')
Expand Down
Loading
Loading