GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / AI agents and coordination / ventus-grid-engine / spider

Receiver Proof and 2 more files

A JavaScript module in the spider folder of Ventus Grid Engine that runs suite (`runSuite`).

456 lines of JavaScript and Python and YAML from ventus-grid-engine, in 3 files. Topic: AI agents and coordination. Section 1683 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Receiver Proof render · ventus-grid-engine / spider/receiver.proof.mjs lines 1–296
  2. Sources docs-config · ventus-grid-engine / spider/sources.yml lines 1–16
  3. Update Manifest storage · ventus-grid-engine / spider/update_manifest.py lines 1–144

Receiver Proof

A JavaScript module in the spider folder of Ventus Grid Engine that runs suite (`runSuite`).

renderventus-grid-engine / spider/receiver.proof.mjs · lines 1–296 of 296 · Not reached from any entry point (candidate for review) · pattern withPage (shared by 2 files)

What it does
It fetches data. Defines check, withPage, runSuite, c. Uses libraries node:url, node:path, playwright. Side effects: changes the web page (DOM); makes network requests; starts processes.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
What it achieves
It runs suite (`runSuite`) and is built from the check step (`check`) and the with page helper (`withPage`). The Spider Sandbox receiver held to the same format as the reference it copies: `spider_full_po_test.html` in `data-federation-map-for-globalgrid2050-all-repos/dashboard/sandbox/`.
Why it matters
No other file in the estate was found to import it.
Application
ventus-grid-engine · spider · JavaScript module
Uses
node:url, node:path, playwright
Used by
none found
Produces
check, withPage, runSuite, c
Defines here
check, withPage, runSuite, c
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
ventus-grid-engine@ad566356a44e006682e956483d569f31ddbb9630 spider/receiver.proof.mjs:1-296 · blob 8629fae5c85ead229e9e2a087f623aaae79d7460 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network, process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
/* receiver.proof.mjs — the Spider Sandbox receiver held to the same format
 * as the reference it copies: spider_full_po_test.html in
 * data-federation-map-for-globalgrid2050-all-repos/dashboard/sandbox/.
 *
 * This proof drives the real page in real browsers (Playwright: Chromium
 * and WebKit) because the thing being verified — the iconic 🕷 button's two
 * states, the FOCUS re-centre, the card layout — is DOM and CSS behaviour
 * that a plain Node import cannot see.
 *
 * NOT auto-discovered by verify.mjs: verify.mjs only reads *.proof.mjs
 * directly inside proofs/, not subdirectories (see ../verify.mjs, the
 * readdirSync(proofsDir) call is non-recursive). That is a deliberate
 * decision left alone here rather than edited around. Run this proof
 * by hand:
 *
 *   node spider/receiver.proof.mjs
 *
 * It requires the "playwright" package with Chromium and WebKit installed.
 * That is not a dependency of this repo (package.json is intentionally
 * untouched). Install it ad hoc to run this proof:
 *
 *   npm i -D playwright && npx playwright install chromium webkit
 *
 * NODE_PATH does NOT make Node's ESM resolver find an existing playwright
 * install elsewhere — only CommonJS require() honours NODE_PATH. To reuse
 * an install that already lives outside this repo without adding it as a
 * real dependency, make node_modules/playwright (and node_modules/
 * playwright-core) a directory junction pointing at it, e.g. on the machine
 * this was built on:
 *   New-Item -ItemType Junction -Path node_modules\playwright -Target <that install>\node_modules\playwright
 *   New-Item -ItemType Junction -Path node_modules\playwright-core -Target <that install>\node_modules\playwright-core
 * then remove node_modules afterwards — it is not meant to be committed.
 */

import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';

const here = dirname(fileURLToPath(import.meta.url));
const pageUrl = 'file:///' + join(here, '..', 'index.html').replace(/\\/g, '/');

const failures = [];
let passed = 0;
const check = (name, condition) => {
    if (condition) passed += 1;
    else failures.push(name);
};

