Real-account read check of the desktop tabs: analytics snapshot stops when every store failed, compare names why a store has no days (Growth shows it), listing screenshot count skips contact sheets; Growth chart as an index on one axis; recorded price answers round-trip the price sheet

This commit is contained in:
CRTkafa 2026-10-11 00:06:26 +00:00
parent ffe64c5648
commit c2b0a0d8a3
15 changed files with 468 additions and 31 deletions

View file

@ -14,7 +14,7 @@ import { ascClient, type Asc, type J } from './apple/asc';
import type { Ctx } from './lib/ctx';
import {
type AppleDay, APPLE_REPORTS, appleDaily, appleTotals, bucketName, checksumOk, compareAroundEvents, decodeText, effectMarkdown, effectTable, inWindow,
latestPerDate, mergeSeries, monthsBetween, parseGitLog, parseReport, pickReport, type PlayDay, playDaily, playObjects, playTotals, type Snapshot,
latestPerDate, mergeSeries, monthsBetween, snapshotProblem, storeErrors, parseGitLog, parseReport, pickReport, type PlayDay, playDaily, playObjects, playTotals, type Snapshot,
} from './lib/analytics';
import { STORAGE_READ_SCOPE } from './lib/google-auth';
import { done, log, printJson, warn } from './lib/log';
@ -127,6 +127,8 @@ export async function run(ctx: Ctx): Promise<void> {
if (snap.play && !('error' in snap.play)) { const t = snap.play.totals; rows.push(['play', `${t.visitors} visitors`, `${t.acquisitions} acquisitions`, `${t.installs} installs`, pct(t.conversion ?? null)]); }
if (rows.length) console.log(textTable(['store', 'reach', 'interest', 'installs', 'conversion'], rows));
const file = join(dir, `${snap.date}.json`);
const problem = snapshotProblem(snap);
if (problem) throw new Error(`no store data, nothing written (${problem})`);
if (dry) { done(TAG, `dry run: would write ${file} (${start} to ${end})`); return; }
mkdirSync(dir, { recursive: true });
writeFileSync(file, JSON.stringify(snap, null, 2) + '\n');
@ -145,7 +147,7 @@ export async function run(ctx: Ctx): Promise<void> {
const events = parseGitLog(g.stdout.toString()).reverse();
log(TAG, `${snaps.length} snapshot(s), ${series.apple.length} App Store day(s), ${series.play.length} Play day(s), ${events.length} store change(s) since ${first}`);
const fx = compareAroundEvents(series, events, a.num('days', 7));
if (a.has('json')) { printJson({ snapshots: snaps.length, since: first, series, effects: fx }); return; }
if (a.has('json')) { printJson({ snapshots: snaps.length, since: first, series, effects: fx, errors: storeErrors(snaps) }); return; }
console.log(a.has('md') ? effectMarkdown(fx) : effectTable(fx));
log(TAG, 'reading: a change needs several days on both sides and enough traffic; seasonality, featuring and ads move these numbers too');
return;