# -*- coding: utf-8 -*-
import json, os, io, sys
from datetime import datetime
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")

f = 'index_main.html'
baseline = {
    "round": 319,
    "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
    "schools": 36,
    "programs": 1444,
    "programs_unique_ids": 1444,
    "catd": 2817,
    "vd": 1551,
    "dead_links": 0,
    "exclude_residue": 0,
    "details_on_disk": 3776,
    "main_file_mtime": datetime.fromtimestamp(os.path.getmtime(f)).strftime("%Y-%m-%d %H:%M:%S"),
    "main_file_bytes": os.path.getsize(f),
    "phd": 498,
    "master": 946,
    "blocked_notes": [
        "r319: col-ba（哥大 MSBA）卡点——business.columbia.edu 403、SEAS IEOR 页 fetch error、bulletin BA 条目死链；GRE/GMAT 政策与截止/语言/学费本轮未能从官方核验，记待复核，主文件 test 已标待补、未臆造",
        "r319: 网络探测——可达 bulletin.columbia.edu / catalog.upenn.edu / as.nyu.edu / admission.gatech.edu / gradschool.duke.edu / grad.ucla.edu / sgs.utoronto.ca / grad.ubc.ca / bulletin.stanford.edu；403: engineering.jhu.edu / rackham.umich.edu / gradschool.cornell.edu / grad.berkeley.edu / gsas.columbia.edu / business.columbia.edu / stat.columbia.edu；DNS 不通: gradschool.uchicago.edu / mathematics.columbia.edu",
        "r319: 历史 blocked_notes 保留（UChicago SSL MA mid-career 口径、Emory HSRP、Cornell Biophysics T32、Northwestern MBS、GaTech ChBE GRE 等，详见台账）",
        "PROGRAMS 1444 = url 去重 1444（0 重复 url）",
        "todo_upgrade.json queue fully drained (722/722)；剩余半核验页字段补全长尾",
        "UChicago SSL MA mid-career 排除口径待主管确认",
        "Emory HSRP PhD deadline/GRE 待确认",
        "Cornell Biophysics T32-only 限制待主管定夺",
        "Northwestern MBS PhD deadline 待确认",
        "Georgia Tech ChBE GRE 待确认"
    ],
    "actions_this_round": [
        "r319: 只读基线核对：36 校 / PROGRAMS 1444 / CATD 2817 / VD 1551 / 死链 0 / 磁盘 3776 / node exit 0 / HTTP 200",
        "r319 闭环 col-csphd（哥大 CS PhD，details/col-csphd.html）：SEAS 官方申请要求页核验 GRE 2027 cycle（含 Spring/Fall）不要求、可选提交不扣分；回填主文件 test.cls 并更新详情页标化卡",
        "r319 闭环 col-stat（哥大统计 MA，details/col-stat.html）：ma.stat.columbia.edu 核验 GRE recommended but not required、GMAT 不可替代、无最低分不公布平均分；回填 test.cls",
        "r319 闭环 col-scope-mafn（哥大 MAFN 金融数学 MA，details/col-scope-mafn.html）：math.columbia.edu 核验 GRE/GMAT 不强制、强烈建议、GRE 优先；回填 test.cls",
        "r319 闭环 nyu-cs（NYU Tandon CS MS，details/nyu-cs.html）：engineering.nyu.edu 核验 GRE Optional（Tandon 全院不要求，送分代码 2668）；回填 test.cls 与 tui（学分单价/30 学分口径）",
        "r319 卡点 col-ba（哥大 MSBA，details/col-ba.html）：系站不可达，记待复核队列，详情页标化卡标注待复核",
        "r319: 终检 node exit 0、final_check/vd_check/gap_check 全绿，Top30 覆盖 30/30，未写库新增条目（仅字段回填）"
    ]
}
with open('_heartbeat_baseline.json', 'w', encoding='utf-8') as fp:
    json.dump(baseline, fp, ensure_ascii=False, indent=2)
print("baseline updated to r319")