let engines;
try {
    const pw = await import('playwright');
    engines = [['chromium', pw.chromium], ['webkit', pw.webkit]];
} catch (e) {
    console.error('receiver proof SKIPPED (not a failure of the page): the '
        + '"playwright" package is not installed in this environment, so the '
        + 'browser-driven checks below cannot run. See the header of this '
        + 'file for how to install it. Exiting non-zero because an '
        + 'unverified receiver must never be reported as a pass.');
    process.exit(1);
}

// WebKit (unlike Chromium) surfaces a blocked file:// fetch() as BOTH a
// console error AND a Playwright 'pageerror' event — even though every
// fetch() in this page is inside try/catch and the rejection genuinely is
// caught (proved by every other check in this file passing: cards render,
// the count line is correct, the spider button works, on both engines).
// Confirmed by a standalone diagnostic run against this exact file before
// writing this filter: the message is always literally "Fetch API cannot
// load file: //... due to access control checks." — a network/access-
// control notice from the engine, not an uncaught exception in page logic.
// It is filtered out here by name, not swallowed silently, so any other
// pageerror still fails the proof.
const KNOWN_FILE_FETCH_NOISE = /Fetch API cannot load file:.*access control checks/;

async function withPage(browser, viewport, fn) {
    const page = await browser.newPage({ viewport });
    const pageErrors = [];
    page.on('pageerror', e => {
        const msg = String(e);
        if (!KNOWN_FILE_FETCH_NOISE.test(msg)) pageErrors.push(msg);
    });
    await page.goto(pageUrl, { waitUntil: 'networkidle' });
    await page.waitForTimeout(150); // let the async loader's draw() settle
    await fn(page, pageErrors);
    await page.close();
}

