55 lines
7.3 KiB
Python
55 lines
7.3 KiB
Python
from pathlib import Path
|
|
import json,hashlib,shutil,importlib.util
|
|
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';P=A/'p04-paid-shift-midnight-prep-r01';assert not P.exists();P.mkdir();old=A/'p04-approved-dependency-midnight-prep-r01/approved-dependency-midnight.gd';s=old.read_text();s=s.replace('var _first_summary: Dictionary = {}','var _first_summary: Dictionary = {}\nvar _paid_reception_id: StringName = &""\nvar _expected_daily_wages := 0')
|
|
needle='\t_original_price = definition.base_price';assert s.count(needle)==1;s=s.replace(needle,needle+'\n\t_setup_paid_reception()')
|
|
needle='\t_clock.advance_minutes(queue_at - _clock.absolute_minute)';assert s.count(needle)==1;s=s.replace(needle,'''\t_clock.advance_minutes(1079 - _clock.absolute_minute)
|
|
_observe("paid-before-handover-17-59")
|
|
_expect(_runtime.facility_service.get_instance(_paid_reception_id).active_staff_ids.has(&"staff_akane"), "normally hired daytime receptionist physically attends before original DAY boundary")
|
|
_clock.register_tick_handler(_clock.TickPhase.FACILITY_COMPLETION, &"zz.p04.paid.before-handover", func(minute: int):
|
|
if minute == 1080:
|
|
_observe("paid-at-completion-before-handover-18-00")
|
|
_expect(_runtime.facility_service.get_instance(_paid_reception_id).active_staff_ids.has(&"staff_akane"), "last DAY interval retains actual hired worker before handover")
|
|
)
|
|
_clock.advance_one_minute(); _observe("paid-after-handover-18-00")
|
|
_expect(not _runtime.facility_service.get_instance(_paid_reception_id).active_staff_ids.has(&"staff_akane"), "daytime hired receptionist is removed after completion phase")
|
|
_clock.advance_minutes(queue_at - _clock.absolute_minute)
|
|
_expect(_runtime.facility_service.get_instance(_paid_reception_id).active_staff_ids.has(&"staff_bardo"), "normally hired NIGHT replacement physically arrives")''')
|
|
needle='\t_first_summary = _runtime.operations_coordinator.get_day_summary(1).duplicate(true)';assert s.count(needle)==1;s=s.replace(needle,needle+'''
|
|
_expect(_expected_daily_wages > 0 and int(_first_summary[&"settlement"][&"new_wages_total"]) == _expected_daily_wages and int(_first_summary[&"settlement"][&"paid_total"]) == _expected_daily_wages, "real midnight settles full existing catalog wages once")
|
|
var wage_rows := 0
|
|
for receipt: Dictionary in _receipts:
|
|
for row: Dictionary in receipt[&"rows"]:
|
|
if row[&"category"] == &"WAGE":
|
|
wage_rows += 1
|
|
_expect(receipt[&"minute"] == 1440 and int(row[&"amount"]) == _expected_daily_wages and row[&"credit_account"] == &"PLAYER_CASH", "one real payroll transaction debits actual player cash at midnight")
|
|
_expect(wage_rows == 1, "exactly one nonzero payroll ledger row at midnight")''')
|
|
s=s.replace('if row[&"category"] == &"SERVICE_SALE":','if row[&"category"] == &"SERVICE_SALE" and row[&"source_entity_id"] == _facility_id and row[&"credit_account"] == StringName("GUEST_WALLET:" + String(_guest_id)):')
|
|
pos=s.index('func _reopen_dependency(');s=s[:pos]+'''func _setup_paid_reception() -> void:
|
|
var definition: FacilityDefinition = _runtime.definition_registry.get_facility(&"reception")
|
|
_expect(_cmd(&"build_facility", {&"definition_id": &"reception", &"origin": Vector3i(2, 0, WorldService.LAYER_FRONT)}).is_success(), "paid public reception construction")
|
|
_clock.advance_minutes(definition.build_minutes)
|
|
for instance: FacilityInstance in _runtime.facility_service.get_instances():
|
|
if instance.definition_id == &"reception": _paid_reception_id = instance.instance_id
|
|
_expect(not _paid_reception_id.is_empty(), "reception completes using unchanged construction duration")
|
|
var catalog: Dictionary = JSON.parse_string(FileAccess.get_file_as_string("res://data/characters/mvp_staff_candidates.json"))
|
|
for candidate_id: StringName in [&"staff_akane", &"staff_bardo"]:
|
|
var original_wage := -1
|
|
for row: Dictionary in catalog["entries"]:
|
|
if StringName(row["id"]) == candidate_id: original_wage = int(row["daily_wage"])
|
|
_expect(original_wage > 0 and _cmd(&"hire_staff_candidate", {&"candidate_id": candidate_id}).is_success(), "public hire of existing paid candidate " + String(candidate_id))
|
|
var worker: StaffRuntime = _runtime.staff_service.get_staff(candidate_id)
|
|
_expect(worker != null and worker.get_effective_daily_wage() == original_wage, "existing catalog wage unchanged for " + String(candidate_id))
|
|
_expected_daily_wages += original_wage
|
|
_expect(_cmd(&"set_staff_work_assignment", {&"staff_id": candidate_id, &"template_id": &"DAY" if candidate_id == &"staff_akane" else &"NIGHT", &"facility_id": _paid_reception_id}).is_success(), "ordinary recurring paid DAY or NIGHT assignment")
|
|
|
|
''' + s[pos:]
|
|
needle='\tvar workers: Array = []';s=s.replace(needle,'''\tvar paid: Array = []
|
|
for paid_id: StringName in [&"staff_akane", &"staff_bardo"]:
|
|
var hired: StaffRuntime = _runtime.staff_service.get_staff(paid_id)
|
|
if hired != null: paid.append(hired.create_snapshot())
|
|
var reception: FacilityInstance = _runtime.facility_service.get_instance(_paid_reception_id)
|
|
_observations.append({&"label": label + "-paid-actors", &"minute": _clock.absolute_minute, &"paid_staff": paid, &"paid_reception": reception.create_snapshot() if reception != null else {}, &"expected_catalog_wages": _expected_daily_wages})
|
|
''' + needle)
|
|
s=s.replace('P04-01 owner-approved dependency closure across real midnight; unchanged service and reservations resume with one original-price payment; public NIGHT actors with controlled inherited cook setup; typed same-process replay only; not formal SaveService/OS/Windows/whole acceptance','P04-01 existing paid catalog DAY/NIGHT reception handover and real nonzero payroll with approved dependency closure across midnight; catalog values are observed inputs, not approval of final product balancing; restaurant setup remains controlled; typed same-process replay only; no formal SaveService/OS/Windows/whole acceptance')
|
|
Q=P/'paid-shift-midnight.gd';Q.write_text(s);base=A/'p04-approved-dependency-midnight-native-r01.py';w=base.read_text().replace('p04-approved-dependency-midnight-native-r01','p04-paid-shift-midnight-native-r01').replace('p04-approved-dependency-midnight-prep-r01','p04-paid-shift-midnight-prep-r01').replace('/approved-dependency-midnight.gd','/paid-shift-midnight.gd').replace('P04-01 approved dependency pause/resume across midnight on current source','P04-01 existing catalog paid DAY/NIGHT actors with actual nonzero payroll and dependency pause/resume across midnight on current source');W=A/'p04-paid-shift-midnight-native-r01.py';compile(w,str(W),'exec');W.write_text(w);shutil.copyfile(A/'p04-approved-dependency-midnight-prep-r01/SOURCE_MAP.json',P/'SOURCE_MAP.json');floor=1024**3+Path('/Applications/Godot.app/Contents/MacOS/Godot').stat().st_size+136*1024**2;free=shutil.disk_usage(A).free;assert free>=floor;sha=lambda f:hashlib.sha256(f.read_bytes()).hexdigest();(P/'ADMISSION.json').write_text(json.dumps({'scope':'Root QA only; existing catalog wage inputs, no production-value approval; no product/test source edits','base_probe_sha256':sha(old),'probe_sha256':sha(Q),'wrapper_sha256':sha(W),'catalog_sha256':sha(R/'data/characters/mvp_staff_candidates.json'),'existing_candidates':['staff_akane','staff_bardo'],'source_refs':1338,'estimated_seconds':90,'free_before':free,'required_free':floor,'formal_original_credit':0},indent=2)+'\n');print('existing-catalog paid handover and midnight probe prepared; no engine yet')
|