P04-01: 同時発生の更新規約

This commit is contained in:
Agent Control Runner
2026-10-16 10:02:30 +09:00
parent fb8b7919db
commit 2dde7596a8
9 changed files with 2516 additions and 190 deletions
@@ -1,21 +1,61 @@
# P04-01 current order audit — repair22
# P04-01 order audit — repair29
Source preparation only; tests and S4 native collection **NOT RUN**. No final acceptance or integration. This is the single current seven-domain table; matching machine data is in order-audit.json.
Worker **SOURCE-READY / NOTRUN**: static Read and SHA256 only. No original completion. [CURRENT_STATUS.md](CURRENT_STATUS.md) is canonical for execution status. [order-audit.json](order-audit.json) is the matching structured audit.
| Domain | Normative rule | Current source | Evidence | Approved authority | Pending D05 |
B = `/Users/korizatou114/Projects/TheTree-managed-worktrees/p04-01/.runtime/P04-01/build`.
P = `B/audit-support/p04-r17-full-inputs-r01/product`. Source references below are relative to P, not old deb11300. All1338 product file SHA256 values, function lines and16 handler registrations are recomputed in [REPAIR29_STATIC_SOURCE.json](REPAIR29_STATIC_SOURCE.json).
Kernel `scripts/core/simulation_kernel.gd` SHA256: `341c0c878c4894adbac628d0db6362ff69fc3347bdd9e61e50936e15dc2d1edb`.
Runtime `autoload/simulation_runtime.gd` SHA256: `7f01b2dcdf28bc965c7588173c2dc70054633faf7204b1ac38ba0f4369331b47`.
Root-measured native product `5f6bc11d`; main `9b1a18c1`.
## Actual eleven phases — observed-current
Kernel advance_one_minute:122 defines the order; _run_phase:236 string-sorts handler IDs. Registrations below are Runtime lines366–435 plus operations:1766. Every literal ID begins `simulation_runtime.`. Observations do not approve D05.
1. **APPLY_COMMANDS** — simulation_runtime.commands → _process_tick_commands (registration:369). Previous minute: commands → _process_tick_commands:5743. Operations gate requests current tick abort and returns before Clock changes; otherwise commands apply for minute+1.
2. **TIME_BOUNDARIES** — simulation_runtime.0_weather → _advance_weather (registration:366); simulation_runtime.a_upkeep → _advance_facility_upkeep (registration:368); simulation_runtime.operations → _advance_operations_time (registration:1766). After APPLY: absolute_minute += 1, _sync_calendar_fields, _handle_time_boundaries:254 emits settlement_requested(completed_day) then day_started at00:00, before TIME_BOUNDARIES handlers. Handler order: weather, upkeep, operations. Runtime upkeep:1855; operations:1898 → coordinator _process_minute_boundaries:882: 00:00 upkeep, daily close, 06:00 morning, demand, arrivals (conditional boundaries and early returns).
3. **MANA** — simulation_runtime.mana → _advance_mana (registration:379). Runtime _advance_mana:10694: proxy preflight → mana_network advance → mana_power_projection.apply → MANA_STATE_CHANGED events.
4. **CONSTRUCTION** — simulation_runtime.construction → _advance_construction (registration:384). Construction:8064 follows power and precedes logistics.
5. **LOGISTICS** — simulation_runtime.logistics → _advance_inventory_and_logistics (registration:389). Logistics:8472 precedes completion.
6. **FACILITY_COMPLETION** — simulation_runtime.facilities → _advance_facilities (registration:394). Runtime _advance_facilities:8482: facility_service.advance_one_minute then kitchen. FacilityService _prepare_service_for_tick:853 checks BROKEN, related_facility_operating (RELATED_FACILITY_INACTIVE), power_available (NO_POWER), staff grace. Only ACTIVE services advance (:569). _complete_service:895 → Runtime _complete_service_transaction:11769 → _apply_service_transaction:11785 posts SERVICE_SALE / SERVICE_CASH_SWEEP at the post-increment minute (:11826–11838).
7. **VITALS_AND_ENVIRONMENT** — simulation_runtime.guest_vitals → _advance_guest_vitals (registration:399). Guest vitals:8488 follows completion.
8. **INCIDENTS_AND_EVENTS** — simulation_runtime.authority_incidents → _advance_authority_incidents (registration:409); simulation_runtime.defense → _advance_defense (registration:414); simulation_runtime.relationship_events → _advance_relationship_events (registration:419). String-sorted authority_incidents:8551 → defense:8577 → relationship_events:8615; after completion/charging.
9. **FACILITY_QUEUES** — simulation_runtime.guest_queues → _advance_guest_queues (registration:404). _advance_guest_queues:8502 releases closed queues first (_release_closed_business_queues:12624); closed queues spend no patience (:8516–8517).
10. **AI_DECISIONS** — simulation_runtime.staff_ai → _advance_staff_ai (registration:424). _advance_staff_ai:8658: prune elevator waits, elevators, rescue, staff_service, prune waits, staff_commute (shift handover), staffing sync, cleaning, fatigue, rescue and staffing sync again, then _advance_guest_ai_decisions:8738. DECIDING PLANNED_EXIT → LEAVING; despawn occurs only on later minute (:8760–8762).
11. **PUBLISH_SNAPSHOT** — simulation_runtime.snapshot → _publish_snapshot (registration:374); simulation_runtime.zz_save_checkpoints → _process_save_checkpoints (registration:431). snapshot:12476 then zz_save_checkpoints:4514; persistence follows publication.
## Seven domains
Proofs below are **Root-measured**. R = B/audit-support/p04-raw-collect-r22; I = B/p04-evidence/index.json (schema2). I native_bundle/raw_references/versions/source_map/environment preserve exact C and series bindings. R/MANIFEST.json pins series bytes/SHA256 and relocation; each series retains raw provenance. REPAIR29_STATIC_SOURCE.json also pins R files and I. Source function paths/lines/hashes are in that static manifest.
| Domain | Status / authority | Phase and source function+line | Relative priority | Exact-version proof | Pending |
| --- | --- | --- | --- | --- | --- |
| 閉店 | D-034: direct closure releases waiting requests and continues started service. Approved dependency closure holds progress/payment and preserves reservation/service ID until one completion. | Runtime._advance_facilities; Runtime._advance_guest_queues; Runtime._release_closed_business_queues; FacilityService._prepare_service_for_tick | C dependency/formal and S2a paused-midnight are existing raw candidates. S3 B1 is combined dependency/closure diagnostic only; no power_stop or priority credit. | D-034; D05-P04-DEPENDENCY | Strict power-vs-closure/dependency priority remains unknown; B1 does not approve it. |
| 停電 | BASELINE:183 mana depletion stops facilities. A legitimately power-stopped service must not progress/charge; retain reservation identity and complete once after recovery. This does not approve a simultaneous-cause priority. | Runtime._advance_mana; ManaNetworkService.advance_one_minute; ManaNetworkService._evaluate_component; mana_power_projection.apply; FacilityService._prepare_service_for_tick | S1 existing raw covers reserved staff/EV safety, not a paid service. S4 ONLY supplies power_stop; pending Root execution, no raw/credit yet. S3 B1 excluded. | BASELINE:183; P04-01 safety acceptance | Strict power-vs-closure priority and unspecified EV/cost ordering remain pending. |
| 破壊 | No charge while legitimately failed/stopped and no orphan reservation. Distinguish command destruction before facility processing from late INCIDENTS event destruction after completion; observation is not normative priority approval. | Runtime._process_tick_commands; Runtime._advance_defense; FacilityService._prepare_service_for_tick; FacilityService._fail_service | S3 B4a completion then destruction and B4b next-tick failure/release are existing raw candidates; C remains frozen. | P04-01 safety acceptance; BASELINE:183 (existing fixed registry; no new destruction priority authority) | Any mandatory destruction-vs-completion priority beyond approved sources requires owner decision; current code alone is not authority. |
| 退出 | Leave/abandon releases the owned reservation once; no orphan or duplicate charge. Preserve D-034. Completion, queue release and later normal despawn are distinct observations. | Runtime._execute_leave_facility_queue; Runtime._leave_guest_queue_boundary; Runtime._advance_guest_queues; Runtime._advance_guest_ai_decisions | S3 B2a/B2b/B3 raw completion/leave/patience; B1 normal departure history diagnostic. S4 has no departure trigger at outage/hold. | D-034; P04-01 safety acceptance | Unspecified simultaneous exit/cost priority remains pending; no inferred priority from labels. |
| 課金 | No stopped charge; one sale per completed service and idempotent resend. Reservation consumption, actual sale and payment key must join by service ID and original priceSnapshot. | FacilityService._complete_service; Runtime._complete_service_transaction; Runtime._apply_service_transaction; EconomyService.post | C dependency/recovery, S2a paid midnight and resend, S3 diagnostic completions are existing raw. S4 isolated stop/one recovery sale pending Root. | P04-01 safety acceptance; D05-P04-DEPENDENCY; D05-P04-SHIFT-1800 | Other cost timing/attribution is not supplied or approved here. |
| シフト交代 | Approved [17:59,18:00) work belongs to day staff: complete/pay once at18:00 then switch; night work starts [18:00,18:01). | Runtime._advance_facilities; Runtime._advance_staff_ai; StaffService.advance_one_minute; Runtime._sync_facility_staffing | C actual-native first1080 sale with dynamic PID/transaction joins; S2b no-night1081 and overtime. Paid-midnight filenames do not substitute for C shift completion. | BASELINE:64; BASELINE:67; D05-P04-SHIFT-1800 | Approved shift interval is not reopened; any additional simultaneous-cause priority remains pending. |
| 00:00決算 | A01 approved ownership-prorated upkeep at midnight is retained. One daily close/payroll/upkeep, no duplicate replay/reload; distinguish prior [0,1440) accounting and sale at1440. | Runtime._advance_facility_upkeep; Runtime._advance_operations_time; OperationsCoordinator._process_minute_boundaries; OperationsCoordinator._process_daily_close | C paused-midnight/formal and S2a full raw nonzero payroll/upkeep/service/typed restore are existing candidates. S1/S2b/S3 cannot substitute settlement proof; S4 adds none. | BASELINE:71; BASELINE:72; A01; D05-P04-DEPENDENCY | Unspecified cost/day attribution remains pending; do not reopen A01. |
| 閉店 | approved; D-034, D05-P04-DEPENDENCY | APPLY_COMMANDS / FACILITY_COMPLETION / FACILITY_QUEUES: Runtime _process_tick_commands:5743; FacilityService _prepare_service_for_tick:853; Runtime _release_closed_business_queues:12624 | Command closure before completion; dependency hold during preparation; closed queue release after completion. | I native_bundle C; R/s2a.json; R/s3.json B1 | D05(a) simultaneous reason selection |
| 停電 | observed-current; BASELINE:183, P04-01 safety acceptance | MANA → FACILITY_COMPLETION: Runtime _advance_mana:10694; FacilityService _prepare_service_for_tick:853 | Projection before completion; RELATED chosen before NO_POWER. | R/s4.json; B/p04-s4-native-r28; R/s3.json B1 combined diagnostic | D05(a) |
| 破壊 | pending D05; P04-01 safety acceptance (original); explicit destruction rule pending D05 | APPLY_COMMANDS vs INCIDENTS_AND_EVENTS: Runtime _process_tick_commands:5743; _advance_defense:8577; _apply_defense_outcome_boundary:9804; FacilityService _prepare_service_for_tick:853 | Command destruction before completion; incident destruction after completion: B4a charges25G then destroys in same tick; B4b next-tick failure/release. | R/s3.json B4a/B4b | D05(b); BASELINE:183 is mana depletion, not destruction authority; destruction_stop registry correction only after approval |
| 退出 | pending D05; D-034, P04-01 safety acceptance | APPLY_COMMANDS vs AI_DECISIONS: Runtime _execute_leave_facility_queue:7553; _advance_guest_ai_decisions:8738 | Command exit before completion/charging; AI PLANNED_EXIT after them; despawn later. | R/s3.json B2a/B2b/B3 and B1 departure history | D05(c) |
| 課金 | pending D05; P04-01 safety acceptance, D05-P04-DEPENDENCY, D05-P04-SHIFT-1800 | TIME_BOUNDARIES → FACILITY_COMPLETION: Runtime _advance_facility_upkeep:1855; _complete_service_transaction:11769; _apply_service_transaction:11785; coordinator _process_daily_close:1125 | Upkeep/daily close before sale; post-increment sale timestamp, exclusive close period_end;00:00 sale belongs to new day. | I native_bundle C; R/s2a.json; R/s4.json | D05(d), beyond approved A01 and18:00; timing/attribution mandatory P04, numeric math D04/P05 separate |
| シフト交代 | approved; BASELINE:64, BASELINE:67, D05-P04-SHIFT-1800 | FACILITY_COMPLETION → AI_DECISIONS: Runtime _advance_facilities:8482; _advance_staff_ai:8658; StaffService advance_one_minute:700 | 18:00 completion/payment before shift handover; day staff [17:59,18:00), night [18:00,18:01). | I C first1080 sale joins; R/s2b.json no-night1081/overtime | Already approved; do not re-ask |
| 00:00決算 | approved; BASELINE:71, BASELINE:72, A01, D05-P04-DEPENDENCY | pre-TIME_BOUNDARIES signals → TIME_BOUNDARIES → FACILITY_COMPLETION: Kernel _handle_time_boundaries:254; Runtime _advance_operations_time:1898; coordinator _process_minute_boundaries:882; _process_daily_close:1125 | Midnight signals, then upkeep/close, then completion. | I C paused/formal; R/s2a.json nonzero payroll/upkeep, replay and typed restore | A01 approved ownership-based midnight upkeep not reopened; extra attribution D05(d) |
The full source bodies, actual line numbers, hashes and graph-restore analysis are in REPAIR22_SOURCE_FACTS.json. The existing R17 source relocation contains all1338 product inputs. Existing raw is available in own B; old external paths are provenance only. Source observations do not approve design priorities.
S4 proves isolated NO_POWER caused by the probe calling disconnect_nodes directly, not global mana depletion. Global depletion appears only in B1 combined diagnostic; B1 does not prove isolated power or approve priority. BASELINE:183 is mana depletion, not destruction authority. Current destruction_stop binding is therefore a known authority gap. Checker a61 and registry stay unchanged until approval and normal repair.
S4 captures the normal 960 evaluation outage, 961 held point and 970 recovery after the source-derived ten-minute hold. It keeps the linked kitchen OPEN / network ACTIVE, global mana positive and operator open. It adds no counted condition. B1 remains a combined dependency/closure diagnostic only. Strict power-vs-closure priority is D05 pending/unknown. If priority is mandatory, the owner can approve dependency-first or power-first reason selection while retaining no-charge/hold safety; neither candidate is approved here.
## Cross-cutting safety
REPAIR17–21 documents (listed in order-audit.json) remain untouched historical records and are superseded for current status by this table, CHECKER_PROTOCOL.md, EVIDENCE_COLLECTION.md and REPAIR22_STATUS.md. Prior B1 power credit and blanket final1339 rerun directions are superseded.
- **No charge while paused NO_POWER or RELATED** — original; FACILITY_COMPLETION; FacilityService _prepare_service_for_tick:853, ACTIVE-only gate:569, _complete_service:895. Preparation before advance/completion/payment. Root-measured proof: R/s4.json isolated power; I C and R/s2a.json dependency hold.
- **Double-settlement idempotency** — original; TIME_BOUNDARIES; coordinator _process_daily_close:1125; _day_summaries replay:1127–1130; daily-close:N:1137. Before facility completion. Root-measured proof: I C; R/s2a.json same-boundary replay and separate-PID restore, unchanged accounting.
- **Orphan reservation release** — original; APPLY_COMMANDS / FACILITY_QUEUES; Runtime _execute_leave_facility_queue:7553 (release keys:7565–7569); _leave_guest_queue_boundary:9178; _release_closed_business_queues:12624; _release_closed_business_request:12642. Command release before completion; closed-queue release afterward; closed patience not spent. Root-measured proof: R/s3.json B2a/B2b/B3/B4b; I C; R/s2a.json reservation/service identity and restore.
15 conditions + EV, seven domains, three safety outcomes and30 packages/88 deliveries remain fixed. Original13/88 gains no credit; CurrentAlphaScope and P04 main9b stay frozen. Required Root execution, exact-version binding, support53cb registered rebind, independent review and integration remain pending. A01 and the two approved D05 choices are not reopened.
A01 midnight ownership upkeep, dependency hold and18:00 are already approved; do not re-ask. Authority pins are in I/authority; D05_OWNER_APPROVAL.json approves only the two named D05 choices. Remaining candidate choices and their side effects are in [D05_REMAINING_ORDER_CANDIDATE.md](D05_REMAINING_ORDER_CANDIDATE.md). P04 timing/attribution remains mandatory and separate from D04/P05 numeric cost math. Unknown mandatory rules remain pending.
Original credit **13/88 unchanged**,15 conditions + EV, seven domains, three safety outcomes and30/88 denominator unchanged. P04 remains incomplete. Root execution history and remaining Runner steps are in CURRENT_STATUS.md.