async function runSuite(label, browserType) {
    const c = (name, condition) => check(label + ': ' + name, condition);
    const browser = await browserType.launch();

    /* ── Desktop pass: 1400x900 ──────────────────────────────────────────── */

    await withPage(browser, { width: 1400, height: 900 }, async (page, pageErrors) => {

        c('desktop 1400x900: page raised zero uncaught page errors on load',
            pageErrors.length === 0);

        c('the brand eyebrow and title are exactly as the reference renders '
            + 'them (markup case; CSS text-transform:uppercase renders the '
            + 'eyebrow in caps, which is why this checks textContent, not the '
            + 'rendered case)',
            (await page.locator('.brand .ey').textContent()) === 'Ventus · Global Grid 2050'
            && (await page.locator('.brand h1').textContent()) === 'The Spider Sandbox');

        c('the FOCUS select exists and is populated from the loaded scope',
            (await page.locator('#focus option').count()) > 0);

        const relButtons = await page.locator('#relSeg button').allInnerTexts();
        c('the SHOW segmented control offers exactly Both / Outgoing / Incoming',
            relButtons.map(t => t.trim()).join('|') === 'Both|Outgoing|Incoming');

        const tapButtons = await page.locator('#actSeg button').allInnerTexts();
        c('the tap-action tabs are Explore / GitHub / External / Status, in order',
            tapButtons.map(t => t.trim()).join('|') === 'Explore|GitHub|External|Status');

        c('the LIVE/snapshot source pill is present',
            await page.locator('#srcTag').count() === 1);

        c('the count line reads "<n> dependencies · <m> dependents" and the '
            + 'numbers match what the page itself computed for the focused node',
            await page.evaluate(() => {
                const { out, inc } = (() => {
                    const o = [], i = [];
                    S().edges.forEach(([f, t, ty]) => { if (f === current) o.push(t); if (t === current) i.push(f); });
                    return { out: o, inc: i };
                })();
                const text = document.getElementById('count').textContent;
                return text.includes(String(out.length)) && text.includes(String(inc.length))
                    && /dependencies/.test(text) && /dependents/.test(text);
            }));

        c('the Federation section heading text and Explore hint are present',
            (await page.locator('.sect').first().textContent()).toLowerCase().includes('depends on')
            && (await page.locator('#hint').innerText()).includes('tap a card to re-centre'));

        /* ── The iconic 🕷 button: Spider state (column view showing) ──────── */

        const btn = page.locator('#spiderToggle');
        c('spider button shows the spider glyph and starts labelled "Spider" '
            + '(offering to switch INTO spider view, because column view is '
            + 'showing)',
            (await page.locator('.spider-glyph').innerText()) === '🕷'
            && (await page.locator('#viewLabel').innerText()) === 'Spider');

        c('in this state aria-pressed is false and the pill border is the '
            + 'neutral grey, not the gold glow — matching the reference screenshot',
            (await btn.getAttribute('aria-pressed')) === 'false');

        const neutralBorder = await btn.evaluate(el => getComputedStyle(el).borderColor);
        c('neutral-state border colour is the reference rgba(255,255,255,.55), not gold',
            /rgba\(255,\s*255,\s*255,\s*0\.55\)/.test(neutralBorder));

        /* ── Toggle to spider view: pill becomes "Column", gold glow ───────── */

        await btn.click();
        await page.waitForTimeout(150);

        c('after one click aria-pressed flips true and the label flips to '
            + '"Column" (now offering to switch BACK to column view) — the '
            + "architect's inversion, preserved exactly",
            (await btn.getAttribute('aria-pressed')) === 'true'
            && (await page.locator('#viewLabel').innerText()) === 'Column');

        const goldBorder = await btn.evaluate(el => getComputedStyle(el).borderColor);
        c('pressed-state border colour is the architect\'s gold, #ffd54a '
            + '(rgb 255,213,74), from federation_radial.css .viewbtn[aria-pressed="true"]',
            /rgb\(255,\s*213,\s*74\)/.test(goldBorder));

        const goldShadow = await btn.evaluate(el => getComputedStyle(el).boxShadow);
        c('pressed-state box-shadow carries the gold glow colour, not the '
            + 'reference sandbox\'s plain cyan glow (this button is the gold-CSS '
            + 'override, federation_radial.css, applied after the base <style>)',
            /213,\s*74/.test(goldShadow) || /255,\s*213,\s*74/.test(goldShadow));

        c('spider view rendered the dark grid canvas and its banner text '
            + 'verbatim from the reference',
            (await page.locator('.spiderCanvas').count()) === 1
            && (await page.locator('.maphint').innerText())
                .includes('Optional spider view. Cards keep their size'));

        c('the spider canvas grid and coloured wire arrows are present',
            (await page.locator('.spiderGrid').count()) === 1
            && (await page.locator('.wires line').count()) >= 1);

        /* ── Toggle back: Spider state returns exactly ──────────────────────── */

        await btn.click();
        await page.waitForTimeout(150);
        c('clicking again returns aria-pressed to false and label to "Spider"',
            (await btn.getAttribute('aria-pressed')) === 'false'
            && (await page.locator('#viewLabel').innerText()) === 'Spider');

        /* ── FOCUS re-centres ────────────────────────────────────────────── */

        const beforeCenter = await page.locator('.is-center .name').innerText();
        const optionCount = await page.locator('#focus option').count();
        if (optionCount > 1) {
            await page.selectOption('#focus', { index: 1 });
            await page.waitForTimeout(150);
            const afterCenter = await page.locator('.is-center .name').innerText();
            c('selecting a different FOCUS option re-centres the card shown',
                afterCenter !== beforeCenter);
        } else {
            c('FOCUS has at least one option to re-centre on (skipped: only one option loaded)', true);
        }

        /* ── Cards: badge, name, dot, coloured border ───────────────────────── */

        c('at least one non-centre card renders the kind badge, name and RAG dot',
            (await page.locator('.branch .card .badge').count()) > 0
            && (await page.locator('.branch .card .name').count()) > 0
            && (await page.locator('.branch .card .dot').count()) > 0);

        const twigBorder = await page.locator('.twig .card').first()
            .evaluate(el => getComputedStyle(el).borderLeftColor);
        c('a related card carries a coloured left border keyed to its edge type',
            twigBorder !== 'rgb(38, 43, 54)' /* --line, the uncoloured default */);

        const centerGlow = await page.locator('.is-center').first()
            .evaluate(el => getComputedStyle(el).boxShadow);
        c('the focused card glows cyan (is-center box-shadow)',
            /0,\s*229,\s*255/.test(centerGlow));

        /* ── SHOW segmented control actually filters ─────────────────────────── */

        await page.locator('#relSeg button[data-mode="out"]').click();
        await page.waitForTimeout(120);
        const sectTextsOut = await page.locator('.sect').allInnerTexts();
        c('SHOW → Outgoing hides the "Depended on by" column',
            sectTextsOut.some(t => /Depends on/i.test(t))
            && !sectTextsOut.some(t => /Depended on by/i.test(t)));
        await page.locator('#relSeg button[data-mode="both"]').click();
        await page.waitForTimeout(120);

        /* ── Manifest-driven graphs: engine-graph tolerates absence ─────────── */

        c('spider/manifest.json\'s "Engine population" graph is offered as a '
            + 'FOCUS/root card even when the page is opened from file://, where '
            + 'fetch() of genome/engine-graph.json is refused',
            await page.evaluate(() => SCOPES.root.nodes.some(n => n.label === 'Engine population')));

        c('drilling into an engine graph the page could not load (file://) shows a clear '
            + 'placeholder card rather than an empty or broken view',
            await page.evaluate(() => {
                const s = SCOPES['engine-graph'];
                return !!s && s.nodes.length === 1 && /not yet emitted/.test(s.nodes[0].label);
            }));

        c('the genome-spider graph (published by spiders/species/genome-spider as '
            + 'nodes.json + edges.json) is offered as a root card from the manifest fallback',
            await page.evaluate(() => SCOPES.root.nodes.some(n => n.label === 'genome-spider output')));
    });

    /* ── ?graph= deep link ────────────────────────────────────────────────── */

    await withPage(browser, { width: 1400, height: 900 }, async (page) => {
        // engine-graph is used here (not globalgrid2050-contents) because that
        // scope only exists after a successful loadContents() fetch, which
        // file:// testing cannot exercise (both engines refuse fetch() on
        // file:// entirely). engine-graph always exists, live or placeholder,
        // from MANIFEST_FALLBACK.
        await page.goto(pageUrl + '?graph=engine-graph', { waitUntil: 'networkidle' });
        await page.waitForTimeout(200);
        c('?graph=engine-graph deep-links straight into that scope',
            await page.evaluate(() => scopeKey === 'engine-graph'));
    });

    /* ── Mobile pass: 393x852, the architect's review size ──────────────────── */

    await withPage(browser, { width: 393, height: 852 }, async (page, pageErrors) => {
        c('mobile 393x852: page raised zero uncaught page errors on load',
            pageErrors.length === 0);
        c('the spider button is present and tappable at phone width',
            await page.locator('#spiderToggle').isVisible());
        c('ground colour is the dark monospace panel background, not a light '
            + 'theme (phone-readable per the brief)',
            (await page.evaluate(() => getComputedStyle(document.body).backgroundColor))
                .includes('11, 13, 18') /* #0b0d12 */);
        const box = await page.locator('body').evaluate(() => document.documentElement.scrollWidth);
        c('no horizontal overflow at 393px', box <= 394);
    });

    await browser.close();
}

