# -*- coding: utf-8 -*-
import json, pathlib, datetime, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52")
M = BASE / "index_main.html"
mt = datetime.datetime.fromtimestamp(M.stat().st_mtime).strftime("%Y-%m-%d %H:%M:%S")
b = json.load(open(BASE / "_heartbeat_baseline.json", encoding="utf-8"))
b["round"] = 343
b["timestamp"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
b["main_file_mtime"] = mt
b["main_file_bytes"] = M.stat().st_size
b.update({"programs": 1440, "catd": 2817, "vd": 1547, "dead_links": 0, "exclude_residue": 0,
          "details_on_disk": 3776, "http": "200 @ http://127.0.0.1:8000/index_main.html",
          "density_grade": {"A": 106, "B": 220, "C": 1114}})
b["actions_this_round"] = [
 "r343 只读基线：四脚本复跑，计数与 r342 一致（36 校 / PROGRAMS 1440 / CATD 2817 / VD 1547 / 死链 0 / node exit 0 / 密度 A98-B220-C1122）。",
 "r343 候选筛选：_density_report 热门非 A 仅 CS20/BIO10/MGMT5/DS1/FIN1 共 37 条；本轮取 GaTech 8 条（Robotics、BME、BioE、Biology、Medical Physics、MS Management、BCFM、Economics）。",
 "r343 官网核验：catalog.gatech.edu/programs/<slug>/ 八页全部 200（BCFM 正确 slug 为 building-construction-facility-management-ms）；Bursar Fall 2026 单列 MSROBO $693/$1,627/$1,674、MSBCFM $842/$1,825/$1,878，BME/BioE/Biology/MedPhys/MS Management/Econ 走标准 Graduate 费率 $607/$1,341/$1,379。",
 "r343 建页：8 个 spec 经 detail_render.py + _tpl_detail.html 生成，按 PROGRAMS 现有 url 落盘（不改 url）；_r342_score.py 逐条复核全部 A 11/11。",
 "r343 字段回填：8 条 ddl / lang / test.cls / tui 由「待补」改为官网口径；ddl 仅 Econ 有官网截止（优先 2027-02-01、rolling 至 2027-04-01），其余 7 条按 catalog「Requirements and deadlines are determined by each graduate program」标「官网未披露」。",
 "r343 密度复核：A 98→106（+8），B 220、C 1122→1114，需重做 1342→1334；gatech 重做量 56→48。主文件 1,961,855 字节（mtime 2026-12-02 14:57:23）。",
]
notes = [
 "r343 卡点：GaTech 除 MSCS（明写 February 1）与 Econ（2/1 优先、4/1 滚动）外，其余项目 catalog 均不列截止；department 站点尝试（bme/biosciences/scheller/robotics/bc 的 grad 路径）多 404 → 统一按「官网未披露」终态，不臆造。",
 "r343 卡点：Bursar 专业费率表仅单列 BMED 的「PhD (joint) in Biomedical Eng」（$783/$2,037/$2,096）；MS BME 无单列专业费率，按标准 Graduate 费率回填，已在页面注明。",
 "r343 卡点：catalog 语言页 TOEFL 档为 Overall ≥4.5 / S3.5 / W4 / L4 / R4（疑 TOEFL Essentials 口径），8 条页面统一照录并注明「以官网原文为准」。",
 "r343 结论：GaTech 剩余 48 条重做量中，catalog 可达项目均可复用本轮三源（program 页 + lang + Bursar 费率），下一轮可继续成组推进。",
]
for n in notes:
    if n not in b["blocked_notes"]:
        b["blocked_notes"].append(n)
json.dump(b, open(BASE / "_heartbeat_baseline.json", "w", encoding="utf-8"), ensure_ascii=False, indent=2)
print("baseline r343 ok", b["timestamp"], mt, M.stat().st_size)

led = BASE / "项目库扩充方案与进度台账.md"
txt = led.read_text(encoding="utf-8")
anchor = "## 八、决策层指令"
if "r343 GaTech 八条批次" not in txt:
    entry = (
        "- **r343 GaTech 八条批次（2026-12-02 14:57，8 条）**：全部由 `detail_render.py` 生成、`_density_check` 复核 **A 11/11**（全库 A 98→106）："
        "① MS Robotics 36 学分（六院联合、7785+7741-7743+基础 9+选修 9+Capstone 6，MSROBO 费率 $693/$1,627/$1,674）；"
        "② MS BME 30 学分（Thesis 21+9 / Non-Thesis 30，Fundamental 9+Focus 9+Elective 9）；"
        "③ MS BioE 30 学分（八院联合，配比 3+2 规则、≥24 学分 6000 级）；"
        "④ MS Biology 36 学分（默认 Non-Thesis，BIOL 8901 4/7、8002+8003 2）；"
        "⑤ MS Medical Physics 35 学分（MP 4750/6011/6203/6204/6300/6406/6407/6756/6757 + 8903 或论文）；"
        "⑥ MS Management 30 学分（Management 核心 12+选修 18 / Research 核心 15+选修 15，七学科）；"
        "⑦ MS BCFM 30 学分（核心 15+方向 12+选修 3，或论文 6+BC 7100 3，MSBCFM 费率 $842/$1,825/$1,878）；"
        "⑧ MS Economics 30 学分（ECON 6105/6106/6140/6160 + 12 + 6，GPA 2.70，优先截止 2027-02-01、rolling 至 2027-04-01）。"
        "同轮确认 GaTech 可达通道：`catalog.gatech.edu/programs/<slug>/` 八页 200、BCFM 正确 slug=building-construction-facility-management-ms；"
        "Bursar Fall 2026 专业费率表可成组复用。字段回填 ddl/lang/test/tui 共 32 处；PROGRAMS 1440 / CATD 2817 / VD 1547 不变，"
        "死链 0、node exit 0、`}{` 0、8 页残留（待补/编辑整理/未替换）全 0；主文件 1,961,855 字节。"
        "卡点：7 条截止官网未披露（department grad 路径多 404，不臆造）；MS BME 无单列专业费率按标准 Graduate 计；语言页 TOEFL 档按原文照录。\n"
    )
    txt = txt.replace(anchor, entry + "\n" + anchor, 1)
led.write_text(txt, encoding="utf-8")
print("ledger", led.stat().st_size)
