From 6d1dd508fad1f5bc14964f332822dbc548818637 Mon Sep 17 00:00:00 2001 From: Takeshi Date: Mon, 19 Oct 2026 01:46:22 +0900 Subject: [PATCH] Pin original global mana-stop scope and existing stop chains --- .../p06-02-root-original-scope-20261019.json | 339 ++++++++++++++++++ 1 file changed, 339 insertions(+) create mode 100644 docs/plans/original-completion-2026-10-02/execution/p06-02-root-original-scope-20261019.json diff --git a/docs/plans/original-completion-2026-10-02/execution/p06-02-root-original-scope-20261019.json b/docs/plans/original-completion-2026-10-02/execution/p06-02-root-original-scope-20261019.json new file mode 100644 index 0000000..a95271e --- /dev/null +++ b/docs/plans/original-completion-2026-10-02/execution/p06-02-root-original-scope-20261019.json @@ -0,0 +1,339 @@ +{ + "type": "Root original-scope clarification for independent review; not gameplay acceptance", + "source_head": "6784ea5f08411659a4e955fd96e2b253f505e713", + "audit_base": "d9262a71f45b39c53115a4878f4c6a2c861dfac5", + "original_snapshot_pin_verified": true, + "source_pins": { + "docs/traceability/original/BASELINE.txt": { + "sha256": "75e4bdbdeb379c9269553f0c776bdb9cc96e01f2d6aa5ca650d132c63a8aeb1a", + "identical_to_audit_base": true + }, + "scripts/mana/mana_power_projection.gd": { + "sha256": "2026467960e857349bcb18fb97b7753189be5f2de2be91a17e73e90146eba69e", + "identical_to_audit_base": true + }, + "scripts/facility/facility_instance.gd": { + "sha256": "0c6aa493f3299611e05dd26aa429dda8cf7b5c479e4d09632036fb862f79a324", + "identical_to_audit_base": true + }, + "scripts/environment/facility_cleaning_bridge.gd": { + "sha256": "f0abf23351c46b47e33141daea753ab776d71bd68f09ccf7c1a37879fee0d25e", + "identical_to_audit_base": true + }, + "autoload/simulation_runtime.gd": { + "sha256": "45514aea9367ff678f4dc05166bb9b58121f240d4b5565edeb7ab258e3ded8e0", + "identical_to_audit_base": true + } + }, + "findings": [ + { + "id": "P06-ROOT-01", + "fact": "Original BASELINE line183 states mana depletion stops all facilities; it does not specify a separate cleaning-target power gate or numeric consumer demand for infirmary/cleaning room.", + "implication": "Do not invent per-facility demand or classify missing consumer alone as failure of global depletion." + }, + { + "id": "P06-ROOT-02", + "fact": "ManaPowerProjection iterates all facilities; available = reserve > 0 and supplied, where no consumer permits supplied but cannot override reserve0.", + "implication": "Global reserve0 powers down zero-demand facilities too. Functional application/order/save behavior still requires current runtime evidence." + }, + { + "id": "P06-ROOT-03", + "fact": "FacilityInstance requires OPEN/DEGRADED for OPERATING; cleaning can_dispatch/task_can_work require the assigned cleaning room OPERATING; rescue destination/arrival require infirmary OPERATING.", + "implication": "Static stop chain exists for global depletion; no proof of complete tick timing, patient preservation, or save restart is inferred." + }, + { + "id": "P06-ROOT-04", + "fact": "Natural arrival PHASE_CAPTURE returns capacity0 when mana<=0. Direct spawn_guest executor is separately registered.", + "implication": "Need trace the ordinary user-reachable path and admitted transaction order before declaring direct executor a normal-play outage bypass; lack of proof is not proof of no bypass." + } + ], + "unresolved": [ + "Current runtime tests for global reserve0 cleaning/rescue/admission and save/restart", + "Whether any source or actual approved amendment requires target-local outage to halt cleaning when the cleaning room remains powered", + "Natural mana depletion requires approved finite mana contract; no numeric values inferred", + "Warp actual implementation/definition remains P14-02 dependency", + "All seven P06 domains whole-unit acceptance and independent review remain incomplete" + ], + "excerpts": [ + { + "path": "docs/traceability/original/BASELINE.txt", + "start": 173, + "end": 190, + "lines": [ + " * **物流:** 厨房(表層飲食店の裏)、倉庫、清掃員室、医務室。", + " * **特殊:** 覗き部屋(VIP/浴場/風俗の裏限定・裏通路を寸断)、地下牢、マナ炉。", + "## 8.4 動線・インフラ設備", + " * **垂直移動:** 蔓の昇降機(表・客用)、業務用EV(裏・高速)、階段、マナワープ。", + " * **通路:** 客用通路、裏通路、従業員ドア(表と裏を接続)。", + "## 8.5 施設マイクロマネジメント", + "LvUPで価格設定(ぼったくり設定含む)、食材ランク、風呂の混浴設定、風俗のハードプレイ設定、カジノのイカサマ率設定などが解禁される。", + "# 9. 経済システムと関連する施設詳細仕様書", + "## 9.1 通貨とリソース", + " * **資金 (Gold):** 表の金と裏の金。", + " * **マナ (Mana):** 施設維持エネルギー。枯渇すると全館機能停止。", + " * **資材 (Materials):** 建設・修理素材。", + "## 9.2 収益と支出", + " * **収益 (表):** 宿泊料、飲食売上。", + " * **収益 (裏):** 性風俗、カジノ、脅迫金、人身売買。", + " * **支出:** 人件費、維持費、仕入れ原価、闇銀行への借金返済、世界樹ランク税(上納金)。", + "## 9.3 経済関連施設", + " * **受付/精算所:** ロビーに設置。処理が遅いと機会損失。" + ] + }, + { + "path": "scripts/mana/mana_power_projection.gd", + "start": 3, + "end": 29, + "lines": [ + "## Derived power conditions for the Runtime-owned facility network.", + "## Does not change durability, operator policy, dependency or suspension status.", + "## A missing consumer denotes a facility with no network consumption; the reserve", + "## still gates it. Runtime must register every positive-demand consumer first.", + "static func apply(facilities: FacilityService, network: ManaNetworkService, reserve: int, minute: int) -> Dictionary:", + "\tif facilities == null or network == null or reserve < 0 or minute < 0:", + "\t\treturn {&\"ok\": false, &\"code\": &\"INVALID_POWER_CONTEXT\"}", + "\tvar changed: Array[StringName] = []", + "\tfor facility: FacilityInstance in facilities.get_instances():", + "\t\tvar node := network.get_node(facility.instance_id)", + "\t\tvar supplied := node.is_empty() or int(node.get(&\"state\", ManaNetworkService.ConsumerState.NO_POWER)) in [ManaNetworkService.ConsumerState.ACTIVE, ManaNetworkService.ConsumerState.DEGRADED]", + "\t\t# Preserve the existing construction-to-first-evaluation contract. An", + "\t\t# unevaluated node is not an observed outage; reserve zero still wins.", + "\t\tif not node.is_empty() and &\"awaiting_evaluation\" in node.get(&\"state_reasons\", []):", + "\t\t\tsupplied = facility.power_available", + "\t\tvar available := reserve > 0 and supplied", + "\t\tvar reasons: Array[StringName] = facility.degraded_reasons.duplicate()", + "\t\treasons.erase(&\"MANA_BROWNOUT\")", + "\t\tif reserve > 0 and not node.is_empty() and int(node.get(&\"state\", -1)) == ManaNetworkService.ConsumerState.DEGRADED:", + "\t\t\treasons.append(&\"MANA_BROWNOUT\")", + "\t\tif available == facility.power_available and reasons == facility.degraded_reasons:", + "\t\t\tcontinue", + "\t\tvar result := facilities.set_operational_status(facility.instance_id, {&\"power_available\": available, &\"degraded_reasons\": reasons}, minute)", + "\t\tif not result.is_success():", + "\t\t\treturn {&\"ok\": false, &\"code\": &\"POWER_PROJECTION_FAILED\", &\"facility_id\": facility.instance_id}", + "\t\tchanged.append(facility.instance_id)", + "\treturn {&\"ok\": true, &\"depleted\": reserve == 0, &\"changed_facilities\": changed}" + ] + }, + { + "path": "scripts/facility/facility_instance.gd", + "start": 188, + "end": 238, + "lines": [ + "func evaluate_state(absolute_minute: int) -> bool:", + "\tif durability <= 0:", + "\t\tsuspension_reason = &\"DESTROYED\"", + "\tvar next_reasons: Array[StringName] = []", + "\tvar next_state := State.OPEN", + "\tif durability <= 0:", + "\t\tnext_reasons.append(&\"BROKEN\")", + "\t\tnext_state = State.BROKEN", + "\tif not access_available:", + "\t\tnext_reasons.append(&\"NO_ACCESS\")", + "\t\tif next_state > State.NO_ACCESS:", + "\t\t\tnext_state = State.NO_ACCESS", + "\tif not power_available:", + "\t\tnext_reasons.append(&\"NO_POWER\")", + "\t\tif next_state > State.NO_POWER:", + "\t\t\tnext_state = State.NO_POWER", + "\tif active_staff_ids.size() < staff_min:", + "\t\tnext_reasons.append(&\"NO_STAFF\")", + "\t\tif next_state > State.NO_STAFF:", + "\t\t\tnext_state = State.NO_STAFF", + "\tif not operator_open:", + "\t\tnext_reasons.append(&\"CLOSED_BY_OPERATOR\")", + "\t\tif next_state > State.CLOSED:", + "\t\t\tnext_state = State.CLOSED", + "\tif not is_within_opening_hours(absolute_minute):", + "\t\tnext_reasons.append(&\"OUTSIDE_OPENING_HOURS\")", + "\t\tif next_state > State.CLOSED:", + "\t\t\tnext_state = State.CLOSED", + "\tif durability > 0 and durability < DEGRADED_DURABILITY_THRESHOLD:", + "\t\tnext_reasons.append(&\"LOW_DURABILITY\")", + "\t\tif next_state > State.DEGRADED:", + "\t\t\tnext_state = State.DEGRADED", + "\tfor reason: StringName in degraded_reasons:", + "\t\tif not next_reasons.has(reason):", + "\t\t\tnext_reasons.append(reason)", + "\t\tif next_state > State.DEGRADED:", + "\t\t\tnext_state = State.DEGRADED", + "\tif not related_facility_operating:", + "\t\tnext_reasons.append(&\"RELATED_FACILITY_INACTIVE\")", + "\t\tnext_state = mini(next_state, State.CLOSED) as State", + "\tif not suspension_reason.is_empty():", + "\t\tnext_reasons.append(suspension_reason)", + "\t\tnext_state = State.BROKEN", + "\tvar next_operation := OperationState.INACTIVE", + "\tif not suspension_reason.is_empty():", + "\t\tnext_operation = OperationState.SUSPENDED", + "\telif next_state in [State.OPEN, State.DEGRADED]:", + "\t\tnext_operation = OperationState.OPERATING", + "\tvar changed := state != next_state or operation_state != next_operation", + "\toperation_state = next_operation", + "\tstate = next_state" + ] + }, + { + "path": "scripts/environment/facility_cleaning_bridge.gd", + "start": 17, + "end": 35, + "lines": [ + "func can_dispatch(worker: StaffRuntime) -> bool:", + "\tif worker == null or worker.role_id != &\"cleaner\": return false", + "\tvar room: FacilityInstance = _runtime.facility_service.get_instance(worker.assigned_facility_id)", + "\treturn room != null and room.definition_id == &\"cleaning_room\" and room.operation_state == FacilityInstance.OperationState.OPERATING and _runtime.staff_commute.is_present(worker, room)", + "", + "func task_can_work(task: StaffTask, worker: StaffRuntime) -> bool:", + "\tif task == null or worker == null or not is_deployed(worker, _runtime.facility_service.get_instance(worker.assigned_facility_id), _runtime.staff_service): return false", + "\tif task.state == StaffTask.State.WORKING and (worker.current_cell != task.target_cell or not _runtime.path_service.has_cell(task.target_cell) or _runtime.is_staff_in_transit(worker.staff_id)): return false", + "\tvar room: FacilityInstance = _runtime.facility_service.get_instance(worker.assigned_facility_id)", + "\treturn room.operation_state == FacilityInstance.OperationState.OPERATING and _runtime.facility_service.has_instance(task.target_entity_id) and not _runtime.facility_cleanliness.get_facility(task.target_entity_id).is_empty()", + "", + "func tick(minute: int) -> void:", + "\tvar pending: Dictionary = {}", + "\tfor task: StaffTask in _runtime.staff_service.get_tasks():", + "\t\tif task.task_type != TASK_TYPE or task.is_terminal(): continue", + "\t\tvar worker: StaffRuntime = _runtime.staff_service.get_staff(task.assigned_staff_id)", + "\t\tif not _runtime.facility_service.has_instance(task.target_entity_id) or (worker != null and not task_can_work(task, worker)):", + "\t\t\t_runtime.staff_service.cancel_task(task.task_id, &\"CLEANING_UNAVAILABLE\", minute)", + "\t\t\tcontinue" + ] + }, + { + "path": "autoload/simulation_runtime.gd", + "start": 2856, + "end": 2882, + "lines": [ + "func _operations_arrival_boundary(", + "\tpayload: Dictionary,", + "\tphase: StringName,", + "\ttoken: Variant", + ") -> Dictionary:", + "\tif phase == OperationsCoordinator.PHASE_CAPTURE:", + "\t\tvar captured := _capture_operations_external_state()", + "\t\tvar population_cap := (", + "\t\t\tint(operations_coordinator.get_config().get(&\"population_cap\", 0))", + "\t\t\tif operations_coordinator != null else 0", + "\t\t)", + "\t\treturn {", + "\t\t\t&\"ok\": not captured.is_empty(),", + "\t\t\t&\"token\": captured,", + "\t\t\t&\"capacity_remaining\": maxi(population_cap - guest_service.guest_count(), 0) if int(_state.get_resource(&\"mana\")) > 0 and weather.permits_new_arrivals() else 0,", + "\t\t}", + "\tif phase == OperationsCoordinator.PHASE_VALIDATE:", + "\t\treturn {", + "\t\t\t&\"ok\": token is Dictionary and not token.is_empty() \\", + "\t\t\t\tand _operations_arrival_payload_is_valid(payload),", + "\t\t\t&\"token\": token,", + "\t\t}", + "\tif phase == OperationsCoordinator.PHASE_APPLY:", + "\t\treturn _apply_operations_arrivals(payload, token)", + "\tif phase == OperationsCoordinator.PHASE_ROLLBACK:", + "\t\treturn {&\"ok\": _restore_operations_external_state(token)}", + "\treturn {&\"ok\": false}" + ] + }, + { + "path": "autoload/simulation_runtime.gd", + "start": 13065, + "end": 13129, + "lines": [ + "func _rescue_destination(patient_cell: Vector3i) -> Dictionary:", + "\tvar best := {}", + "\tvar distance := 2147483647", + "\tfor clinic: FacilityInstance in facility_service.get_instances():", + "\t\tif clinic.definition_id != &\"infirmary\" or clinic.operation_state != FacilityInstance.OperationState.OPERATING:", + "\t\t\tcontinue", + "\t\tvar cells := {clinic.origin: true}", + "\t\tfor cell: Vector3i in clinic.occupied_cells:", + "\t\t\tfor delta in [Vector3i.LEFT, Vector3i.RIGHT, Vector3i.UP, Vector3i.DOWN]:", + "\t\t\t\tcells[cell + delta] = true", + "\t\tvar ordered := cells.keys()", + "\t\tordered.sort_custom(func(a: Vector3i, b: Vector3i): return a.y < b.y if a.y != b.y else a.x < b.x)", + "\t\tfor cell: Vector3i in ordered:", + "\t\t\tif cell.z != WorldService.LAYER_BACK:", + "\t\t\t\tcontinue", + "\t\t\tvar route := path_service.find_backyard_path(patient_cell, cell, true)", + "\t\t\tif not route.is_empty() and route.size() < distance:", + "\t\t\t\tdistance = route.size()", + "\t\t\t\tbest = {&\"facility_id\": clinic.instance_id, &\"cell\": cell}", + "\treturn best", + "", + "func _handle_rescue_arrival(task: StaffTask, carrier: StaffRuntime, minute: int) -> bool:", + "\tif task.task_type == CleaningBridge.TASK_TYPE:", + "\t\treturn carrier.current_cell == task.target_cell and cleaning_bridge.task_can_work(task, carrier)", + "\tif task.task_type not in [&\"rescue_pickup\", &\"rescue_transport\"]:", + "\t\treturn true", + "\tvar patient := staff_service.get_staff(task.target_entity_id)", + "\tif patient == null or patient.state != StaffRuntime.State.INCAPACITATED or carrier.current_cell != task.target_cell:", + "\t\treturn false", + "\tif task.task_type == &\"rescue_transport\":", + "\t\tvar clinic := facility_service.get_instance(task.rescue_facility_id)", + "\t\treturn clinic != null and clinic.operation_state == FacilityInstance.OperationState.OPERATING and patient.current_cell == carrier.current_cell", + "\tif patient.current_cell != carrier.current_cell:", + "\t\treturn false", + "\tvar destination := _rescue_destination(patient.current_cell)", + "\tif destination.is_empty():", + "\t\treturn false", + "\ttask.task_type = &\"rescue_transport\"", + "\ttask.rescue_facility_id = destination[&\"facility_id\"]", + "\ttask.target_cell = destination[&\"cell\"]", + "\ttask.state = StaffTask.State.MOVING", + "\ttask.state_changed_at = minute", + "\t_publish_actor_event(&\"STAFF_RESCUE_PICKED_UP\", &\"staff_service\", [patient.staff_id, carrier.staff_id], {&\"facility_id\": task.rescue_facility_id})", + "\treturn false", + "", + "func _advance_staff_rescue(minute: int) -> void:", + "\tfor task: StaffTask in staff_service.get_tasks():", + "\t\tif task.task_type not in [&\"rescue_pickup\", &\"rescue_transport\"] or task.is_terminal():", + "\t\t\tcontinue", + "\t\tvar patient := staff_service.get_staff(task.target_entity_id)", + "\t\tvar carrier := staff_service.get_staff(task.assigned_staff_id)", + "\t\tvar invalid := patient == null or patient.state != StaffRuntime.State.INCAPACITATED", + "\t\tif not task.assigned_staff_id.is_empty():", + "\t\t\tinvalid = invalid or carrier == null or not carrier.can_take_shift() or carrier.current_task_id != task.task_id", + "\t\tif task.task_type == &\"rescue_transport\":", + "\t\t\tvar clinic := facility_service.get_instance(task.rescue_facility_id)", + "\t\t\tinvalid = invalid or carrier == null or clinic == null or clinic.operation_state != FacilityInstance.OperationState.OPERATING", + "\t\t\tif patient != null and carrier != null:", + "\t\t\t\tinvalid = invalid or patient.current_cell != carrier.current_cell", + "\t\tif invalid:", + "\t\t\tif carrier != null and elevators.get_actor_trip(_staff_path_actor_id(carrier.staff_id)).get(&\"state\", &\"\") == PathService.ELEVATOR_REQUEST_BOARDED:", + "\t\t\t\tcontinue # Keep the pair aboard until a real or emergency landing.", + "\t\t\tstaff_service.cancel_task(task.task_id, &\"RESCUE_INTERRUPTED\", minute)", + "\t\t\tif patient != null: elevators.cancel_actor(_staff_path_actor_id(patient.staff_id))", + "\t\t\tif carrier != null: elevators.cancel_actor(_staff_path_actor_id(carrier.staff_id))" + ] + }, + { + "path": "autoload/simulation_runtime.gd", + "start": 8685, + "end": 8703, + "lines": [ + "\t_advance_staff_rescue(absolute_minute)", + "\tstaff_service.advance_one_minute(absolute_minute)", + "\t_prune_expired_staff_elevator_waits(absolute_minute)", + "\tstaff_commute.tick(absolute_minute)", + "\t_sync_facility_staffing(absolute_minute)", + "\tcleaning_bridge.tick(absolute_minute)", + "\tfor task: StaffTask in staff_service.get_tasks():", + "\t\tif task.state == StaffTask.State.RESERVED:", + "\t\t\tif task.state_changed_at < absolute_minute:", + "\t\t\t\ttask.begin_moving(task.state_changed_at)", + "\t\telif task.state == StaffTask.State.WORKING and task.task_type == CleaningBridge.TASK_TYPE:", + "\t\t\t# Only cleaning is deferred from StaffService to these attendance and", + "\t\t\t# dependency checks. Other tasks already progressed once this minute.", + "\t\t\tif task.state_changed_at >= absolute_minute or not cleaning_bridge.task_can_work(task, staff_service.get_staff(task.assigned_staff_id)):", + "\t\t\t\tcontinue", + "\t\t\tvar work_units := CleaningBridge.work_units_per_minute(staff_service.get_staff(task.assigned_staff_id))", + "\t\t\tstaff_service.progress_task(task.task_id, work_units, absolute_minute)", + "\tfor staff: StaffRuntime in staff_service.get_staff_members():", + "\t\tif absolute_minute % 30 != 0:" + ] + } + ], + "product_edits": 0, + "tests_run": 0, + "unit_accepted": false, + "original_units": 88, + "formal_completed": 17 +}