for (const [label, browserType] of engines) {
    await runSuite(label, browserType);
}

if (failures.length) {
    console.error('receiver proof FAILED (' + failures.length + ' of '
        + (failures.length + passed) + '):\n- ' + failures.join('\n- '));
    process.exit(1);
}
console.log('receiver proof PASS — ' + passed + ' checks');
export default { status: 'PASS', checks: passed };

Sources

A configuration file in the spider folder of Ventus Grid Engine using data from the stars and code-generator repositories.

docs-configventus-grid-engine / spider/sources.yml · lines 1–16 of 16 · Not reached from any entry point (candidate for review)

Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
What it achieves
Where the Spider dashboard learns about new graphs.
Why it matters
No other file in the estate was found to import it.
Application
ventus-grid-engine · spider · configuration
Uses
Features (estate URL), Features (estate URL)
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
ventus-grid-engine@ad566356a44e006682e956483d569f31ddbb9630 spider/sources.yml:1-16 · blob 63c6980c0d0413179a3ecf857b2bb0000224a073 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
# Where the Spider dashboard learns about new graphs.
#
# Each registry is a features.yml published by another repository, listing graphs in the same shape as
# the entries in manifest.json beside this file. spider/update_manifest.py (run by
# .github/workflows/spider-features.yml) reads every registry, fetches each graph to prove it is reachable
# and non-empty, and then adds it to manifest.json with a "verified" line — the same way the
# gridatlas-lineage entry was added by hand. Entries written by hand in manifest.json are never changed;
# entries this file brought in are updated when their registry changes, and never deleted.
schema_version: spider-sources-v1
registries:
  - url: https://ventusltd.github.io/stars/spider/features.yml
    owner: Ventusltd/stars
    note: Reports built from recorded GridAtlas composition tests, and the modular star of all public Ventusltd code.
  - url: https://ventusltd.github.io/code-generator/spider/features.yml
    owner: Ventusltd/code-generator
    note: Apps assembled from numbered parts of the modular star, wired to their parts and to the repositories that already use them.

