Files
TheTree_mock/docs/plans/original-completion-2026-10-02/checkpoints/current-phase-diagnostic-r338-r02/051-thetree-integrate-phase-r339.py
T

29 lines
4.5 KiB
Python

# coding: utf-8
from pathlib import Path
import json,hashlib,shutil,datetime
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';D=R/'docs/plans/original-completion-2026-10-02';O=A/'p23-02-current-phase-integration-r339';(O/'before').mkdir(parents=True)
N=['IMPLEMENTATION_PLAN.md','PROGRESS_INTEGRATION.md','work_packages.json','progress_snapshot.json']
for n in N:shutil.copyfile(D/n,O/'before'/n)
review=A/'p23-02-current-phase-diagnostic-actual-independent-review-r338-r02.json';v=json.loads(review.read_text());assert v['finite_diagnostic_accepted'] and not v['blockers']
report=json.loads((A/'p23-02-current-phase-diagnostic-r338-r02/measurement/report.json').read_text());assert report['passed'] and report['checks']==17
ts=datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).isoformat()
summary='r338-r02で現在未選定r333/library334の包含診断1回を独立有限受理。17/0、after647全11487732bytes原oracle一致、stage/source/default保持。enum再照合により旧phase3は建設・4は物流・5は施設完了と訂正。現在包含construction118776us/crosslinks118334us、logistics88107us/tick87311us、Guest候補投影564197us、publish76085us。次の修正対象は整合検証と物流実行。施設決済0calls・在庫期限348usを根拠なく優先しない。純CPU・改善比較・性能受入・採用・単位完成ではない。'
work=json.loads((D/'work_packages.json').read_text());before=json.loads(json.dumps(work));p=next(p for p in work if p['id']=='P23');u=next(u for u in p['remaining_deliverables'] if u['id']=='P23-02')
p['current_summary']+='\n'+summary;p['updated_at_jst']=ts;u['progress_summary']+='\n'+summary;u['updated_at_jst']=ts
u['current_phase_diagnostic_r339']={'review':str(review.relative_to(R)),'sha256':hashlib.sha256(review.read_bytes()).hexdigest(),'scope':'finite current instrumented whole647 only; no acceptance','next_scope':'construction infrastructure crosslink validation and supply logistics tick','unit_accepted':False,'performance_accepted':False}
u['evidence'].append({'path':str(review.relative_to(R)),'sha256_at_integration':hashlib.sha256(review.read_bytes()).hexdigest(),'scope':'P23-02 finite current r333/library334 phase diagnostic only; no performance/adoption/unit/Windows acceptance','linked_at_jst':ts})
(D/'work_packages.json').write_text(json.dumps(work,ensure_ascii=False,indent=2)+'\n')
snap=json.loads((D/'progress_snapshot.json').read_text());snap['current_phase_diagnostic_r339']={'plan_id':'P23-02','candidate':'r333/library334','summary':summary,'report':str((A/'p23-02-current-phase-diagnostic-r338-r02/measurement/report.json').relative_to(R)),'review':str(review.relative_to(R)),'checkpoint':'docs/plans/original-completion-2026-10-02/checkpoints/current-phase-diagnostic-r338-r02/manifest.json','formally_completed_added':0,'all_original17_unaccepted':True,'production_r32_preserved':True,'selected_parent_r274_library275_preserved':True,'manual_modifier_wheel_drag_deferred_not_waived':True,'only_windows_C08_X8_blocked':True,'updated_at_jst':ts};(D/'progress_snapshot.json').write_text(json.dumps(snap,ensure_ascii=False,indent=2)+'\n')
for n in N[:2]:
text=(D/n).read_text();heading,rest=text.split('\n',1);(D/n).write_text(heading+'\n\n## 現在版のフェーズ診断 r338-r02 / r339\n\n'+summary+' 正式9/着手19/予定60、30パッケージ/88成果、部分点なし、原9横断8すべて未受入。Windows C08/X8だけblock、手動操作延期非免除。\n\n詳細:[CURRENT_PHASE_DIAGNOSTIC_R338_R339.md](execution/CURRENT_PHASE_DIAGNOSTIC_R338_R339.md)\n'+rest)
# Exact original scope and all non-target units/packages invariant.
for old,new in zip(before,work):
assert old['id']==new['id']
if old['id']!='P23':assert old==new
for a,b in zip(old['remaining_deliverables'],new['remaining_deliverables']):
for k in ['id','work','acceptance','state']:assert a[k]==b[k]
if a['id']!='P23-02':assert a==b
units=[u for p in work for u in p['remaining_deliverables']];counts={s:sum(u['state']==s for u in units) for s in ['completed','in_progress','planned']};assert len(work)==30 and len(units)==88 and counts=={'completed':9,'in_progress':19,'planned':60}
(O/'author-scope-invariants.json').write_text(json.dumps({'passed':True,'packages':30,'units':88,'counts':counts,'other_29_packages_87_units_exact':True,'all_original_work_acceptance_state_preserved':True,'formal_completed_added':0,'new_game_execution_count':1,'new_full_regression_count':0},indent=2)+'\n')
print(json.dumps(counts))