clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / activity-insights.sh
activity-insights.sh 2.1K
1# A repo's insights page has the same grid of its activity from the lake:2# pushes, landed reviews, releases, site deploys and CI results a day. It3# is a chart like the others there, still: a span a day, named and titled4# with its count, and no list under it. Clicking a day picks nothing and5# the address stays empty; a day's address picks nothing. With JS it6# recounts from activity.json, which has only each event's time. (forge7# attest stamps CI with the real clock, after this forge's fixed one:8# exported, but in no day.)9. "$(dirname "$0")/../lib.sh"10user dami11repo dami/greet12clone dami dami/greet "$T/w/d"13mkdir -p "$T/w/d/.forge"14printf '#!/bin/sh\ntrue\n' >"$T/w/d/.forge/ci"15chmod +x "$T/w/d/.forge/ci"16at "$T/w/d" commit "first"17push_as dami "$T/w/d" origin main18tick $((2 * 86400))19at "$T/w/d" commit "second"20at "$T/w/d" git tag v121push_as dami "$T/w/d" origin main v122export FORGE_USER=dami23ok at "$T/w/d" "$FORGE" attest24ok push_as dami "$T/w/d" origin refs/notes/ci25unset FORGE_USER26ok forge lake27export FORGE_STRICT=128build29p=$FORGE_WWW/dami/greet/insights/index.html30has "$p" '<figure class="panel activity-panel"><figcaption class="panel-head"><h3 class="act-total">3 events</h3><span class="grow">in the last year: pushes, landed reviews, releases, site deploys and ci results</span></figcaption>'31has "$p" '<span class="l2 a[0-9]+" data-day="2026-09-01" data-n="1" role="img" aria-label="2026-09-01: 1 event" title="2026-09-01: 1 event"></span>'32lacks "$p" '<button[^>]*data-day|aria-pressed|act-list|data-day-reset|ev-rows'33a=$FORGE_WWW/dami/greet/insights/activity.json34has "$a" '^\{"days":\{[^}]*\},"events":\[[0-9]+,[0-9]+,[0-9]+,[0-9]+\]\}$'35page() { node --no-warnings "$T_HOME/test/page.ts" activity "$p" "$@"; }36grid="3 events in the last year: pushes, landed reviews, releases, site deploys and ci results37 2026-09-01: 1 event l238 2026-09-03: 2 events l439address: "40eq "$(page)" "$grid"41eq "$(page click '[data-activity] [data-day="2026-09-01"]')" "$grid"42# Opened at a day's address, it picks nothing either, and leaves it be.43eq "$(page '#2026-09-01')" "${grid}#2026-09-01"