Update Manifest

A Python module in the spider folder of Ventus Grid Engine that reads graph (`read_graph`).

storageventus-grid-engine / spider/update_manifest.py · lines 1–144 of 144 · Entry point · pattern count (shared by 27 files)

What it does
It fetches data. Defines fetch, count, read_graph, measure. Uses libraries datetime, json, os, pathlib, sys. Side effects: reads or writes files; makes network requests; starts processes.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Downstream impact
Used directly by 1 file: Spider Features Workflow (ventus-grid-engine).
What it achieves
It is built from the fetch step (`fetch`), the count step (`count`) and the measure step (`measure`). Add newly published graphs to the Spider dashboard's manifest, once they are proven reachable.
Why it matters
Run by Spider Features Workflow.
Application
ventus-grid-engine · spider · Python module
Uses
datetime, json, os, pathlib, sys, urllib.request, yaml
Used by
run by Spider Features Workflow (workflow run)
Produces
fetch, count, read_graph, measure
Defines here
fetch, count, read_graph, measure
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
ventus-grid-engine@ad566356a44e006682e956483d569f31ddbb9630 spider/update_manifest.py:1-144 · blob c59b16c82c5b33ddc89de9c8b0b10e112552837f · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: production_core
"""Add newly published graphs to the Spider dashboard's manifest, once they are proven reachable.

Reads spider/sources.yml (registries published by other repositories), fetches each registry's
features.yml, fetches every graph it lists, counts what the receiver would see (nodes or features;
edges or links), and merges the proven entries into spider/manifest.json.

Rules, in the spirit of the receiver's own README:
- an entry written by hand (no "registry" field) is never changed;
- an entry this script added is updated when its registry changes it, and never deleted;
- a graph that cannot be fetched, or is empty, is not added and is reported instead;
- index.html is never touched: the receiver already reads every manifest entry it is given;
- every entry, hand-written or not, gets a "measured" field ({"nodes": n, "edges": e}) refreshed on every
  run from what its path actually serves. Hand-written prose is never rewritten: a count lives in
  "measured", not in a description, so it cannot go stale the way a typed number does. An entry whose
  path cannot be read loses its "measured" field (no stale count is left standing) and is reported;
  spider/manifest.proof.mjs then fails on it.
"""
import datetime
import json
import os
import pathlib
import sys
import urllib.request

import yaml

HERE = pathlib.Path(__file__).resolve().parent
ROOT = HERE.parent
MANIFEST = HERE / "manifest.json"
SOURCES = HERE / "sources.yml"
FIELDS = ("title", "path", "edges_path", "source_spider", "description")


def fetch(url, timeout=25):
    req = urllib.request.Request(url, headers={"User-Agent": "ventus-grid-engine spider-features", "Cache-Control": "no-cache"})
    with urllib.request.urlopen(req, timeout=timeout) as r:
        return r.status, r.read()


def count(raw):
    """Nodes and edges as index.html's normaliseGenericGraph would count them. A bare list (the
    globalgrid2050 contents cartridge publishes nodes.json and edges.json as plain arrays) is its own count."""
    if isinstance(raw, list):
        return len(raw), len(raw)
    nodes = raw.get("nodes") if isinstance(raw.get("nodes"), list) else raw.get("features") if isinstance(raw.get("features"), list) else []
    edges = raw.get("edges") if isinstance(raw.get("edges"), list) else raw.get("links") if isinstance(raw.get("links"), list) else []
    return len(nodes), len(edges)


def read_graph(path):
    """(HTTP status, parsed JSON) for a manifest path: https URLs are fetched, ./paths are read from this
    checkout, which is what GitHub Pages serves from main."""
    if path.startswith("http://") or path.startswith("https://"):
        status, body = fetch(path)
        return status, json.loads(body.decode("utf-8-sig"))
    return 200, json.loads((ROOT / path).read_text(encoding="utf-8-sig"))


def measure(entry):
    """(status, nodes, edges) as the receiver counts the entry: nodes from path, edges from edges_path
    when the entry has one, otherwise from path."""
    status, raw = read_graph(entry["path"])
    n, e = count(raw)
    if entry.get("edges_path"):
        _, ef = read_graph(entry["edges_path"])
        e = count(ef)[1]
    return status, n, e


manifest = json.loads(MANIFEST.read_text(encoding="utf-8"))
by_id = {g["id"]: g for g in manifest["graphs"]}
sources = yaml.safe_load(SOURCES.read_text(encoding="utf-8"))
today = datetime.date.today().isoformat()
added, updated, refused, unchanged = [], [], [], []

for reg in sources.get("registries") or []:
    url = reg["url"]
    try:
        status, body = fetch(url)
        features = yaml.safe_load(body.decode("utf-8"))
    except Exception as exc:  # the registry itself is unreachable: report, change nothing
        refused.append((url, f"registry unreachable: {str(exc)[:120]}"))
        continue
    for g in features.get("graphs") or []:
        gid = g.get("id")
        if not gid or not g.get("path"):
            continue
        existing = by_id.get(gid)
        if existing is not None and "registry" not in existing:
            unchanged.append((gid, "written by hand; left alone"))
            continue
        try:
            status, n, e = measure(g)
            if n == 0:
                raise ValueError("no nodes")
        except Exception as exc:
            refused.append((gid, f"{g['path']} — {str(exc)[:120]}"))
            continue
        entry = {"id": gid}
        for f in FIELDS:
            entry[f] = g.get(f)
        entry["verified"] = f"{today} HTTP {status}, {n} nodes / {e} edges"
        entry["registry"] = url
        if existing is None:
            manifest["graphs"].append(entry)
            by_id[gid] = entry
            added.append((gid, entry["verified"]))
        elif any(existing.get(f) != entry[f] for f in FIELDS):
            existing.update(entry)
            updated.append((gid, entry["verified"]))
        else:
            existing["verified"] = entry["verified"]
            unchanged.append((gid, entry["verified"]))

# Every entry's measured count, refreshed from what its path serves right now.
measured, unmeasured = [], []
for g in manifest["graphs"]:
    if not g.get("path"):
        continue
    try:
        _, n, e = measure(g)
        if g.get("measured") != {"nodes": n, "edges": e}:
            measured.append((g["id"], f"{n} nodes / {e} edges (was {g.get('measured')})"))
        g["measured"] = {"nodes": n, "edges": e}
    except Exception as exc:
        g.pop("measured", None)
        unmeasured.append((g["id"], f"{g['path']} — {str(exc)[:120]}"))

if added or updated or unchanged or measured or unmeasured:
    MANIFEST.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")

lines = ["## Spider features", ""]
for label, items in (("Added", added), ("Updated", updated), ("Unchanged", unchanged), ("Not added", refused),
                     ("Count refreshed", measured), ("Could not be measured", unmeasured)):
    if items:
        lines.append(f"**{label}:**")
        lines += [f"- `{gid}` — {why}" for gid, why in items]
        lines.append("")
report = "\n".join(lines)
print(report)
if os.environ.get("GITHUB_STEP_SUMMARY"):
    with open(os.environ["GITHUB_STEP_SUMMARY"], "a", encoding="utf-8") as f:
        f.write(report + "\n")
sys.exit(0)