Preserve reviewed native hot-loop candidate and finite acceptance evidence

This commit is contained in:
Takeshi
2026-10-12 13:08:08 +09:00
parent 58a3534bf9
commit 6f91d35667
74 changed files with 19858 additions and 0 deletions
@@ -0,0 +1,56 @@
{
"plan": [
[
"compile-062",
[
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"-c",
"-std=c++17",
"-isystem",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/include",
"-isystem",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/gen/include",
"-Wall",
"-Wextra",
"-Werror",
"-fexceptions",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-O3",
"-fPIC",
"-DMACOS_ENABLED",
"-DUNIX_ENABLED",
"-DTHREADS_ENABLED",
"-DDEBUG_ENABLED",
"-DNDEBUG",
"-DGDEXTENSION",
"-I/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp"
]
],
[
"link",
[
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-Wl,-S",
"-Wl,-x",
"-Wl,-dead_strip",
"-shared",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a"
]
]
]
}
@@ -0,0 +1,49 @@
{
"pid": 34717,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"-c",
"-std=c++17",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/include",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/gen/include",
"-Wall",
"-Wextra",
"-Werror",
"-fexceptions",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-O3",
"-fPIC",
"-DMACOS_ENABLED",
"-DUNIX_ENABLED",
"-DTHREADS_ENABLED",
"-DDEBUG_ENABLED",
"-DNDEBUG",
"-DGDEXTENSION",
"-I/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp"
],
"pgid": 34717,
"ended_utc": "2026-10-12T03:51:07.694369+00:00",
"exit_code": 0,
"duration_seconds": 1.6463062919999993,
"cleanup": [
{
"attempt": 0,
"pgid": 34717,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"remaining": [],
"cleanup_errors": [],
"foreign_process_or_group_signals": 0
}
@@ -0,0 +1,45 @@
{
"pid": 34717,
"owner_pid": 34670,
"pgid": 34717,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"-c",
"-std=c++17",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/include",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/gen/include",
"-Wall",
"-Wextra",
"-Werror",
"-fexceptions",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-O3",
"-fPIC",
"-DMACOS_ENABLED",
"-DUNIX_ENABLED",
"-DTHREADS_ENABLED",
"-DDEBUG_ENABLED",
"-DNDEBUG",
"-DGDEXTENSION",
"-I/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp"
],
"started_utc": "2026-10-12T03:51:06.111332+00:00",
"initial_members": [
{
"pid": 34717,
"ppid": 34670,
"pgid": 34717,
"args": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os -c -std=c++17 -isystem /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/include -isystem /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/gen/include -Wall -Wextra -Werror -fexceptions -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fvisibility=hidden -O3 -fPIC -DMACOS_ENABLED -DUNIX_ENABLED -DTHREADS_ENABLED -DDEBUG_ENABLED -DNDEBUG -DGDEXTENSION -I/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp"
}
],
"owned_new_session": true
}
@@ -0,0 +1,28 @@
{
"name": "compile-062",
"result": {
"pid": 34717,
"exit_code": 0,
"timed_out": false,
"error_lines": [],
"duration_seconds": 1.6466069169999997
},
"capture": {
"passed": true,
"cleanup": [
{
"attempt": 0,
"pgid": 34717,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"cleanup_errors": [],
"all_captured_ended": true,
"foreign_process_or_group_signals": 0
},
"full_input_inventory_before_verified": true,
"full_input_inventory_after_verified": true,
"post_input_error": null
}
@@ -0,0 +1,173 @@
{
"passed": true,
"error": null,
"phases": [
{
"name": "compile-062",
"result": {
"pid": 34717,
"exit_code": 0,
"timed_out": false,
"error_lines": [],
"duration_seconds": 1.6466069169999997
},
"capture": {
"passed": true,
"cleanup": [
{
"attempt": 0,
"pgid": 34717,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"cleanup_errors": [],
"all_captured_ended": true,
"foreign_process_or_group_signals": 0
},
"full_input_inventory_before_verified": true,
"full_input_inventory_after_verified": true,
"post_input_error": null
},
{
"name": "link",
"result": {
"pid": 34736,
"exit_code": 0,
"timed_out": false,
"error_lines": [],
"duration_seconds": 0.210839
},
"capture": {
"passed": true,
"cleanup": [
{
"attempt": 0,
"pgid": 34736,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"cleanup_errors": [],
"all_captured_ended": true,
"foreign_process_or_group_signals": 0
},
"full_input_inventory_before_verified": true,
"full_input_inventory_after_verified": true,
"post_input_error": null
}
],
"cleanup": [
[
{
"attempt": 0,
"pgid": 34717,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
[
{
"attempt": 0,
"pgid": 34736,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
]
],
"cleanup_errors": [],
"binary_checks": {
"file": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib: Mach-O 64-bit dynamically linked shared library arm64\n",
"arch": "arm64\n",
"dependencies": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib:\n\t/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib (compatibility version 0.0.0, current version 0.0.0)\n\t/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 2100.43.0)\n\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)\n",
"exports": "0000000000000828 T _tree_numeric_core_init\n"
},
"object": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"bytes": 368776,
"sha256": "4ac5a21e47a4441374131310c44474497b5fb5b28f6c6e75a5ed17243616687d"
},
"library": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib",
"bytes": 417184,
"sha256": "64608dccb3441594603fa5561fad3e2e90b055f32e4823c4864d2486a298602c"
},
"original_inputs_preserved": true,
"bridge_compilations": 1,
"link_attempts": 1,
"spawned_children": [
{
"phase": "compile-062",
"pid": 34717,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"-c",
"-std=c++17",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/include",
"-isystem",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-candidate-r131/sdk/gen/include",
"-Wall",
"-Wextra",
"-Werror",
"-fexceptions",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-O3",
"-fPIC",
"-DMACOS_ENABLED",
"-DUNIX_ENABLED",
"-DTHREADS_ENABLED",
"-DDEBUG_ENABLED",
"-DNDEBUG",
"-DGDEXTENSION",
"-I/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp"
]
},
{
"phase": "link",
"pid": 34736,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-Wl,-S",
"-Wl,-x",
"-Wl,-dead_strip",
"-shared",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a"
]
}
],
"SDK_compilations": 0,
"SDK_archive_reused": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a",
"bytes": 2284912,
"sha256": "4d54f0980c3f445f3013cddb859135b619f28a91205fc8b9fbc9d10bc76c52c3"
},
"SDK_archive_rebuilt": false,
"old_bridge_object_reused": false,
"Godot_loaded": false,
"selected": false,
"unit_accepted": false,
"performance_accepted": false,
"limits": [
"Exact r326 Guest batch bridge one-object compile and link to authenticated unchanged r133 SDK archive only; no SDK recompilation, Godot load, protocol, performance or unit acceptance."
]
}
@@ -0,0 +1,35 @@
{
"pid": 34736,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-Wl,-S",
"-Wl,-x",
"-Wl,-dead_strip",
"-shared",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a"
],
"pgid": 34736,
"ended_utc": "2026-10-12T03:51:08.344270+00:00",
"exit_code": 0,
"duration_seconds": 0.21052816699999966,
"cleanup": [
{
"attempt": 0,
"pgid": 34736,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"remaining": [],
"cleanup_errors": [],
"foreign_process_or_group_signals": 0
}
@@ -0,0 +1,31 @@
{
"pid": 34736,
"owner_pid": 34670,
"pgid": 34736,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-o",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib",
"-arch",
"arm64",
"-isysroot",
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
"-fvisibility=hidden",
"-Wl,-S",
"-Wl,-x",
"-Wl,-dead_strip",
"-shared",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a"
],
"started_utc": "2026-10-12T03:51:08.170135+00:00",
"initial_members": [
{
"pid": 34736,
"ppid": 34670,
"pgid": 34736,
"args": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/libtree_numeric_core.macos.template_debug.dylib -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fvisibility=hidden -Wl,-S -Wl,-x -Wl,-dead_strip -shared /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-build-r327/objects/062-tree_numeric_core.os /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-sdk-lifetime-build-r133/libgodot-cpp.macos.template_debug.arm64.a"
}
],
"owned_new_session": true
}
@@ -0,0 +1,28 @@
{
"name": "link",
"result": {
"pid": 34736,
"exit_code": 0,
"timed_out": false,
"error_lines": [],
"duration_seconds": 0.210839
},
"capture": {
"passed": true,
"cleanup": [
{
"attempt": 0,
"pgid": 34736,
"members_before": [],
"group_signal": null,
"tracked_parent_signal": null
}
],
"cleanup_errors": [],
"all_captured_ended": true,
"foreign_process_or_group_signals": 0
},
"full_input_inventory_before_verified": true,
"full_input_inventory_after_verified": true,
"post_input_error": null
}
@@ -0,0 +1,59 @@
{
"plan_id": "P23-02",
"status": "uncompiled_implementation_candidate",
"parent": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/input.json",
"bytes": 4775,
"sha256": "80734ba89f84a086ef5b79a0443296a73ec5aab0478edcfaabb3dfd89450d71f"
},
"contract": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-work-contract-r325.json",
"bytes": 2313,
"sha256": "bbb488bbb0229c31711982867375f41487ec7f5c9343eb6eb5903b8321e05602"
},
"candidate_pins": {
"scripts/guest_service.gd": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/guest_service.gd",
"bytes": 62505,
"sha256": "77ce52ebeed6a89f3e397de01572b17ea3e3cb246f7daca9145a1a192389969e"
},
"scripts/simulation_runtime.gd": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/simulation_runtime.gd",
"bytes": 612068,
"sha256": "7eb24adbf91fe53cde14954dda12abd5efb05130de7d356d8df281ee99065e86"
},
"source/guest_candidate_batch.inc": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/guest_candidate_batch.inc",
"bytes": 28222,
"sha256": "3623a7ca03b96118c927662fc5a95c1f73e20251d5ef4b04ec519603c3c05ba9"
},
"source/tree_core.hpp": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp",
"bytes": 3467,
"sha256": "5f67d85bfc91d5c7830aabd8089f4bca05883045d671d4e683d7c532cf3a34a1"
},
"source/tree_numeric_core.cpp": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp",
"bytes": 56138,
"sha256": "a2434ef2fbc9624aa3b62746cebde2cacdce78712d4d866774df54fbd291bee3"
}
},
"compiled_Guest_keys": 99,
"scripts_unchanged": [
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/guest_service.gd",
"bytes": 62505,
"sha256": "77ce52ebeed6a89f3e397de01572b17ea3e3cb246f7daca9145a1a192389969e"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/simulation_runtime.gd",
"bytes": 612068,
"sha256": "7eb24adbf91fe53cde14954dda12abd5efb05130de7d356d8df281ee99065e86"
}
],
"selected": false,
"adopted": false,
"unit_accepted": false,
"performance_accepted": false,
"formal_completed_added": 0
}
@@ -0,0 +1,395 @@
private:
// This scope owns names only for one call. It retains no guest, candidate,
// callback, result, cache or saved simulation state across calls.
struct GuestBatchKey {
const StringName name;
const String text;
explicit GuestBatchKey(const char *s):name(s,false),text(name) {}
};
// Immutable key objects belong to one public batch call only. No guest,
// dictionary, callback, cached value or name survives that call.
struct GuestBatchNames {
const GuestBatchKey k_empty{""};
const GuestBatchKey k_ADULT_NOT_VERIFIED{"ADULT_NOT_VERIFIED"};
const GuestBatchKey k_CANNOT_PAY{"CANNOT_PAY"};
const GuestBatchKey k_CONTENT_FILTERED{"CONTENT_FILTERED"};
const GuestBatchKey k_ETA_AFTER_EXIT{"ETA_AFTER_EXIT"};
const GuestBatchKey k_FACILITY_CLOSED{"FACILITY_CLOSED"};
const GuestBatchKey k_FORBIDDEN_GUEST_TAG{"FORBIDDEN_GUEST_TAG"};
const GuestBatchKey k_GUEST_TYPE_NOT_ALLOWED{"GUEST_TYPE_NOT_ALLOWED"};
const GuestBatchKey k_ILLEGALITY_REFUSED{"ILLEGALITY_REFUSED"};
const GuestBatchKey k_INVALID_NEED_MAP{"INVALID_NEED_MAP"};
const GuestBatchKey k_MISSING_INPUTS{"MISSING_INPUTS"};
const GuestBatchKey k_MISSING_PERMISSION{"MISSING_PERMISSION"};
const GuestBatchKey k_QUALITY_TOO_LOW{"QUALITY_TOO_LOW"};
const GuestBatchKey k_RISK_REFUSED{"RISK_REFUSED"};
const GuestBatchKey k_UNREACHABLE{"UNREACHABLE"};
const GuestBatchKey k_WAIT_HARD_LIMIT{"WAIT_HARD_LIMIT"};
const GuestBatchKey k_absolute_minute{"absolute_minute"};
const GuestBatchKey k_accepted{"accepted"};
const GuestBatchKey k_addiction_by_tag{"addiction_by_tag"};
const GuestBatchKey k_adult{"adult"};
const GuestBatchKey k_adult_content_enabled{"adult_content_enabled"};
const GuestBatchKey k_adult_only{"adult_only"};
const GuestBatchKey k_adult_verified{"adult_verified"};
const GuestBatchKey k_allow_credit{"allow_credit"};
const GuestBatchKey k_allowed_guest_types{"allowed_guest_types"};
const GuestBatchKey k_credit_allowed{"credit_allowed"};
const GuestBatchKey k_credit_limit_gold{"credit_limit_gold"};
const GuestBatchKey k_current_minute{"current_minute"};
const GuestBatchKey k_debt_gold{"debt_gold"};
const GuestBatchKey k_discretionary{"discretionary"};
const GuestBatchKey k_entertainment{"entertainment"};
const GuestBatchKey k_estimated_total_gold{"estimated_total_gold"};
const GuestBatchKey k_exit_reason{"exit_reason"};
const GuestBatchKey k_exit_threshold{"exit_threshold"};
const GuestBatchKey k_expected_quality{"expected_quality"};
const GuestBatchKey k_expected_wait{"expected_wait"};
const GuestBatchKey k_facility_id{"facility_id"};
const GuestBatchKey k_facility_tags{"facility_tags"};
const GuestBatchKey k_forbidden_guest_tags{"forbidden_guest_tags"};
const GuestBatchKey k_frugal{"frugal"};
const GuestBatchKey k_gambling{"gambling"};
const GuestBatchKey k_get_definition{"get_definition"};
const GuestBatchKey k_get_guest{"get_guest"};
const GuestBatchKey k_group_fit{"group_fit"};
const GuestBatchKey k_guest_type_id{"guest_type_id"};
const GuestBatchKey k_hunger{"hunger"};
const GuestBatchKey k_hygiene{"hygiene"};
const GuestBatchKey k_illegal_level{"illegal_level"};
const GuestBatchKey k_inputs_available{"inputs_available"};
const GuestBatchKey k_instance_id{"instance_id"};
const GuestBatchKey k_intimacy{"intimacy"};
const GuestBatchKey k_is_open{"is_open"};
const GuestBatchKey k_legal_permission_override{"legal_permission_override"};
const GuestBatchKey k_legal_sensitivity{"legal_sensitivity"};
const GuestBatchKey k_leisure{"leisure"};
const GuestBatchKey k_medical{"medical"};
const GuestBatchKey k_minimum_quality{"minimum_quality"};
const GuestBatchKey k_need_effects{"need_effects"};
const GuestBatchKey k_need_priority{"need_priority"};
const GuestBatchKey k_need_relief{"need_relief"};
const GuestBatchKey k_needs{"needs"};
const GuestBatchKey k_novelty{"novelty"};
const GuestBatchKey k_ok{"ok"};
const GuestBatchKey k_open{"open"};
const GuestBatchKey k_open_at_arrival{"open_at_arrival"};
const GuestBatchKey k_ordered{"ordered"};
const GuestBatchKey k_planned_exit_at{"planned_exit_at"};
const GuestBatchKey k_preference{"preference"};
const GuestBatchKey k_preference_weights{"preference_weights"};
const GuestBatchKey k_price_burden{"price_burden"};
const GuestBatchKey k_price_gold{"price_gold"};
const GuestBatchKey k_quality{"quality"};
const GuestBatchKey k_quoted_price{"quoted_price"};
const GuestBatchKey k_ranked{"ranked"};
const GuestBatchKey k_reachable{"reachable"};
const GuestBatchKey k_reason{"reason"};
const GuestBatchKey k_rejected{"rejected"};
const GuestBatchKey k_repetition_penalty{"repetition_penalty"};
const GuestBatchKey k_required_guest_tags{"required_guest_tags"};
const GuestBatchKey k_requires_adult_verified{"requires_adult_verified"};
const GuestBatchKey k_respect_survival_reserve{"respect_survival_reserve"};
const GuestBatchKey k_risk{"risk"};
const GuestBatchKey k_risk_level{"risk_level"};
const GuestBatchKey k_risk_sensitivity{"risk_sensitivity"};
const GuestBatchKey k_risk_tolerance{"risk_tolerance"};
const GuestBatchKey k_service_category{"service_category"};
const GuestBatchKey k_sleep{"sleep"};
const GuestBatchKey k_spendthrift{"spendthrift"};
const GuestBatchKey k_supported{"supported"};
const GuestBatchKey k_tags{"tags"};
const GuestBatchKey k_tourism{"tourism"};
const GuestBatchKey k_travel_minutes{"travel_minutes"};
const GuestBatchKey k_urgency{"urgency"};
const GuestBatchKey k_utility{"utility"};
const GuestBatchKey k_utility_terms{"utility_terms"};
const GuestBatchKey k_visited_facility_ids{"visited_facility_ids"};
const GuestBatchKey k_wait_hard_limit{"wait_hard_limit"};
const GuestBatchKey k_wait_minutes{"wait_minutes"};
const GuestBatchKey k_wallet_gold{"wallet_gold"};
Variant value(const Dictionary &d,const GuestBatchKey &k,const Variant &fallback=Variant()) {
if(d.has(k.name)) return d[k.name];
return d.has(k.text) ? d[k.text] : fallback;
}
bool has(const Dictionary &d,const GuestBatchKey &k) { return d.has(k.name) || d.has(k.text); }
int64_t integer(const Dictionary &d,const GuestBatchKey &k,int64_t fallback=0) { return value(d,k,fallback); }
bool flag(const Dictionary &d,const GuestBatchKey &k,bool fallback=false) {
const Variant v=value(d,k,fallback);
return v.get_type()==Variant::INT ? int64_t(v)!=0 : bool(v);
}
};
struct GuestBatchRow {
Dictionary candidate,relief;
StringName id;
String id_text;
bool need_map_valid=true;
int64_t priority=0,utility=0,urgency=0,travel=0;
};
struct GuestBatchFacilityOrder {
bool operator()(const GuestBatchRow &a,const GuestBatchRow &b) const { return a.id_text < b.id_text; }
};
struct GuestBatchRankOrder {
bool operator()(const GuestBatchRow &a,const GuestBatchRow &b) const {
if(a.priority!=b.priority) return a.priority>b.priority;
if(a.utility!=b.utility) return a.utility>b.utility;
if(a.urgency!=b.urgency) return a.urgency>b.urgency;
if(a.travel!=b.travel) return a.travel<b.travel;
return a.id_text<b.id_text;
}
};
static int64_t guest_sub(int64_t a,int64_t b) {
return the_tree_native::signed_add(a,the_tree_native::signed_add(~b,1));
}
static int64_t guest_clamp(int64_t x,int64_t low,int64_t high) {
return std::min<int64_t>(std::max<int64_t>(x,low),high);
}
static bool guest_name_value(const Variant &v) {
return v.get_type()==Variant::STRING || v.get_type()==Variant::STRING_NAME;
}
static bool guest_names_supported(const Variant &v) {
// The original name helper ignores non-arrays, but converting unusual
// array elements is deliberately left to the original GDScript path.
if(v.get_type()!=Variant::ARRAY) return true;
const Array a=v;
for(int64_t i=0;i<a.size();++i) if(!guest_name_value(a[i])) return false;
return true;
}
static Array guest_names(const Variant &v) {
Array out;
if(v.get_type()!=Variant::ARRAY) return out;
const Array a=v;
for(int64_t i=0;i<a.size();++i) {
const StringName name=a[i];
if(!name.is_empty() && !out.has(name)) out.append(name);
}
// Membership is unordered. Preference additions below use this same
// lexical ordering as GuestDefinition's sorted unique name helper.
std::vector<String> ordered;
for(int64_t i=0;i<out.size();++i) { const StringName name=out[i]; ordered.emplace_back(String(name)); }
SortArray<String> sorter;
if(!ordered.empty()) sorter.sort(ordered.data(),ordered.size());
out.clear();for(const String &s:ordered) out.append(StringName(s));
return out;
}
static bool guest_normalize_need(GuestBatchNames &n,const Variant &v,Dictionary &out) {
if(v.get_type()!=Variant::DICTIONARY) return false;
const Dictionary source=v;
if(source.size()>6) return false;
const Array keys=source.keys();
for(int64_t i=0;i<keys.size();++i) {
if(!guest_name_value(keys[i])) return false;
const StringName k=keys[i];
bool valid=false;
for(const GuestBatchKey *s: {&n.k_hunger,&n.k_sleep,&n.k_hygiene,&n.k_medical,&n.k_leisure,&n.k_intimacy}) if(k==s->name) {valid=true;break;}
if(!valid || out.has(k) || source[keys[i]].get_type()!=Variant::INT) return false;
out[k]=source[keys[i]];
}
return true;
}
static bool guest_candidate_supported(GuestBatchNames &n,const Dictionary &d) {
// Adding canonical/result StringName keys to a typed dictionary can
// invoke conversion/error semantics; that entire domain stays original.
if(d.is_typed()) return false;
for(const GuestBatchKey *s: {&n.k_travel_minutes,&n.k_wait_minutes,&n.k_expected_wait,&n.k_wait_hard_limit,&n.k_risk_level,&n.k_risk,&n.k_illegal_level,&n.k_expected_quality,&n.k_quality,&n.k_minimum_quality,&n.k_estimated_total_gold,&n.k_price_gold,&n.k_quoted_price,&n.k_need_priority,&n.k_preference,&n.k_novelty,&n.k_group_fit,&n.k_price_burden,&n.k_risk_sensitivity,&n.k_repetition_penalty,&n.k_urgency})
if(n.has(d,*s) && n.value(d,*s).get_type()!=Variant::INT) return false;
for(const GuestBatchKey *s: {&n.k_inputs_available,&n.k_adult_only,&n.k_requires_adult_verified,&n.k_is_open,&n.k_open,&n.k_open_at_arrival,&n.k_reachable,&n.k_credit_allowed,&n.k_allow_credit,&n.k_discretionary,&n.k_respect_survival_reserve,&n.k_legal_permission_override,&n.k_ok}) {
if(!n.has(d,*s)) continue;
const Variant::Type t=n.value(d,*s).get_type();
if(t!=Variant::BOOL && t!=Variant::INT) return false;
}
for(const GuestBatchKey *s: {&n.k_facility_id,&n.k_instance_id,&n.k_service_category}) if(n.has(d,*s) && !guest_name_value(n.value(d,*s))) return false;
for(const GuestBatchKey *s: {&n.k_required_guest_tags,&n.k_forbidden_guest_tags,&n.k_allowed_guest_types,&n.k_facility_tags,&n.k_tags}) if(!guest_names_supported(n.value(d,*s,Array()))) return false;
return true;
}
static int64_t guest_price(GuestBatchNames &n,const Dictionary &c) {
return std::max<int64_t>(int64_t(n.value(c,n.k_estimated_total_gold,n.value(c,n.k_price_gold,n.value(c,n.k_quoted_price,int64_t(0))))),0);
}
static bool guest_discretionary(GuestBatchNames &n,const Dictionary &c) {
if(n.flag(c,n.k_discretionary)) return true;
const StringName category=n.value(c,n.k_service_category,n.k_empty.name);
for(const GuestBatchKey *s: {&n.k_leisure,&n.k_entertainment,&n.k_gambling,&n.k_intimacy,&n.k_tourism}) if(category==s->name) return true;
const Array tags=guest_names(n.value(c,n.k_facility_tags,n.value(c,n.k_tags,Array())));
for(const GuestBatchKey *s: {&n.k_leisure,&n.k_entertainment,&n.k_gambling,&n.k_adult,&n.k_intimacy}) if(tags.has(s->name)) return true;
return false;
}
static StringName guest_rejection(GuestBatchNames &n,const GuestBatchRow &row,
const Dictionary &context,const StringName &type,const Array &tags,bool adult,
int64_t planned_exit,int64_t decision_minute,int64_t cash,int64_t credit,
int64_t reserve,int64_t tolerance,int64_t legal,int64_t minimum) {
const Dictionary &c=row.candidate;
if(!row.need_map_valid) return n.k_INVALID_NEED_MAP.name;
if(!n.flag(c,n.k_inputs_available,true)) return n.k_MISSING_INPUTS.name;
if(n.flag(c,n.k_adult_only,n.flag(c,n.k_requires_adult_verified))) {
if(!adult) return n.k_ADULT_NOT_VERIFIED.name;
if(!n.flag(context,n.k_adult_content_enabled,true)) return n.k_CONTENT_FILTERED.name;
}
const Array required=guest_names(n.value(c,n.k_required_guest_tags,Array()));
for(int64_t i=0;i<required.size();++i) if(!tags.has(required[i])) return n.k_MISSING_PERMISSION.name;
const Array forbidden=guest_names(n.value(c,n.k_forbidden_guest_tags,Array()));
for(int64_t i=0;i<forbidden.size();++i) if(tags.has(forbidden[i])) return n.k_FORBIDDEN_GUEST_TAG.name;
const Array allowed=guest_names(n.value(c,n.k_allowed_guest_types,Array()));
if(!allowed.is_empty() && !allowed.has(type)) return n.k_GUEST_TYPE_NOT_ALLOWED.name;
if(!n.flag(c,n.k_is_open,n.flag(c,n.k_open,true)) && !n.flag(c,n.k_open_at_arrival)) return n.k_FACILITY_CLOSED.name;
if(!n.flag(c,n.k_reachable,true)) return n.k_UNREACHABLE.name;
const int64_t travel=std::max<int64_t>(n.integer(c,n.k_travel_minutes),0);
if(decision_minute>=0 && the_tree_native::signed_add(decision_minute,travel)>planned_exit) return n.k_ETA_AFTER_EXIT.name;
const int64_t price=guest_price(n,c);
const int64_t available=n.flag(c,n.k_respect_survival_reserve,guest_discretionary(n,c)) ? std::max<int64_t>(guest_sub(cash,reserve),0) : cash;
if(price>available && (!n.flag(c,n.k_credit_allowed,n.flag(c,n.k_allow_credit)) || guest_sub(price,available)>credit)) return n.k_CANNOT_PAY.name;
const int64_t wait=std::max<int64_t>(int64_t(n.value(c,n.k_wait_minutes,n.value(c,n.k_expected_wait,int64_t(0)))),0);
const int64_t hard=std::max<int64_t>(int64_t(n.value(c,n.k_wait_hard_limit,n.value(context,n.k_wait_hard_limit,int64_t(120)))),0);
if(wait>=hard) return n.k_WAIT_HARD_LIMIT.name;
const int64_t risk=guest_clamp(int64_t(n.value(c,n.k_risk_level,n.value(c,n.k_risk,int64_t(0)))),0,100);
if(risk>tolerance) return n.k_RISK_REFUSED.name;
if(guest_clamp(n.integer(c,n.k_illegal_level),0,100)>guest_sub(100,legal) && !n.flag(c,n.k_legal_permission_override)) return n.k_ILLEGALITY_REFUSED.name;
const int64_t quality=guest_clamp(int64_t(n.value(c,n.k_expected_quality,n.value(c,n.k_quality,int64_t(0)))),0,100);
if(quality<guest_clamp(n.integer(c,n.k_minimum_quality,minimum),0,100)) return n.k_QUALITY_TOO_LOW.name;
return n.k_empty.name;
}
static void guest_evaluate(GuestBatchNames &n,GuestBatchRow &row,const Dictionary &needs,
const Dictionary &weights,const Array &visited,int64_t cash,int64_t credit,int64_t tolerance) {
const Dictionary &c=row.candidate;
int64_t relief=0,default_urgency=0,priority=0;
const Variant raw_relief=n.value(c,n.k_need_relief,int64_t(0));
if(raw_relief.get_type()==Variant::INT) relief=std::max<int64_t>(int64_t(raw_relief),0);
else if(raw_relief.get_type()==Variant::DICTIONARY) {
for(const GuestBatchKey *s: {&n.k_hunger,&n.k_sleep,&n.k_hygiene,&n.k_medical,&n.k_leisure,&n.k_intimacy}) {
const int64_t effect=row.relief.get(s->name,int64_t(0));
const int64_t need=needs[s->name];
relief=std::max<int64_t>(relief,signed_product(std::max<int64_t>(effect,0),need)/100);
if(effect>0) {
default_urgency=std::max<int64_t>(default_urgency,need);
if(s->name==n.k_hunger.name || s->name==n.k_sleep.name || s->name==n.k_leisure.name || s->name==n.k_intimacy.name) priority=std::max<int64_t>(priority,need);
}
}
}
int64_t default_preference=0;
const Array facility_tags=guest_names(n.value(c,n.k_facility_tags,n.value(c,n.k_tags,Array())));
for(int64_t i=0;i<facility_tags.size();++i) default_preference=the_tree_native::signed_add(default_preference,int64_t(weights.get(facility_tags[i],int64_t(0))));
const int64_t preference=n.integer(c,n.k_preference,default_preference);
const int64_t quality=n.value(c,n.k_expected_quality,n.value(c,n.k_quality,int64_t(0)));
const bool seen=visited.has(row.id);
const int64_t novelty=n.integer(c,n.k_novelty,seen?0:10),group=n.integer(c,n.k_group_fit);
const int64_t power=std::max<int64_t>(the_tree_native::signed_add(cash,credit),1);
const int64_t numerator=guest_sub(the_tree_native::signed_add(signed_product(guest_price(n,c),100),power),1);
const int64_t burden=n.integer(c,n.k_price_burden,guest_clamp(numerator/power,0,100));
const int64_t travel=std::max<int64_t>(n.integer(c,n.k_travel_minutes),0);
const int64_t wait=std::max<int64_t>(int64_t(n.value(c,n.k_wait_minutes,n.value(c,n.k_expected_wait,int64_t(0)))),0);
const int64_t risk=std::max<int64_t>(int64_t(n.value(c,n.k_risk,n.value(c,n.k_risk_level,int64_t(0)))),0);
const int64_t sensitivity=std::max<int64_t>(n.integer(c,n.k_risk_sensitivity,the_tree_native::signed_add(guest_sub(100,tolerance),24)/25),0);
const int64_t repetition=n.integer(c,n.k_repetition_penalty,seen?10:0);
int64_t utility=signed_product(relief,8);
utility=the_tree_native::signed_add(utility,signed_product(preference,5));
utility=the_tree_native::signed_add(utility,signed_product(quality,3));
utility=the_tree_native::signed_add(utility,signed_product(novelty,2));
utility=the_tree_native::signed_add(utility,signed_product(group,2));
utility=guest_sub(utility,signed_product(burden,5));
utility=guest_sub(utility,signed_product(travel,2));
utility=guest_sub(utility,signed_product(wait,3));
utility=guest_sub(utility,signed_product(risk,sensitivity));
utility=guest_sub(utility,repetition);
Dictionary result=c.duplicate(true);
result[n.k_facility_id.name]=row.id;result[n.k_need_priority.name]=priority;
result[n.k_utility.name]=utility;result[n.k_urgency.name]=n.integer(c,n.k_urgency,default_urgency);result[n.k_travel_minutes.name]=travel;
Dictionary terms;
terms[n.k_need_relief.name]=relief;terms[n.k_preference.name]=preference;terms[n.k_expected_quality.name]=quality;
terms[n.k_novelty.name]=novelty;terms[n.k_group_fit.name]=group;terms[n.k_price_burden.name]=burden;
terms[n.k_travel_minutes.name]=travel;terms[n.k_wait_minutes.name]=wait;terms[n.k_risk.name]=risk;
terms[n.k_risk_sensitivity.name]=sensitivity;terms[n.k_repetition_penalty.name]=repetition;
result[n.k_utility_terms.name]=terms;
row.candidate=result;row.priority=priority;row.utility=utility;row.urgency=result[n.k_urgency.name];row.travel=travel;
}
public:
Dictionary guest_candidate_batch(Object *owner,const StringName &guest_id,const Array &facilities,const Dictionary &context) {
// No owner/input mutation occurs in the entire implementation. A failed
// new standard-container allocation cannot escape the native boundary
// or publish a partially built result. Engine-internal allocation failure
// is not claimed to be covered by these standard C++ exception catches.
Dictionary unsupported;unsupported[StringName("supported",false)]=false;
try { return guest_candidate_batch_impl(owner,guest_id,facilities,context); }
catch(const std::bad_alloc &) { return unsupported; }
catch(const std::length_error &) { return unsupported; }
}
private:
Dictionary guest_candidate_batch_impl(Object *owner,const StringName &guest_id,const Array &facilities,const Dictionary &context) {
GuestBatchNames n;const ProjectionNames p;
Dictionary unsupported;unsupported[n.k_supported.name]=false;
if(!builtin(p,owner,"res://scripts/guest/guest_service.gd")) return unsupported;
// No caller callback is invoked during preflight or computation. Callback
// contexts use original extraction/evaluation/decision in their entirety.
const Array context_keys=context.keys();
for(int64_t i=0;i<context_keys.size();++i) {
if(!guest_name_value(context_keys[i])) return unsupported;
const StringName k=context_keys[i];
if(k!=n.k_absolute_minute.name && k!=n.k_wait_hard_limit.name && k!=n.k_adult_content_enabled.name && k!=n.k_exit_threshold.name && k!=n.k_exit_reason.name) return unsupported;
}
for(const GuestBatchKey *s: {&n.k_absolute_minute,&n.k_wait_hard_limit,&n.k_exit_threshold}) if(n.has(context,*s) && n.value(context,*s).get_type()!=Variant::INT) return unsupported;
if(n.has(context,n.k_adult_content_enabled) && n.value(context,n.k_adult_content_enabled).get_type()!=Variant::BOOL && n.value(context,n.k_adult_content_enabled).get_type()!=Variant::INT) return unsupported;
if(n.has(context,n.k_exit_reason) && !guest_name_value(n.value(context,n.k_exit_reason))) return unsupported;
Object *guest=owner->call(n.k_get_guest.name,guest_id);
if(!builtin(p,guest,"res://scripts/guest/guest_runtime.gd")) return unsupported;
const Variant typev=guest->get(n.k_guest_type_id.name);
if(!guest_name_value(typev)) return unsupported;
const StringName type=typev;
Object *definition=owner->call(n.k_get_definition.name,type);
if(!builtin(p,definition,"res://scripts/guest/guest_definition.gd")) return unsupported;
for(const GuestBatchKey *s: {&n.k_wallet_gold,&n.k_credit_limit_gold,&n.k_debt_gold,&n.k_planned_exit_at}) if(guest->get(s->name).get_type()!=Variant::INT) return unsupported;
for(const GuestBatchKey *s: {&n.k_risk_tolerance,&n.k_legal_sensitivity,&n.k_minimum_quality}) if(definition->get(s->name).get_type()!=Variant::INT) return unsupported;
if(definition->get(n.k_adult_verified.name).get_type()!=Variant::BOOL || owner->get(n.k_current_minute.name).get_type()!=Variant::INT) return unsupported;
if(guest->get(n.k_needs.name).get_type()!=Variant::DICTIONARY || guest->get(n.k_addiction_by_tag.name).get_type()!=Variant::DICTIONARY || guest->get(n.k_visited_facility_ids.name).get_type()!=Variant::ARRAY || definition->get(n.k_tags.name).get_type()!=Variant::ARRAY || definition->get(n.k_preference_weights.name).get_type()!=Variant::DICTIONARY) return unsupported;
const Dictionary needs=guest->get(n.k_needs.name),addiction=guest->get(n.k_addiction_by_tag.name),weights=definition->get(n.k_preference_weights.name);
const Array visited=guest->get(n.k_visited_facility_ids.name),tags=definition->get(n.k_tags.name);
if(!guest_names_supported(visited) || !guest_names_supported(tags)) return unsupported;
for(const GuestBatchKey *s: {&n.k_hunger,&n.k_sleep,&n.k_hygiene,&n.k_medical,&n.k_leisure,&n.k_intimacy}) if(!needs.has(s->name) || needs[s->name].get_type()!=Variant::INT) return unsupported;
const Array addiction_values=addiction.values(),weight_values=weights.values();
int64_t max_addiction=0;
for(int64_t i=0;i<addiction_values.size();++i) {if(addiction_values[i].get_type()!=Variant::INT) return unsupported;max_addiction=std::max<int64_t>(max_addiction,int64_t(addiction_values[i]));}
for(int64_t i=0;i<weight_values.size();++i) if(weight_values[i].get_type()!=Variant::INT) return unsupported;
// Finish checking all potentially converted input fields before creating
// outputs. All getters above are the fixed builtin pure getters.
for(int64_t i=0;i<facilities.size();++i) if(facilities[i].get_type()==Variant::DICTIONARY && !guest_candidate_supported(n,Dictionary(facilities[i]))) return unsupported;
std::vector<GuestBatchRow> ordered;
for(int64_t i=0;i<facilities.size();++i) {
if(facilities[i].get_type()!=Variant::DICTIONARY) continue;
const Dictionary raw=facilities[i];
const StringName id=n.value(raw,n.k_facility_id,n.value(raw,n.k_instance_id,n.k_empty.name));
if(id.is_empty()) continue;
GuestBatchRow row;row.id=id;row.id_text=String(id);row.candidate=raw.duplicate(true);row.candidate[n.k_facility_id.name]=id;
for(const GuestBatchKey *s: {&n.k_need_relief,&n.k_need_effects}) {
if(!n.has(row.candidate,*s)) continue;
const Variant v=n.value(row.candidate,*s);
if(s->name==n.k_need_relief.name && v.get_type()==Variant::INT) continue;
Dictionary normalized;
if(!guest_normalize_need(n,v,normalized)) {row.need_map_valid=false;break;}
if(s->name==n.k_need_relief.name) row.relief=normalized;
}
ordered.push_back(row);
}
SortArray<GuestBatchRow,GuestBatchFacilityOrder> facility_sort;
if(!ordered.empty()) facility_sort.sort(ordered.data(),ordered.size());
const int64_t cash=guest->get(n.k_wallet_gold.name);
const int64_t credit=std::max<int64_t>(guest_sub(guest->get(n.k_credit_limit_gold.name),guest->get(n.k_debt_gold.name)),0);
int64_t reserve=0;
if(max_addiction<75) reserve=tags.has(n.k_spendthrift.name) ? cash/10 : (tags.has(n.k_frugal.name) ? cash/2 : signed_product(cash,3)/10);
const int64_t tolerance=definition->get(n.k_risk_tolerance.name);
const int64_t minute=n.integer(context,n.k_absolute_minute,owner->get(n.k_current_minute.name));
TypedArray<Dictionary> raw_ordered,accepted,rejected,ranked;
std::vector<GuestBatchRow> rank_rows;
for(GuestBatchRow &row:ordered) {
raw_ordered.append(row.candidate);
const StringName reason=guest_rejection(n,row,context,type,tags,definition->get(n.k_adult_verified.name),guest->get(n.k_planned_exit_at.name),minute,cash,credit,reserve,tolerance,definition->get(n.k_legal_sensitivity.name),definition->get(n.k_minimum_quality.name));
if(!reason.is_empty()) {Dictionary failure;failure[n.k_facility_id.name]=row.id_text;failure[n.k_reason.name]=String(reason);rejected.append(failure);continue;}
accepted.append(row.candidate);
guest_evaluate(n,row,needs,weights,visited,cash,credit,tolerance);
if(n.flag(row.candidate,n.k_ok,true)) rank_rows.push_back(row);
}
SortArray<GuestBatchRow,GuestBatchRankOrder> rank_sort;
if(!rank_rows.empty()) rank_sort.sort(rank_rows.data(),rank_rows.size());
for(const GuestBatchRow &row:rank_rows) ranked.append(row.candidate);
Dictionary result;result[n.k_supported.name]=true;result[n.k_ordered.name]=raw_ordered;
result[n.k_accepted.name]=accepted;result[n.k_rejected.name]=rejected;result[n.k_ranked.name]=ranked;
return result;
}
public:
@@ -0,0 +1,78 @@
#pragma once
// Standalone numeric prototype; not connected to Godot or production.
#include <algorithm>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <functional>
#include <utility>
#include <stdexcept>
#include <string>
#include <vector>
namespace the_tree_native {
using I = std::int64_t;
struct Edge { I neighbor, cost; };
struct Result {
std::string status = "usable";
std::vector<I> costs, parents, discovered, parent_discovered, settled;
};
I signed_add(I a, I b) {
const auto sum = static_cast<std::uint64_t>(a) + static_cast<std::uint64_t>(b);
if (sum <= static_cast<std::uint64_t>(std::numeric_limits<I>::max())) return static_cast<I>(sum);
return std::numeric_limits<I>::min() + static_cast<I>(sum - (std::uint64_t(1) << 63));
}
template <typename EdgeProvider>
Result search(I n, I start, const std::vector<I>& goals, EdgeProvider&& edge_provider) {
Result r;
if (start < 0 || start >= n) { r.status = "unusable"; return r; }
r.costs.assign(n, std::numeric_limits<I>::max());
r.parents.assign(n, -1);
std::vector<unsigned char> finalized(n, 0), pending(n, 0);
bool unknown_goal = false;
I remaining = 0;
for (I goal : goals) {
if (goal < 0 || goal >= n) { unknown_goal = true; continue; }
if (!pending[goal]) { pending[goal] = 1; ++remaining; }
}
r.costs[start] = 0; r.discovered.push_back(start);
// Positive edges cannot enqueue another node at this entry cost.
// Lexicographic (cost,index) ordering preserves the old sorted cost buckets.
using Entry=std::pair<I,I>;
std::priority_queue<Entry,std::vector<Entry>,std::greater<Entry>> frontier;
frontier.emplace(0,start);
while (!frontier.empty()) {
const auto entry=frontier.top();frontier.pop();
const I entry_cost=entry.first,current=entry.second;
{
if (finalized[current] || entry_cost != r.costs[current]) continue;
finalized[current] = 1;
r.settled.push_back(current);
if (pending[current]) { pending[current] = 0; --remaining; }
if (!remaining && !unknown_goal) return r;
for (const Edge& edge : edge_provider(current)) {
if (edge.cost <= 0) { r.status = "unusable"; return r; }
const I neighbor = edge.neighbor;
if (neighbor < 0 || neighbor >= n) { r.status = "unusable"; return r; }
const I cost = signed_add(r.costs[current], edge.cost);
if (cost < r.costs[current]) { r.status = "wrapped"; return r; }
const I known = r.costs[neighbor];
const bool better_parent = cost == known && r.parents[neighbor] >= 0 && current < r.parents[neighbor];
if (cost > known || (cost == known && !better_parent)) continue;
if (r.parents[neighbor] < 0) {
r.parent_discovered.push_back(neighbor);
if (neighbor != start) r.discovered.push_back(neighbor);
}
r.parents[neighbor] = current;
r.costs[neighbor] = cost;
if (finalized[neighbor]) r.settled.erase(std::remove(r.settled.begin(), r.settled.end(), neighbor), r.settled.end());
finalized[neighbor] = 0;
frontier.emplace(cost,neighbor);
}
}
}
return r;
}
} // namespace the_tree_native
@@ -0,0 +1,862 @@
// Isolated, uncompiled bridge prototype. No production registration or integration yet.
#include "tree_core.hpp"
#include <cmath>
#include <array>
#include <new>
#include <godot_cpp/templates/sort_array.hpp>
#include <godot_cpp/classes/ref_counted.hpp>
#include <godot_cpp/classes/object.hpp>
#include <godot_cpp/variant/vector3i.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/godot.hpp>
#include <godot_cpp/variant/array.hpp>
#include <godot_cpp/variant/callable.hpp>
#include <godot_cpp/variant/dictionary.hpp>
#include <godot_cpp/variant/packed_int64_array.hpp>
#include <godot_cpp/variant/typed_array.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
using namespace godot;
using the_tree_native::I;
using the_tree_native::Edge;
class TheTreeNumericCore : public RefCounted {
GDCLASS(TheTreeNumericCore, RefCounted)
protected:
static void _bind_methods() {
ClassDB::bind_method(D_METHOD("performance_record_sample", "owner", "metric_id", "duration_us"), &TheTreeNumericCore::performance_record_sample);
ClassDB::bind_method(D_METHOD("guest_candidate_batch", "owner", "guest_id", "facilities", "context"), &TheTreeNumericCore::guest_candidate_batch);
ClassDB::bind_method(D_METHOD("guest_tree_edge_rows", "path", "current", "layers", "access"), &TheTreeNumericCore::guest_tree_edge_rows);
ClassDB::bind_method(D_METHOD("search", "cells", "indices", "start_index", "goals", "edge_provider"), &TheTreeNumericCore::search);
ClassDB::bind_method(D_METHOD("search_cached", "cells", "indices", "start_index", "goals", "edge_provider"), &TheTreeNumericCore::search_cached);
ClassDB::bind_method(D_METHOD("clear_edge_cache"), &TheTreeNumericCore::clear_edge_cache);
ClassDB::bind_method(D_METHOD("nearest_guest_access", "path", "start", "goals", "fallback_target", "layers", "access", "ticks"), &TheTreeNumericCore::nearest_guest_access);
ClassDB::bind_method(D_METHOD("project_guest_candidates", "runtime", "guest_id", "open_state", "degraded_state", "movement_scale", "stair_credit", "orthogonal_cost", "ticks"), &TheTreeNumericCore::project_guest_candidates);
}
private:
// Cache belongs to this instance and one caller-owned graph workspace.
// No reuse after cells, indices, filters or edge values change: the caller
// must clear it or release this core. The original search never uses it.
std::map<I, std::vector<Edge>> cached_edges;
// Per-public-call immutable names. No static/global lifetime, cached
// object values, script dispatch result or profile; recursive calls own
// separate scopes. Destruction precedes leaving the engine call.
struct ProjectionNames {
const StringName k_ACCESS_LAYER_DENIED{"ACCESS_LAYER_DENIED",false};
const StringName k_CONNECTOR{"CONNECTOR",false};
const StringName k_GOAL_NOT_PASSABLE{"GOAL_NOT_PASSABLE",false};
const StringName k_GOAL_TEMPORARILY_BLOCKED{"GOAL_TEMPORARILY_BLOCKED",false};
const StringName k_GOAL_UNREACHABLE{"GOAL_UNREACHABLE",false};
const StringName k_OK{"OK",false};
const StringName k_START_NOT_PASSABLE{"START_NOT_PASSABLE",false};
const StringName k_START_TEMPORARILY_BLOCKED{"START_TEMPORARILY_BLOCKED",false};
const StringName k__build_guest_query_tree_compact{"_build_guest_query_tree_compact",false};
const StringName k__cache_key{"_cache_key",false};
const StringName k__cell_traffic{"_cell_traffic",false};
const StringName k__copy_path{"_copy_path",false};
const StringName k__diagnose_no_route_reason{"_diagnose_no_route_reason",false};
const StringName k__find_facility_access_path{"_find_facility_access_path",false};
const StringName k__find_path_internal{"_find_path_internal",false};
const StringName k__guest_access_batch_can_select{"_guest_access_batch_can_select",false};
const StringName k__guest_batch_has_permitted_layer_crossing{"_guest_batch_has_permitted_layer_crossing",false};
const StringName k__guest_has_checked_in{"_guest_has_checked_in",false};
const StringName k__guest_step_connector_memo{"_guest_step_connector_memo",false};
const StringName k__guest_tree_arithmetic_wrapped{"_guest_tree_arithmetic_wrapped",false};
const StringName k__guest_tree_reconstruct_path{"_guest_tree_reconstruct_path",false};
const StringName k__need_relief_for_facility_tags{"_need_relief_for_facility_tags",false};
const StringName k__passable_cells{"_passable_cells",false};
const StringName k__path_cache{"_path_cache",false};
const StringName k__query_batch{"_query_batch",false};
const StringName k__route_failure{"_route_failure",false};
const StringName k__service_category_for_tags{"_service_category_for_tags",false};
const StringName k__sorted_name_keys{"_sorted_name_keys",false};
const StringName k_arithmetic_wrapped{"arithmetic_wrapped",false};
const StringName k_available_quantity{"available_quantity",false};
const StringName k_base_quality{"base_quality",false};
const StringName k_base_service_minutes{"base_service_minutes",false};
const StringName k_begin_guest_path_query_batch{"begin_guest_path_query_batch",false};
const StringName k_cache_misses{"cache_misses",false};
const StringName k_calculate_guest_batch_path_cost{"calculate_guest_batch_path_cost",false};
const StringName k_candidates{"candidates",false};
const StringName k_capacity{"capacity",false};
const StringName k_compact{"compact",false};
const StringName k_cost{"cost",false};
const StringName k_cost_values{"cost_values",false};
const StringName k_costs{"costs",false};
const StringName k_current_cell{"current_cell",false};
const StringName k_definition_id{"definition_id",false};
const StringName k_definition_registry{"definition_registry",false};
const StringName k_elevators{"elevators",false};
const StringName k_end_guest_path_query_batch{"end_guest_path_query_batch",false};
const StringName k_entrance{"entrance",false};
const StringName k_estimated_total_gold{"estimated_total_gold",false};
const StringName k_expected_quality{"expected_quality",false};
const StringName k_expected_wait{"expected_wait",false};
const StringName k_facility_id{"facility_id",false};
const StringName k_facility_service{"facility_service",false};
const StringName k_facility_tags{"facility_tags",false};
const StringName k_get_connector{"get_connector",false};
const StringName k_get_facility{"get_facility",false};
const StringName k_get_facility_business_price{"get_facility_business_price",false};
const StringName k_get_guest{"get_guest",false};
const StringName k_get_instances{"get_instances",false};
const StringName k_get_step_connector{"get_step_connector",false};
const StringName k_graph_revision{"graph_revision",false};
const StringName k_group_fit{"group_fit",false};
const StringName k_guest_service{"guest_service",false};
const StringName k_illegal_level{"illegal_level",false};
const StringName k_indices{"indices",false};
const StringName k_inputs_available{"inputs_available",false};
const StringName k_instance_id{"instance_id",false};
const StringName k_inventory_inputs{"inventory_inputs",false};
const StringName k_inventory_service{"inventory_service",false};
const StringName k_is_open{"is_open",false};
const StringName k_last_error{"last_error",false};
const StringName k_last_no_route_reason{"last_no_route_reason",false};
const StringName k_last_path_cost{"last_path_cost",false};
const StringName k_local_inventory_id{"local_inventory_id",false};
const StringName k_movement_type{"movement_type",false};
const StringName k_need_relief{"need_relief",false};
const StringName k_occupied_cells{"occupied_cells",false};
const StringName k_origin{"origin",false};
const StringName k_owns_connector{"owns_connector",false};
const StringName k_path{"path",false};
const StringName k_path_handle{"path_handle",false};
const StringName k_path_query_measured{"path_query_measured",false};
const StringName k_path_service{"path_service",false};
const StringName k_queue_entries{"queue_entries",false};
const StringName k_reachable{"reachable",false};
const StringName k_ready{"ready",false};
const StringName k_resource_path{"resource_path",false};
const StringName k_risk_level{"risk_level",false};
const StringName k_service_category{"service_category",false};
const StringName k_settled{"settled",false};
const StringName k_staff_only{"staff_only",false};
const StringName k_start{"start",false};
const StringName k_state{"state",false};
const StringName k_supported{"supported",false};
const StringName k_tags{"tags",false};
const StringName k_tagproj_hunger{"hunger",false};
const StringName k_tagproj_sleep{"sleep",false};
const StringName k_tagproj_hygiene{"hygiene",false};
const StringName k_tagproj_medical{"medical",false};
const StringName k_tagproj_leisure{"leisure",false};
const StringName k_tagproj_intimacy{"intimacy",false};
const StringName k_tagproj_dining{"dining",false};
const StringName k_tagproj_lodging{"lodging",false};
const StringName k_tagproj_social{"social",false};
const StringName k_tagproj_bath{"bath",false};
const StringName k_tagproj_wellness{"wellness",false};
const StringName k_tagproj_adult_only{"adult_only",false};
const StringName k_tagproj_restricted_service{"restricted_service",false};
const StringName k_tagproj_food{"food",false};
const StringName k_tagproj_service{"service",false};
const StringName k_target_cell{"target_cell",false};
const StringName k_targets{"targets",false};
const StringName k_temporary_block{"temporary_block",false};
const StringName k_travel_minutes{"travel_minutes",false};
const StringName k_tree{"tree",false};
const StringName k_usable{"usable",false};
};
public:
// Whole builtin integer record operation. No retained sample values or time
// suppression. Unsupported data returns before any caller-owned mutation.
Dictionary performance_record_sample(Object *owner, const StringName &metric, int64_t duration) {
const StringName supported("supported",false), report_key("report",false);
Dictionary unsupported; unsupported[supported]=false;
Object *script=owner ? owner->get_script() : nullptr;
if (!script || String(script->get(StringName("resource_path",false))) != "res://scripts/core/performance_budget.gd" || metric==StringName() || duration<0) return unsupported;
const StringName samples_key("_samples",false), ordered_key("_ordered_samples",false), bytes_key("_ordered_sample_bytes",false), integer_key("_integer_window_bytes",false), totals_key("_totals",false), counts_key("_sample_counts",false), budgets_key("_budgets",false);
const Variant sv=owner->get(samples_key), ov=owner->get(ordered_key), bv=owner->get(bytes_key), iv=owner->get(integer_key), tv=owner->get(totals_key), cv=owner->get(counts_key), uv=owner->get(budgets_key), capacityv=owner->get(StringName("sample_capacity",false));
if (sv.get_type()!=Variant::DICTIONARY || ov.get_type()!=Variant::DICTIONARY || bv.get_type()!=Variant::DICTIONARY || iv.get_type()!=Variant::DICTIONARY || tv.get_type()!=Variant::DICTIONARY || cv.get_type()!=Variant::DICTIONARY || uv.get_type()!=Variant::DICTIONARY || capacityv.get_type()!=Variant::INT) return unsupported;
Dictionary samples=sv, orders=ov, rawbytes=bv, integers=iv, totals=tv, counts=cv, budgets=uv;
if (samples.is_read_only() || orders.is_read_only() || rawbytes.is_read_only() || integers.is_read_only() || totals.is_read_only() || counts.is_read_only()) return unsupported;
const std::array<Dictionary,7> maps{samples,orders,rawbytes,integers,totals,counts,budgets};
for (size_t i=0;i<maps.size();++i) for (size_t j=i+1;j<maps.size();++j)
if (UtilityFunctions::is_same(maps[i],maps[j])) return unsupported;
const bool existing=samples.has(metric);
Variant rawv=samples.get(metric,Array());
if (rawv.get_type()!=Variant::ARRAY) return unsupported;
Array values=rawv;
if (values.is_read_only()) return unsupported;
for (int64_t i=0;i<values.size();++i) if (values[i].get_type()!=Variant::INT) return unsupported;
Variant totalv=totals.get(metric,0), countv=counts.get(metric,0), budgetv=budgets.get(metric,Dictionary());
if (totalv.get_type()!=Variant::INT || countv.get_type()!=Variant::INT || budgetv.get_type()!=Variant::DICTIONARY) return unsupported;
Dictionary budget=budgetv;
for (const Dictionary &map: maps) if (UtilityFunctions::is_same(budget,map)) return unsupported;
const StringName aggregation_key("aggregation",false), limit_key("limit_us",false);
Variant aggregationv=budget.get(aggregation_key,1), limitv=budget.get(limit_key,0);
if (aggregationv.get_type()!=Variant::INT || limitv.get_type()!=Variant::INT) return unsupported;
// One exact byte snapshot serves both builtin validation helpers inside
// this call; there are no external calls between their original checks.
PackedByteArray before=UtilityFunctions::var_to_bytes(values);
TypedArray<int64_t> ordered;
Variant savedbytes=rawbytes.get(metric,PackedByteArray());
bool reuse=existing && orders.has(metric) && savedbytes.get_type()==Variant::PACKED_BYTE_ARRAY && PackedByteArray(savedbytes)==before;
if (reuse) {
Variant orderv=orders[metric];
if (orderv.get_type()!=Variant::ARRAY) return unsupported;
Array prior=orderv;
if (prior.is_read_only() || !prior.is_typed() || prior.get_typed_builtin()!=Variant::INT || prior.size()!=values.size()) return unsupported;
ordered=prior;
} else {
for (int64_t i=0;i<values.size();++i) ordered.append(values[i]);
ordered.sort();
}
// Guards completed: mutations preserve raw and reused ordered aliases.
if (!existing) samples[metric]=values;
integers[metric]=before;
if (!reuse) { orders[metric]=ordered; rawbytes[metric]=before; }
values.append(duration);
ordered.insert(ordered.bsearch(duration),duration);
if (values.size()>int64_t(capacityv)) {
Variant removed=values.pop_front();
ordered.remove_at(ordered.bsearch(removed));
}
PackedByteArray after=UtilityFunctions::var_to_bytes(values);
rawbytes[metric]=after; integers[metric]=after;
const int64_t lifetime_total=the_tree_native::signed_add(int64_t(totalv),duration);
const int64_t lifetime_count=the_tree_native::signed_add(int64_t(countv),1);
totals[metric]=lifetime_total; counts[metric]=lifetime_count;
const int64_t average=lifetime_count>0 ? lifetime_total/lifetime_count : 0;
const int64_t maximum=ordered.is_empty() ? 0 : std::max<int64_t>(0,int64_t(ordered[ordered.size()-1]));
int64_t p95=0;
if (!ordered.is_empty()) {
const int64_t index=std::max<int64_t>(the_tree_native::signed_add(the_tree_native::signed_add(signed_product(95,ordered.size()),99)/100,-1),0);
p95=ordered[std::min<int64_t>(index,ordered.size()-1)];
}
const int64_t aggregation=aggregationv, limit=limitv;
// Original default match is P95, including unknown aggregation values.
const int64_t measured=aggregation==0 ? average : (aggregation==2 ? maximum : p95);
Dictionary report;
report[StringName("metric_id",false)]=metric;
report[StringName("window_sample_count",false)]=values.size();
report[StringName("lifetime_sample_count",false)]=lifetime_count;
report[StringName("average_us",false)]=average;
report[StringName("p95_us",false)]=p95;
report[StringName("maximum_us",false)]=maximum;
report[aggregation_key]=aggregation;
report[StringName("measured_us",false)]=measured;
report[limit_key]=limit;
report[StringName("budget_exceeded",false)]=limit>0 && measured>limit;
Dictionary result; result[supported]=true; result[report_key]=report; return result;
}
#include "guest_candidate_batch.inc"
void clear_edge_cache() { cached_edges.clear(); }
Dictionary search(const Array &cells, const Dictionary &indices, I start_index,
const Dictionary &goals, const Callable &edge_provider) {
return search_impl(cells, indices, start_index, goals, edge_provider, false);
}
Dictionary search_cached(const Array &cells, const Dictionary &indices, I start_index,
const Dictionary &goals, const Callable &edge_provider) {
return search_impl(cells, indices, start_index, goals, edge_provider, true);
}
// One ordered projection, with no new persistent ownership/cache. Only
// builtin pure getters and the already guarded sole budget observer qualify.
Dictionary project_guest_candidates(Object *runtime, const StringName &guest_id,
int64_t open_state, int64_t degraded_state, int64_t movement_scale,
int64_t stair_credit, int64_t orthogonal_cost, const Callable &ticks) {
const ProjectionNames n;
Dictionary unsupported;
unsupported[n.k_supported] = false;
if (!builtin(n,runtime, "res://autoload/simulation_runtime.gd") || !ticks.is_valid()) return unsupported;
Object *path = runtime->get(n.k_path_service);
Object *elevators = runtime->get(n.k_elevators);
Object *facilities = runtime->get(n.k_facility_service);
Object *definitions = runtime->get(n.k_definition_registry);
Object *inventory = runtime->get(n.k_inventory_service);
Object *guests = runtime->get(n.k_guest_service);
if (!builtin(n,path,"res://scripts/world/path_service.gd") ||
!builtin(n,elevators,"res://scripts/transport/elevator_service.gd") ||
!builtin(n,facilities,"res://scripts/facility/facility_service.gd") ||
!builtin(n,definitions,"res://scripts/core/definition_registry.gd") ||
!builtin(n,inventory,"res://scripts/inventory/inventory_service.gd") ||
!builtin(n,guests,"res://scripts/guest/guest_service.gd") ||
!static_cast<bool>(runtime->call(n.k__guest_access_batch_can_select))) return unsupported;
Object *guest = guests->call(n.k_get_guest,guest_id);
Array candidates;
if (!guest) {
Dictionary result; result[n.k_supported] = true;
result[n.k_candidates] = candidates; return result;
}
if (!builtin(n,guest,"res://scripts/guest/guest_runtime.gd")) return unsupported;
const Array initial = facilities->call(n.k_get_instances);
// Preflight is read-only: default registry/get_instances have no public
// error/counter effects. Custom resources retain the original whole loop.
for (int64_t i=0;i<initial.size();++i) {
Object *facility = initial[i];
if (!builtin(n,facility,"res://scripts/facility/facility_instance.gd")) return unsupported;
Object *definition = definitions->call(n.k_get_facility,facility->get(n.k_definition_id));
if (definition && !builtin(n,definition,"res://scripts/data/facility_definition.gd")) return unsupported;
}
Array goals;
for (int64_t i=0;i<initial.size();++i) goals.append_array(facility_access_cells(n,path,initial[i]));
const Vector3i start = guest->get(n.k_current_cell);
path->call(n.k_begin_guest_path_query_batch,start,goals);
const Array ordered = facilities->call(n.k_get_instances);
TypedArray<int64_t> layers; layers.push_back(0); layers.push_back(1);
TypedArray<StringName> access_ids;
for (int64_t i=0;i<ordered.size();++i) {
Object *facility = ordered[i];
Object *definition = definitions->call(n.k_get_facility,facility->get(n.k_definition_id));
if (!definition) continue;
const Array tags = definition->get(n.k_tags);
if (tags.has(n.k_staff_only)) continue;
if (tags.has(n.k_entrance) && static_cast<bool>(runtime->call(n.k__guest_has_checked_in,guest))) continue;
bool has_inputs = true;
const Dictionary inputs = definition->get(n.k_inventory_inputs);
const Array items = runtime->call(n.k__sorted_name_keys,inputs);
for (int64_t j=0;j<items.size();++j) {
const int64_t quantity = inventory->call(n.k_available_quantity,facility->get(n.k_local_inventory_id),items[j]);
if (quantity < static_cast<int64_t>(inputs[items[j]])) {has_inputs=false;break;}
}
if (!has_inputs) {
Dictionary row;row[n.k_facility_id]=facility->get(n.k_instance_id);
row[n.k_inputs_available]=false;candidates.push_back(row);continue;
}
const Array destinations = facility_access_cells(n,path,facility);
Dictionary route = nearest_guest_access_impl(n,path,start,destinations,facility->get(n.k_origin),layers,access_ids,ticks);
if (static_cast<bool>(route.get(n.k_supported,false))) route.erase(n.k_supported);
else route = Dictionary(runtime->call(n.k__find_facility_access_path,start,facility));
const Array walk = route.get(n.k_path,Array());
const bool plain_tag_relief = builtin(n,runtime,"res://autoload/simulation_runtime.gd") &&
tags.is_typed() && tags.get_typed_builtin()==Variant::STRING_NAME;
const Dictionary relief = plain_tag_relief ? builtin_tag_relief(n,tags) :
Dictionary(runtime->call(n.k__need_relief_for_facility_tags,tags));
Dictionary row;
row[n.k_facility_id]=facility->get(n.k_instance_id);
row[n.k_facility_tags]=tags.duplicate();
const int64_t state = facility->get(n.k_state);
row[n.k_is_open]=(state==open_state || state==degraded_state);
row[n.k_reachable]=route.get(n.k_reachable,false);
row[n.k_travel_minutes]=guest_path_minutes(n,path,elevators,walk,movement_scale,stair_credit,orthogonal_cost);
const Array queue = facility->get(n.k_queue_entries);
const int64_t capacity = facility->get(n.k_capacity);
row[n.k_expected_wait]=signed_product(queue.size(),facility->get(n.k_base_service_minutes))/std::max<int64_t>(capacity,1);
row[n.k_estimated_total_gold]=runtime->call(n.k_get_facility_business_price,facility);
const int64_t quality = facility->get(n.k_base_quality);
row[n.k_expected_quality]=std::max<int64_t>(0,std::min<int64_t>(quality,100));
row[n.k_need_relief]=relief;
row[n.k_risk_level]=int64_t(0);row[n.k_illegal_level]=int64_t(0);
row[n.k_group_fit]=signed_product(std::min<int64_t>(capacity,4),5);
// Recheck at the original call position: preceding price/observer
// callbacks must retain a replaced/custom runtime's original call.
const bool plain_tag_category = builtin(n,runtime,"res://autoload/simulation_runtime.gd") &&
tags.is_typed() && tags.get_typed_builtin()==Variant::STRING_NAME;
row[n.k_service_category]=plain_tag_category ? Variant(builtin_tag_category(n,tags)) :
runtime->call(n.k__service_category_for_tags,tags);
Dictionary handle;handle[n.k_target_cell]=route.get(n.k_target_cell,guest->get(n.k_current_cell));
handle[n.k_graph_revision]=path->get(n.k_graph_revision);
row[n.k_path_handle]=handle;candidates.push_back(row);
}
path->call(n.k_end_guest_path_query_batch);
Dictionary result;result[n.k_supported]=true;result[n.k_candidates]=candidates;return result;
}
private:
// Direct translation of the two pure builtin tag methods. Fresh result,
// original insertion/branch order, no retained definition/tag memo.
static Dictionary builtin_tag_relief(const ProjectionNames &n,const Array &tags) {
Dictionary relief;
relief[n.k_tagproj_hunger]=int64_t(0);relief[n.k_tagproj_sleep]=int64_t(0);
relief[n.k_tagproj_hygiene]=int64_t(0);relief[n.k_tagproj_medical]=int64_t(0);
relief[n.k_tagproj_leisure]=int64_t(0);relief[n.k_tagproj_intimacy]=int64_t(0);
if(tags.has(n.k_tagproj_dining)) {relief[n.k_tagproj_hunger]=int64_t(80);relief[n.k_tagproj_leisure]=int64_t(10);}
if(tags.has(n.k_tagproj_lodging)) {relief[n.k_tagproj_sleep]=int64_t(90);relief[n.k_tagproj_hygiene]=std::max<int64_t>(int64_t(relief[n.k_tagproj_hygiene]),10);}
if(tags.has(n.k_tagproj_social)||tags.has(n.k_tagproj_leisure)) relief[n.k_tagproj_leisure]=std::max<int64_t>(int64_t(relief[n.k_tagproj_leisure]),40);
if(tags.has(n.k_tagproj_hygiene)||tags.has(n.k_tagproj_bath)) relief[n.k_tagproj_hygiene]=std::max<int64_t>(int64_t(relief[n.k_tagproj_hygiene]),80);
if(tags.has(n.k_tagproj_medical)) relief[n.k_tagproj_medical]=int64_t(90);
else if(tags.has(n.k_tagproj_wellness)) relief[n.k_tagproj_medical]=std::max<int64_t>(int64_t(relief[n.k_tagproj_medical]),20);
if(tags.has(n.k_tagproj_adult_only)||tags.has(n.k_tagproj_restricted_service)) relief[n.k_tagproj_intimacy]=int64_t(80);
return relief;
}
static StringName builtin_tag_category(const ProjectionNames &n,const Array &tags) {
if(tags.has(n.k_tagproj_dining))return n.k_tagproj_food;
if(tags.has(n.k_tagproj_lodging))return n.k_tagproj_lodging;
if(tags.has(n.k_tagproj_social))return n.k_tagproj_leisure;
return n.k_tagproj_service;
}
static bool builtin(const ProjectionNames &n,Object *object,const char *resource) {
if (!object) return false;Object *script=object->get_script();
return script && String(script->get(n.k_resource_path))==resource;
}
// Exact builtin cache-key spelling. No normalized/reordered profile and no
// persistent cache; String lengths count Unicode codepoints as GDScript does.
static String cache_key_suffix(const ProjectionNames &n,Object *path, const TypedArray<int64_t> &layers,
const TypedArray<StringName> &access) {
String layer_text, access_text;
for (int64_t i=0; i<layers.size(); ++i) {
if (i) layer_text += ",";
layer_text += String::num_int64(static_cast<int64_t>(layers[i]));
}
for (int64_t i=0; i<access.size(); ++i) {
if (i) access_text += ",";
const String value = String(static_cast<StringName>(access[i]));
access_text += String::num_int64(value.length()) + ":" + value;
}
return String("|L:") + layer_text + "|A:" + access_text + "|R:" +
String::num_int64(static_cast<int64_t>(path->get(n.k_graph_revision)));
}
static String cache_key_with_suffix(const Vector3i &start, const Vector3i &goal,
const String &suffix) {
return String::num_int64(start.x) + "," + String::num_int64(start.y) + "," +
String::num_int64(start.z) + ">" + String::num_int64(goal.x) + "," +
String::num_int64(goal.y) + "," + String::num_int64(goal.z) + suffix;
}
static int64_t signed_product(int64_t a,int64_t b) {
const uint64_t product=static_cast<uint64_t>(a)*static_cast<uint64_t>(b);
if (product<=static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) return static_cast<int64_t>(product);
return std::numeric_limits<int64_t>::min()+static_cast<int64_t>(product-(uint64_t(1)<<63));
}
static Array facility_access_cells(const ProjectionNames &n,Object *path,Object *facility) {
const Dictionary passable=path->get(n.k__passable_cells);
Array occupied=Array(facility->get(n.k_occupied_cells)).duplicate();
if (occupied.is_empty()) occupied.push_back(facility->get(n.k_origin));
Dictionary unique;
for (int64_t i=0;i<occupied.size();++i) {
const Vector3i cell=occupied[i];
for (int32_t dx : {-1,1}) {
// Match GDScript's Vector3i conversion after int64 addition.
const Vector3i candidate(int64_t(cell.x)+dx,cell.y,cell.z);
if (passable.has(candidate)) unique[candidate]=true;
}
}
const Vector3i origin=facility->get(n.k_origin);if(passable.has(origin)) unique[origin]=true;
const Array keys=unique.keys();std::vector<Vector3i> sorted;sorted.reserve(keys.size());
for (int64_t i=0;i<keys.size();++i) sorted.push_back(keys[i]);
std::sort(sorted.begin(),sorted.end(),[](const Vector3i &a,const Vector3i &b){
if(a.z!=b.z)return a.z<b.z;if(a.y!=b.y)return a.y<b.y;return a.x<b.x;
});
Array result;for(const Vector3i &cell:sorted)result.push_back(cell);return result;
}
static int64_t guest_path_minutes(const ProjectionNames &n,Object *path,Object *elevators,const Array &route,
int64_t movement_scale,int64_t stair_credit,int64_t orthogonal_cost) {
Dictionary memo=path->get(n.k__guest_step_connector_memo);
// Route-local only. Reuse an ownership result only after an actual
// BOOL return and a typed cached step; no script callback occurs on a
// repeated typed memo hit. A miss/conversion/custom script keeps calls.
const bool builtin_pair = builtin(n,path,"res://scripts/world/path_service.gd") &&
builtin(n,elevators,"res://scripts/transport/elevator_service.gd");
bool ownership_valid = false;
bool ownership_value = false;
StringName ownership_connector;
for(int64_t i=1;i<route.size();++i) {
const Vector3i from=route[i-1],to=route[i];
const Dictionary destinations=memo.get(from,Dictionary());
StringName connector;
const bool memo_hit = destinations.has(to);
const bool typed_memo_hit = memo_hit && destinations[to].get_type() == Variant::STRING_NAME;
if(memo_hit)connector=destinations[to];
else {TypedArray<StringName> access;connector=path->call(n.k_get_step_connector,from,to,access);}
bool special;
if (builtin_pair && typed_memo_hit && ownership_valid && connector == ownership_connector) {
special = ownership_value;
} else {
const Variant owned = elevators->call(n.k_owns_connector,connector);
special = static_cast<bool>(owned);
ownership_valid = builtin_pair && typed_memo_hit && owned.get_type() == Variant::BOOL;
ownership_value = special;
ownership_connector = connector;
}
if(!special && String(connector).begins_with("infra.connector:") && from.x==to.x && from.z==to.z &&
std::abs(int64_t(from.y)-int64_t(to.y))==1) {
const Dictionary detail=path->call(n.k_get_connector,connector);
special=detail.get(n.k_movement_type,StringName())==Variant(n.k_CONNECTOR) &&
static_cast<int64_t>(detail.get(n.k_cost,int64_t(0)))==150 && stair_credit>movement_scale;
}
if(special) {
const int64_t cost=path->call(n.k_calculate_guest_batch_path_cost,route[0],route[route.size()-1],route);
return static_cast<int64_t>(std::ceil(static_cast<double>(cost)/static_cast<double>(orthogonal_cost)));
}
}
return std::max<int64_t>(route.size()-1,0);
}
public:
// Stateless translation of the builtin nearest access query. The caller
// supplies the existing typed default profile and the real Time callable.
// Public cache publication, failure diagnostics and fallback stay ordered.
Dictionary nearest_guest_access(Object *path, const Vector3i &start,
const Array &goals, const Vector3i &fallback_target,
const TypedArray<int64_t> &layers, const TypedArray<StringName> &access,
const Callable &ticks) {
const ProjectionNames n;
return nearest_guest_access_impl(n,path,start,goals,fallback_target,layers,access,ticks);
}
private:
Dictionary nearest_guest_access_impl(const ProjectionNames &n,Object *path, const Vector3i &start,
const Array &goals, const Vector3i &fallback_target,
const TypedArray<int64_t> &layers, const TypedArray<StringName> &access,
const Callable &ticks) {
Dictionary unsupported;
unsupported[n.k_supported] = false;
if (!path || !ticks.is_valid() || goals.is_empty()) return unsupported;
Object *script = path->get_script();
if (!script || String(script->get(n.k_resource_path)) != "res://scripts/world/path_service.gd") return unsupported;
Dictionary batch = path->get(n.k__query_batch);
if (batch.is_empty() || start != static_cast<Vector3i>(batch[n.k_start])) return unsupported;
const Dictionary passable = path->get(n.k__passable_cells);
if (!passable.has(start) || blocked(n,path, start) || !layers.has(start.z)) return unsupported;
const Dictionary targets = batch[n.k_targets];
Dictionary cache = path->get(n.k__path_cache);
// Exact builtin validation loop has no callback before ticks.call().
// Build the unchanged profile/revision suffix lazily at the first key.
String key_suffix;
bool key_suffix_ready = false;
for (int64_t j = 0; j < goals.size(); ++j) {
if (goals[j].get_type() != Variant::VECTOR3I) return unsupported;
const Vector3i cell = goals[j];
if (!targets.has(cell)) {
const bool searchable = passable.has(cell) && layers.has(cell.z) && !blocked(n,path, cell);
if (searchable && (start.z == cell.z || static_cast<bool>(path->call(n.k__guest_batch_has_permitted_layer_crossing, start, cell, layers, access)))) return unsupported;
}
if (!key_suffix_ready) {
key_suffix = cache_key_suffix(n,path, layers, access);
key_suffix_ready = true;
}
const String key = cache_key_with_suffix(start, cell, key_suffix);
if (cache.has(key)) return unsupported;
}
const int64_t started = ticks.call();
if (!static_cast<bool>(batch[n.k_ready])) {
batch[n.k_tree] = path->call(n.k__build_guest_query_tree_compact, start, targets, layers, access);
batch[n.k_arithmetic_wrapped] = path->get(n.k__guest_tree_arithmetic_wrapped);
batch[n.k_ready] = true;
}
const Dictionary tree = batch[n.k_tree];
if (!static_cast<bool>(tree.get(n.k_usable, false)) || static_cast<bool>(batch.get(n.k_arithmetic_wrapped, false))) return unsupported;
Vector3i best_cell = fallback_target;
bool found = false;
int64_t best_cost = 0;
const Dictionary settled = tree[n.k_settled];
bool cost_view_ready=false,compact_cost_view=false;
Dictionary cost_indices,cost_dictionary;
PackedInt64Array cost_values;
for (int64_t j = 0; j < goals.size(); ++j) {
const Vector3i cell = goals[j];
if (!targets.has(cell) || !settled.has(cell)) continue;
// No callback occurs between these original numeric cost reads.
// Initialize lazily at the first eligible goal, and retain nothing
// past this call or reuse after the subsequent route callbacks.
if (!cost_view_ready) {
compact_cost_view=tree.get(n.k_compact,false);
if(compact_cost_view) {cost_indices=tree[n.k_indices];cost_values=tree[n.k_cost_values];}
else cost_dictionary=tree[n.k_costs];
cost_view_ready=true;
}
int64_t cost=0;
if(compact_cost_view) {
if(!cost_indices.has(cell)) return unsupported;
const int64_t index=cost_indices[cell];
if(index<0 || index>=cost_values.size()) return unsupported;
cost=cost_values[index];
} else {
if(!cost_dictionary.has(cell)) return unsupported;
cost=cost_dictionary[cell];
}
if (!found || cost < best_cost) {
found = true;
best_cost = cost;
best_cell = cell;
}
}
TypedArray<Vector3i> best_path;
if (found) {
best_path = resolve_ready_guest_point(n,path, start, best_cell, tree, layers, access);
if (best_path.is_empty()) return unsupported;
}
if (!goals.is_empty() && (!found || goals[goals.size() - 1] != Variant(best_cell))) {
resolve_ready_guest_point(n,path, start, goals[goals.size() - 1], tree, layers, access);
}
const int64_t elapsed = the_tree_native::signed_add(static_cast<int64_t>(ticks.call()), the_tree_native::signed_add(~started, 1));
path->emit_signal(n.k_path_query_measured, std::max<int64_t>(elapsed, 0));
Dictionary result;
result[n.k_supported] = true;
result[n.k_reachable] = found;
result[n.k_path] = best_path;
result[n.k_target_cell] = best_cell;
return result;
}
private:
static bool blocked(const ProjectionNames &n,Object *path, const Vector3i &cell) {
const Dictionary traffic_map = path->get(n.k__cell_traffic);
const Dictionary traffic = traffic_map.get(cell, Dictionary());
return !traffic.is_empty() && static_cast<bool>(traffic[n.k_temporary_block]);
}
static bool tree_has_cost(const ProjectionNames &n,const Dictionary &tree, const Vector3i &cell) {
if (!static_cast<bool>(tree.get(n.k_compact, false))) {
const Dictionary values = tree[n.k_costs];
return values.has(cell);
}
const Dictionary indices = tree[n.k_indices];
if (!indices.has(cell)) return false;
const int64_t index = indices[cell];
const PackedInt64Array values = tree[n.k_cost_values];
return index >= 0 && index < values.size();
}
static int64_t tree_cost(const ProjectionNames &n,const Dictionary &tree, const Vector3i &cell) {
if (!static_cast<bool>(tree.get(n.k_compact, false))) {
const Dictionary values = tree[n.k_costs];
return static_cast<int64_t>(values[cell]);
}
const Dictionary indices = tree[n.k_indices];
const PackedInt64Array values = tree[n.k_cost_values];
return values[static_cast<int64_t>(indices[cell])];
}
static TypedArray<Vector3i> resolve_ready_guest_point(const ProjectionNames &n,Object *path,
const Vector3i &start, const Vector3i &goal, const Dictionary &tree,
const TypedArray<int64_t> &layers, const TypedArray<StringName> &access) {
const Dictionary passable = path->get(n.k__passable_cells);
if (!passable.has(start)) return path->call(n.k__route_failure, n.k_START_NOT_PASSABLE);
if (!passable.has(goal)) return path->call(n.k__route_failure, n.k_GOAL_NOT_PASSABLE);
if (!layers.has(start.z) || !layers.has(goal.z)) return path->call(n.k__route_failure, n.k_ACCESS_LAYER_DENIED);
if (blocked(n,path, start)) return path->call(n.k__route_failure, n.k_START_TEMPORARILY_BLOCKED);
if (blocked(n,path, goal)) return path->call(n.k__route_failure, n.k_GOAL_TEMPORARILY_BLOCKED);
// ticks/tree callbacks may have changed the script or revision. Recheck
// at this original call position and never reuse the pre-tick suffix.
const String key = builtin(n,path,"res://scripts/world/path_service.gd") ?
cache_key_with_suffix(start, goal, cache_key_suffix(n,path, layers, access)) :
String(path->call(n.k__cache_key, start, goal, layers, access));
Dictionary cache = path->get(n.k__path_cache);
const Dictionary batch = path->get(n.k__query_batch);
const Dictionary targets = batch[n.k_targets];
if (cache.has(key) || !targets.has(goal)) return path->call(n.k__find_path_internal, start, goal);
path->set(n.k_cache_misses, the_tree_native::signed_add(static_cast<int64_t>(path->get(n.k_cache_misses)), 1));
if (start.z != goal.z && !static_cast<bool>(path->call(n.k__guest_batch_has_permitted_layer_crossing, start, goal, layers, access))) return path->call(n.k__route_failure, n.k_GOAL_UNREACHABLE);
TypedArray<Vector3i> route;
const Dictionary settled = tree[n.k_settled];
if (start == goal) route.push_back(start);
else if (settled.has(goal)) route = Array(path->call(n.k__guest_tree_reconstruct_path, tree, goal));
if (route.is_empty()) return path->call(n.k__route_failure, path->call(n.k__diagnose_no_route_reason, start, goal, layers, access));
cache[key] = path->call(n.k__copy_path, route);
path->set(n.k_last_no_route_reason, n.k_OK);
path->set(n.k_last_path_cost, tree_cost(n,tree, goal));
path->set(n.k_last_error, String(""));
return route;
}
public:
private:
// One existing builtin provider operation, with no new value cache. Only
// connector-free WALK rows qualify; unsupported cases call the old provider.
// All work stays private until the original final shared[current] assignment.
struct WalkEdgeNames {
const StringName resource_path{"resource_path",false}, constants_method{"get_script_constant_map",false};
const StringName front{"FRONT",false}, back{"BACK",false}, walk{"MOVEMENT_WALK",false};
const StringName base{"ORTHOGONAL_MOVE_COST",false}, congestion{"CONGESTION_COST_PER_EXCESS",false};
const StringName workspace{"_guest_tree_workspace",false}, edges{"edges",false}, indices{"indices",false};
const StringName adjacency{"_adjacency",false}, traffic{"_cell_traffic",false}, vertical{"_vertical_walk_requires_connector",false};
const StringName to{"to",false}, connector{"connector_id",false}, access{"access_id",false}, movement{"movement_type",false};
const StringName base_cost{"base_cost",false}, cost{"cost",false}, temporary{"temporary_block",false};
const StringName dynamic{"dynamic_cost",false}, density{"current_density",false}, capacity{"base_capacity",false};
const StringName provider{"_guest_tree_shared_edges",false};
};
struct WalkEdgeContext {
Object *path=nullptr;
int64_t front=0, back=0, base=0, congestion=0;
StringName walk;
};
static bool walk_edge_context(const WalkEdgeNames &n,Object *path,const Array &layers,
const Array &access,WalkEdgeContext &context) {
if (!path || layers.size()!=2 || !access.is_empty() ||
layers[0].get_type()!=Variant::INT || layers[1].get_type()!=Variant::INT) return false;
Object *script=path->get_script();
if (!script || String(script->get(n.resource_path))!="res://scripts/world/path_service.gd" ||
!script->has_method(n.constants_method)) return false;
const Variant value=script->call(n.constants_method);
if (value.get_type()!=Variant::DICTIONARY) return false;
const Dictionary constants=value;
for (const StringName &key : {n.front,n.back,n.base,n.congestion})
if (constants.get(key,Variant()).get_type()!=Variant::INT) return false;
if (constants.get(n.walk,Variant()).get_type()!=Variant::STRING_NAME ||
int64_t(layers[0])!=int64_t(constants[n.front]) ||
int64_t(layers[1])!=int64_t(constants[n.back])) return false;
context.path=path;context.front=constants[n.front];context.back=constants[n.back];
context.base=constants[n.base];context.congestion=constants[n.congestion];context.walk=constants[n.walk];
return true;
}
static bool builtin_walk_edge_rows(const WalkEdgeNames &n,const WalkEdgeContext &context,
const Vector3i &current,Array &rows) {
if (!context.path) return false;
const Variant workspace_value=context.path->get(n.workspace);
if (workspace_value.get_type()!=Variant::DICTIONARY) return false;
const Dictionary workspace=workspace_value;
const Variant shared_value=workspace.get(n.edges,Variant());
if (shared_value.get_type()!=Variant::DICTIONARY) return false;
Dictionary shared=shared_value;
// Original cached-row branch precedes readonly and all other state reads.
if (shared.has(current)) {
const Variant cached=shared[current];
if (cached.get_type()!=Variant::ARRAY) return false;
rows=cached;return true;
}
if (shared.is_read_only()) return false;
const Variant indices_value=workspace.get(n.indices,Variant()), adjacency_value=context.path->get(n.adjacency);
const Variant traffic_value=context.path->get(n.traffic), vertical_value=context.path->get(n.vertical);
if (indices_value.get_type()!=Variant::DICTIONARY || adjacency_value.get_type()!=Variant::DICTIONARY ||
traffic_value.get_type()!=Variant::DICTIONARY || vertical_value.get_type()!=Variant::BOOL) return false;
const Dictionary indices=indices_value, adjacency=adjacency_value, traffic=traffic_value;
const Variant raw_value=adjacency.get(current,Array());
if (raw_value.get_type()!=Variant::ARRAY) return false;
const Array raw=raw_value;Array result;
for (int64_t i=0;i<raw.size();++i) {
if (raw[i].get_type()!=Variant::DICTIONARY) return false;
const Dictionary edge=raw[i];
if (edge.get(n.to,Variant()).get_type()!=Variant::VECTOR3I) return false;
const Vector3i neighbor=edge[n.to];
if (neighbor.z!=context.front && neighbor.z!=context.back) continue;
const Variant row_value=traffic.get(neighbor,Dictionary());
if (row_value.get_type()!=Variant::DICTIONARY) return false;
const Dictionary row=row_value;
if (!row.is_empty()) {
if (row.get(n.temporary,Variant()).get_type()!=Variant::BOOL) return false;
if (bool(row[n.temporary])) continue;
}
// Preserve old method for every connector/access/other movement row.
if (edge.get(n.connector,Variant()).get_type()!=Variant::STRING_NAME ||
edge.get(n.access,Variant()).get_type()!=Variant::STRING_NAME ||
edge.get(n.movement,Variant()).get_type()!=Variant::STRING_NAME) return false;
const StringName connector=edge[n.connector], access=edge[n.access], movement=edge[n.movement];
if (!connector.is_empty() || !access.is_empty() || movement!=context.walk) return false;
if (bool(vertical_value) && current.y!=neighbor.y) continue;
const Variant base=edge.get(n.base_cost,edge.get(n.cost,context.base));
if (base.get_type()!=Variant::INT) return false;
int64_t dynamic=0;
if (!row.is_empty()) {
for (const StringName &key : {n.dynamic,n.density,n.capacity})
if (row.get(key,Variant()).get_type()!=Variant::INT) return false;
const int64_t excess=the_tree_native::signed_add(int64_t(row[n.density]),
the_tree_native::signed_add(~int64_t(row[n.capacity]),1));
dynamic=the_tree_native::signed_add(int64_t(row[n.dynamic]),
signed_product(excess>0?excess:0,context.congestion));
}
const int64_t cost=the_tree_native::signed_add(int64_t(base),dynamic);
Array pair;pair.push_back(neighbor);pair.push_back(cost);result.push_back(pair);
// Same short circuit and first invalid prefix as the original method.
if (cost<=0 || !indices.has(neighbor)) break;
}
shared[current]=result;rows=result;return true;
}
public:
Dictionary guest_tree_edge_rows(Object *path,const Vector3i &current,const Array &layers,const Array &access) {
const WalkEdgeNames names;WalkEdgeContext context;Array rows;
Dictionary result;const StringName supported{"supported",false}, row_key{"rows",false};
result[supported]=false;
if (!walk_edge_context(names,path,layers,access,context) ||
!builtin_walk_edge_rows(names,context,current,rows)) return result;
result[supported]=true;result[row_key]=rows;return result;
}
private:
Dictionary search_impl(const Array &cells, const Dictionary &indices, I start_index,
const Dictionary &goals, const Callable &edge_provider, bool use_edge_cache) {
Dictionary output;
output[StringName("status")] = String("unusable");
if (start_index < 0 || start_index >= cells.size() || !edge_provider.is_valid()) return output;
try {
std::vector<I> goal_indices;
const Array goal_keys = goals.keys();
for (I j = 0; j < goal_keys.size(); ++j)
goal_indices.push_back(static_cast<I>(indices.get(goal_keys[j], I(-1))));
Array arguments;
arguments.resize(1);
const WalkEdgeNames walk_names;WalkEdgeContext walk_context;
if (edge_provider.get_method()==walk_names.provider && edge_provider.get_argument_count()==1 &&
edge_provider.get_bound_arguments_count()==2 && edge_provider.get_unbound_arguments_count()==0) {
const Array bound=edge_provider.get_bound_arguments();
if (bound.size()==2 && bound[0].get_type()==Variant::ARRAY && bound[1].get_type()==Variant::ARRAY)
walk_edge_context(walk_names,edge_provider.get_object(),bound[0],bound[1],walk_context);
}
// Call the original bound Godot edge method only when the search expands a node.
// Preserve its lazy cache population, filter ordering and first invalid row.
auto original_edges = [&](I current) {
arguments[0] = cells[current];
Array fused;bool fused_supported=false;
if (cells[current].get_type()==Variant::VECTOR3I) {
const Vector3i cell=cells[current];
fused_supported=builtin_walk_edge_rows(walk_names,walk_context,cell,fused);
}
const Variant value = fused_supported ? Variant(fused) : edge_provider.callv(arguments);
if (value.get_type() != Variant::ARRAY) return std::vector<Edge>{{-1, 0}};
const Array rows = value;
std::vector<Edge> result;
result.reserve(rows.size());
for (I j = 0; j < rows.size(); ++j) {
if (rows[j].get_type() != Variant::ARRAY) { result.push_back({-1, 0}); break; }
const Array row = rows[j];
if (row.size() != 2 || row[1].get_type() != Variant::INT) {
result.push_back({-1, 0}); break;
}
const I cost = static_cast<I>(row[1]);
// Nonpositive cost is rejected before requesting the neighbor index.
if (cost <= 0) { result.push_back({-1, cost}); break; }
const I neighbor = static_cast<I>(indices.get(row[0], I(-1)));
result.push_back({neighbor, cost});
if (neighbor < 0) break;
}
return result;
};
// Borrow cached rows only during the pure numeric edge loop.
// No engine callback runs while that borrowed vector is traversed.
std::vector<Edge> converted;
auto edges = [&](I current) -> const std::vector<Edge>& {
if (use_edge_cache) {
const auto found = cached_edges.find(current);
if (found != cached_edges.end()) return found->second;
}
converted = original_edges(current);
// Preserve the returned conversion even if a reentrant provider
// populated this cache key first. Never substitute its row here.
if (use_edge_cache) cached_edges.emplace(current, converted);
return converted;
};
const auto result = the_tree_native::search(cells.size(), start_index, goal_indices, edges);
output[StringName("status")] = String(result.status.c_str());
if (result.status != "usable") return output;
PackedInt64Array costs, parents;
if (costs.resize(result.costs.size()) != OK || parents.resize(result.parents.size()) != OK) {
output[StringName("status")] = String("unusable");
return output;
}
// Newly resized, private packed arrays own their writable storage.
// A provider may shrink caller cells. Preserve the old written
// prefix and resize-created zero tail, not the whole native vector.
const I written_count=cells.size();
if(written_count<=static_cast<I>(result.costs.size())) {
std::copy_n(result.costs.begin(),written_count,costs.ptrw());
std::copy_n(result.parents.begin(),written_count,parents.ptrw());
} else {
// Keep the original unsupported-growth path unchanged.
for (I j=0;j<cells.size();++j) {costs.set(j,result.costs[j]);parents.set(j,result.parents[j]);}
}
TypedArray<int64_t> discovered, parent_discovered;
for (I j : result.discovered) discovered.push_back(j);
for (I j : result.parent_discovered) parent_discovered.push_back(j);
Dictionary settled;
for (I j : result.settled) settled[cells[j]] = true;
output[StringName("cost_values")] = costs;
output[StringName("parent_indices")] = parents;
output[StringName("discovered")] = discovered;
output[StringName("parent_discovered")] = parent_discovered;
output[StringName("settled")] = settled;
return output;
} catch (const std::exception &) {
output = Dictionary();
output[StringName("status")] = String("unusable");
return output;
}
}
};
void initialize_tree_numeric_core(ModuleInitializationLevel level) {
if (level == MODULE_INITIALIZATION_LEVEL_SCENE) GDREGISTER_CLASS(TheTreeNumericCore);
}
void uninitialize_tree_numeric_core(ModuleInitializationLevel) {}
extern "C" {
GDExtensionBool GDE_EXPORT tree_numeric_core_init(GDExtensionInterfaceGetProcAddress get_proc,
GDExtensionClassLibraryPtr library, GDExtensionInitialization *initialization) {
GDExtensionBinding::InitObject init(get_proc, library, initialization);
init.register_initializer(initialize_tree_numeric_core);
init.register_terminator(uninitialize_tree_numeric_core);
init.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init.init();
}
}
@@ -0,0 +1,11 @@
extends "/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local.gd"
const Guard := preload("/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-cache-public-mutations-r144/profile_guard.gd")
func _initialize() -> void:
if not Guard.activate(): quit(97); return
super._initialize()
func _run() -> void:
var loaded := GDExtensionManager.load_extension("/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate.gdextension")
if loaded != GDExtensionManager.LOAD_STATUS_OK or not ClassDB.class_exists(&"TheTreeNumericCore"):
push_error("exact native Guest batch extension failed to load"); quit(96); return
print("NATIVE_ADAPTER_LIBRARY_REGISTERED")
super._run()
@@ -0,0 +1,7 @@
[configuration]
entry_symbol="tree_numeric_core_init"
compatibility_minimum="4.7.2"
reloadable=false
[libraries]
macos.arm64="/private/tmp/TheTree-hot-loop-r329-41b6a86c36104f96acdf24f428667ade/candidate.dylib"
@@ -0,0 +1,64 @@
# coding: utf-8
"""One owned Guest batch ABI/local/affected-S3 execution; no full regression or release acceptance."""
from pathlib import Path
import hashlib,importlib.util,json,os,shutil,sys,uuid
sys.dont_write_bytecode=True
R=Path(__file__).resolve().parents[2];A=R/'artifacts/original-completion-2026-10-02';O=A/'p23-02-native-hot-loop-local-r329';D=R/'docs/plans/original-completion-2026-10-02'
NAMES=['IMPLEMENTATION_PLAN.md','PROGRESS_INTEGRATION.md','work_packages.json','progress_snapshot.json']
def mod(name,p):
s=importlib.util.spec_from_file_location(name,p);m=importlib.util.module_from_spec(s);s.loader.exec_module(m);return m
def main():
r=mod('guest_local_runner',R/'tools/run_all_tests.py');outer=mod('guest_local_owned',r.SUPPORT/'owned_outer.py');plan=r.read(O/'input.json');fixed=plan['pins']
assert not (O/'execution.json').exists()
stage=Path(plan['stage']);parent=Path(plan['parent']);public=(stage/'project.godot').read_bytes();private=Path(fixed['private_library']['path']).parent
source=r.source_refs(R);player=r.default_player(R);docs={n:r.sha(D/n) for n in NAMES}
assert source==plan['source_before'] and player==plan['default_before'] and docs==plan['doc4_before']
def protect():
assert r.source_refs(R)==source and r.default_player(R)==player and {n:r.sha(D/n) for n in NAMES}==docs
assert r.inventory(parent,stage=True)==plan['parent_stage_inventory'] and r.inventory(stage,stage=True)==plan['expected_stage']
assert r.inventory(r.SUPPORT)==plan['support_inventory'] and r.inventory(private)==plan['private_library_inventory']
for k,q in fixed.items():
p=Path(q['path']);assert p.stat().st_size==q['bytes'] and r.sha(p)==q['sha256'],k
def growth():return sum(p.stat().st_size for p in O.rglob('*') if p.is_file() and p.relative_to(O).parts[0]!='stage')
protect();host=r.read(fixed['host_review']['path']);assert host['host_build_accepted'] and not host['blockers']
prepath=A/'p23-02-native-guest-bulk-local-preexecution-independent-review-r315.json';pre=r.read(prepath);assert pre['execution_allowed'] and not pre['blockers']
for group in ['evidence_sha256','canonical_doc4_context_pins']:
for q in pre[group].values():
p=Path(q['path']);assert p.stat().st_size==q['bytes'] and r.sha(p)==q['sha256']
root=r.read(O/'preexecution-root-verification.json');assert root['passed'] and root['review_sha256']==r.sha(prepath)
phases=[];samples=[];error=None;cleanup=[];cleanup_errors=[];report=None
try:
protect();assert not outer.native.helper['live_engines']() and shutil.disk_usage(A).free>=plan['capacity_floor_bytes'] and growth()<=plan['maximum_measurement_growth_bytes']
output=O/'local-measurement';output.mkdir();ident=uuid.uuid4().hex;startup='TheTree-PCK-tests-'+ident+'-guest-startup';profile='TheTree-PCK-tests-'+ident+'-guest-runtime'
assert not r.profile_path(startup).exists() and not r.profile_path(profile).exists()
env=r.fresh_environment(os.environ);env.update(THE_TREE_PACK_PROFILE_NAME=profile,THE_TREE_PACK_PROFILE_EXPECTED=str(r.profile_path(profile)),THE_TREE_PACK_PROFILE_REPORT=str(O/'local-profile.json'),THE_TREE_RUNTIME_MONITOR_OUTPUT=str(output))
(stage/'project.godot').write_bytes(r.private_project(public,startup));phase=O/'local'
argv=[fixed['engine']['path'],'--headless','--path',str(stage),'--script',fixed['starter']['path'],'--verbose','--log-file',str(phase/'engine-native.log')]
result,capture=outer.run_phase(argv,phase,90,env,now_fn=r.now,dump_fn=r.write,sha_fn=r.sha,live_engines_fn=outer.native.helper['live_engines'])
phases.append(dict(name='local',result=result,capture=capture));r.write(O/'local-phase.json',phases[0])
report=r.read(output/'report.json') if (output/'report.json').exists() else None
if report:samples.append(dict(name='local',report=report))
assert result is not None and result['exit_code']==0 and not result['error_lines'] and not result['timed_out'] and capture['passed']
logs=''.join((phase/n).read_text() for n in ['stdout.log','stderr.log','engine-native.log'])
assert 'Orphan StringName:' not in logs and 'unclaimed string names' not in logs
assert report and report['passed'] and report['failures']==0 and report['pid']==result['pid']
count=plan['expected_case_counts'];assert report['pure_case_count']==count['pure'] and report['decision_case_count']==count['decision'] and report['custom_fallback_case_count']==count['custom_fallback'] and report['original_s3_invocations']==count['original_s3_invocations']
stdout=(phase/'stdout.log').read_text();assert stdout.count('Guest bulk local: %d checks, 0 failures'%report['checks'])==1 and stdout.count('NATIVE_ADAPTER_LIBRARY_REGISTERED')==1
fixture=output/'fixtures.varbytes';assert fixture.stat().st_size==report['fixture_bytes'] and r.sha(fixture)==report['fixture_sha256']
protocol=r.read(output/'protocol-report.json');assert protocol['passed'] and not protocol['failures'] and len(protocol['cases'])==50 and len(protocol['cached_cases'])==50 and protocol['checks']==report['protocol_checks']
assert fixture.read_bytes()==Path(plan['original_Guest_fixture']['path']).read_bytes(), 'Unchanged full Guest53 original fixture bytes'
r.profile_gate(r.profile_path(profile),O/'local-profile.json',profile)
assert growth()<=plan['maximum_measurement_growth_bytes']
(stage/'project.godot').write_bytes(public);protect()
except BaseException as caught:error=type(caught).__name__+': '+str(caught)
finally:
cleanup,cleanup_errors=outer.finish_captured(outer.OWNED)
if all(q['engine_ended'] is True for q in cleanup):(stage/'project.godot').write_bytes(public)
else:cleanup_errors.append('Restoration refused while actual owned child remains live')
guard_errors=[]
try:protect()
except BaseException as caught:guard_errors.append(type(caught).__name__+': '+str(caught))
passed=error is None and not guard_errors and not cleanup_errors and len(phases)==1 and len(samples)==1
r.write(O/'execution.json',dict(passed=passed,error=error,guard_errors=guard_errors,phases=phases,samples=samples,cleanup=cleanup,cleanup_errors=cleanup_errors,input_source_default_doc4_parent_support_private_preserved=not guard_errors,compiler_processes=0,full_regression_runs=0,candidate_selected=False,candidate_adopted=False,unit_accepted=False,performance_accepted=False,normal_OS_accepted=False,Windows_accepted=False,limitations=['Finite Guest53 and18 affected original S3 methods plus frozen50 protocols/shrink/ownership/reentrant collision on same new bridge. Literal original Guest source oracle removes class_name line only. No Runtime cold646→647 whole state, ordinary OS/reentry domain, arbitrary conversion or memory failure, final full regression, performance budget/P95/D10, Windows or adoption/unit acceptance.']))
print(json.dumps(dict(passed=passed,error=error,guard_errors=guard_errors)),flush=True);return 0 if passed else 1
if __name__=='__main__':raise SystemExit(main())
@@ -0,0 +1,18 @@
{
"owned_child_created": true,
"engine_ended": true,
"actual_process_exit_code": 0,
"attempts": [
{
"attempt": 1,
"kill_attempted": false,
"wait_timeout_seconds": 5,
"wait_completed": true,
"errors": [],
"poll_before": 0,
"wait_returned_code": 0,
"poll_after": 0
}
],
"errors": []
}
@@ -0,0 +1,38 @@
{
"scope": "isolated diagnostic owned child",
"event": "ENGINE_ENDED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 4535962000,
"exit_code": 0,
"actual_process_exit_code": 0,
"engine_ended": true,
"timed_out": false,
"lifecycle_error": null,
"start_receipt_written": true,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"ended_utc": "2026-10-12T03:57:44.034797+00:00",
"signal_scope": "tracked Popen child only; no external group signal"
}
@@ -0,0 +1,39 @@
{
"actual_captured_pids": [
36884
],
"cleanup": [
{
"pid": 36884,
"cleanup": {
"owned_child_created": true,
"engine_ended": true,
"actual_process_exit_code": 0,
"attempts": [
{
"attempt": 1,
"kill_attempted": false,
"wait_timeout_seconds": 5,
"wait_completed": true,
"errors": [],
"poll_before": 0,
"wait_returned_code": 0,
"poll_after": 0
}
],
"errors": []
},
"outer_cleanup_errors": [],
"engine_ended": true,
"outer_maximum_helper_invocations": 3,
"helper_maximum_waits": 3,
"per_wait_timeout_seconds": 5,
"foreign_process_or_group_signals": 0
}
],
"adapter_exception": null,
"all_captured_ended": true,
"outer_cleanup_errors": [],
"foreign_process_or_group_signals": 0,
"all_cleanup_before_outer_receipt": true
}
@@ -0,0 +1,140 @@
{
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"pid": 36884,
"started_utc": "2026-10-12T03:57:42.177687+00:00",
"ended_utc": "2026-10-12T03:57:44.040127+00:00",
"wall_seconds": 1.86218475,
"exit_code": 0,
"helper_exit_code": 0,
"timed_out": false,
"stdout_sha256": "0d80fd887d3ae60d97ac91ec360387c6dd4aa06b0417cc000f2567e5b401735f",
"stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"error_lines": [],
"owned_popen_ended": true,
"old_helper_engine_ended": true,
"start_receipt_written": true,
"end_receipt_written": true,
"lifecycle_error": null,
"old_helper_lifecycle_error": null,
"actual_start_binding": {
"scope": "isolated diagnostic owned child",
"event": "ENGINE_STARTED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 2683606125,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"started_utc": "2026-10-12T03:57:42.177687+00:00",
"current_process_identity": {
"pid": 36884,
"ppid": 36862,
"pgid": 36884,
"args": "/Applications/Godot.app/Contents/MacOS/Godot --headless --path /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage --script /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd --verbose --log-file /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
},
"live_identity_exact": true,
"tracked_child_ended_before_initial_probe": false,
"signal_scope": "tracked Popen child only; no external group signal"
},
"actual_end_binding": {
"scope": "isolated diagnostic owned child",
"event": "ENGINE_ENDED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 4535962000,
"exit_code": 0,
"actual_process_exit_code": 0,
"engine_ended": true,
"timed_out": false,
"lifecycle_error": null,
"start_receipt_written": true,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"ended_utc": "2026-10-12T03:57:44.034797+00:00",
"signal_scope": "tracked Popen child only; no external group signal"
},
"strict_native_diagnostics": {
"errors": [],
"banner_count": 1,
"known_unicode_diagnostic_count": 0,
"unrecognized_unicode_diagnostic_count": 0,
"exit_leak_diagnostic_lines": []
},
"external_process_or_group_signals": 0,
"owned_child_process_helper_sha256": "c007e712c281573254faa1233c2ac92e100ab87393256a6dc096b35283e43037",
"adapter_owned_cleanup": {
"owned_child_created": true,
"engine_ended": true,
"actual_process_exit_code": 0,
"attempts": [
{
"attempt": 1,
"kill_attempted": false,
"wait_timeout_seconds": 5,
"wait_completed": true,
"errors": [],
"poll_before": 0,
"wait_returned_code": 0,
"poll_after": 0
}
],
"errors": []
},
"adapter_error": null,
"old_helper_bytes_preserved": true,
"helper_wait_None_maps_to_actual_timeout_seconds": 5,
"explicit_helper_wait_timeouts_preserved": true,
"additional_cleanup_wait_timeout_seconds": 5,
"additional_cleanup_max_attempts": 3
}
@@ -0,0 +1,40 @@
{
"scope": "isolated diagnostic owned child",
"event": "ENGINE_STARTED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 2683606125,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"started_utc": "2026-10-12T03:57:42.177687+00:00",
"current_process_identity": {
"pid": 36884,
"ppid": 36862,
"pgid": 36884,
"args": "/Applications/Godot.app/Contents/MacOS/Godot --headless --path /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage --script /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd --verbose --log-file /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
},
"live_identity_exact": true,
"tracked_child_ended_before_initial_probe": false,
"signal_scope": "tracked Popen child only; no external group signal"
}
@@ -0,0 +1,16 @@
{
"checks": 7415,
"custom_fallback_case_count": 7,
"decision_case_count": 4,
"failures": 0,
"fixture_bytes": 606268,
"fixture_sha256": "6ec6e879a2de02b9d4081295b33e53e2060f31829e1fb674168a414d8b3e5c2e",
"original_s3_invocations": 18,
"passed": true,
"performance_accepted": false,
"pid": 36884,
"protocol_cases": 50,
"protocol_checks": 6722,
"pure_case_count": 42,
"unit_accepted": false
}
@@ -0,0 +1,185 @@
{
"name": "local",
"result": {
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"pid": 36884,
"started_utc": "2026-10-12T03:57:42.177687+00:00",
"ended_utc": "2026-10-12T03:57:44.040127+00:00",
"wall_seconds": 1.86218475,
"exit_code": 0,
"helper_exit_code": 0,
"timed_out": false,
"stdout_sha256": "0d80fd887d3ae60d97ac91ec360387c6dd4aa06b0417cc000f2567e5b401735f",
"stderr_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"error_lines": [],
"owned_popen_ended": true,
"old_helper_engine_ended": true,
"start_receipt_written": true,
"end_receipt_written": true,
"lifecycle_error": null,
"old_helper_lifecycle_error": null,
"actual_start_binding": {
"scope": "isolated diagnostic owned child",
"event": "ENGINE_STARTED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 2683606125,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"started_utc": "2026-10-12T03:57:42.177687+00:00",
"current_process_identity": {
"pid": 36884,
"ppid": 36862,
"pgid": 36884,
"args": "/Applications/Godot.app/Contents/MacOS/Godot --headless --path /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage --script /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd --verbose --log-file /Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
},
"live_identity_exact": true,
"tracked_child_ended_before_initial_probe": false,
"signal_scope": "tracked Popen child only; no external group signal"
},
"actual_end_binding": {
"scope": "isolated diagnostic owned child",
"event": "ENGINE_ENDED",
"actual_pid": 36884,
"owner_pid": 36862,
"command": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"monotonic_ns": 4535962000,
"exit_code": 0,
"actual_process_exit_code": 0,
"engine_ended": true,
"timed_out": false,
"lifecycle_error": null,
"start_receipt_written": true,
"pid": 36884,
"argv": [
"/Applications/Godot.app/Contents/MacOS/Godot",
"--headless",
"--path",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-local-r315/stage",
"--script",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/candidate-guarded.gd",
"--verbose",
"--log-file",
"/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/local/engine-native.log"
],
"ended_utc": "2026-10-12T03:57:44.034797+00:00",
"signal_scope": "tracked Popen child only; no external group signal"
},
"strict_native_diagnostics": {
"errors": [],
"banner_count": 1,
"known_unicode_diagnostic_count": 0,
"unrecognized_unicode_diagnostic_count": 0,
"exit_leak_diagnostic_lines": []
},
"external_process_or_group_signals": 0,
"owned_child_process_helper_sha256": "c007e712c281573254faa1233c2ac92e100ab87393256a6dc096b35283e43037",
"adapter_owned_cleanup": {
"owned_child_created": true,
"engine_ended": true,
"actual_process_exit_code": 0,
"attempts": [
{
"attempt": 1,
"kill_attempted": false,
"wait_timeout_seconds": 5,
"wait_completed": true,
"errors": [],
"poll_before": 0,
"wait_returned_code": 0,
"poll_after": 0
}
],
"errors": []
},
"adapter_error": null,
"old_helper_bytes_preserved": true,
"helper_wait_None_maps_to_actual_timeout_seconds": 5,
"explicit_helper_wait_timeouts_preserved": true,
"additional_cleanup_wait_timeout_seconds": 5,
"additional_cleanup_max_attempts": 3
},
"capture": {
"actual_captured_pids": [
36884
],
"cleanup": [
{
"pid": 36884,
"cleanup": {
"owned_child_created": true,
"engine_ended": true,
"actual_process_exit_code": 0,
"attempts": [
{
"attempt": 1,
"kill_attempted": false,
"wait_timeout_seconds": 5,
"wait_completed": true,
"errors": [],
"poll_before": 0,
"wait_returned_code": 0,
"poll_after": 0
}
],
"errors": []
},
"outer_cleanup_errors": [],
"engine_ended": true,
"outer_maximum_helper_invocations": 3,
"helper_maximum_waits": 3,
"per_wait_timeout_seconds": 5,
"foreign_process_or_group_signals": 0
}
],
"adapter_exception": null,
"all_captured_ended": true,
"outer_cleanup_errors": [],
"foreign_process_or_group_signals": 0,
"all_cleanup_before_outer_receipt": true,
"outer_receipt_written": true,
"outer_receipt_error": null,
"passed": true
}
}
@@ -0,0 +1,20 @@
{
"actual_user_data_dir": "/Users/korizatou114/Library/Application Support/TheTree-PCK-tests-8457ef5c03f34d3e873fd1f43b7716fd-guest-runtime",
"before": "/Users/korizatou114/Library/Application Support/TheTree-PCK-tests-8457ef5c03f34d3e873fd1f43b7716fd-guest-startup",
"conditions": [
true,
true,
true,
true,
true
],
"conditions_checked": 5,
"custom_user_dir_name": "TheTree-PCK-tests-8457ef5c03f34d3e873fd1f43b7716fd-guest-runtime",
"expected_user_data_dir": "/Users/korizatou114/Library/Application Support/TheTree-PCK-tests-8457ef5c03f34d3e873fd1f43b7716fd-guest-runtime",
"fresh_before_parent_initialize": true,
"globalized_probe": "/Users/korizatou114/Library/Application Support/TheTree-PCK-tests-8457ef5c03f34d3e873fd1f43b7716fd-guest-runtime/guard-probe",
"profile_writes_before_guard": 0,
"project_settings_persisted": false,
"runtime_settings_only": true,
"verified": true
}
@@ -0,0 +1,285 @@
extends "res://tests/s3/test_guest_service.gd"
const OriginalGuestScript = preload("/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-original-oracle-r315.gd")
class CustomGuest:
extends GuestRuntime
class CustomDefinition:
extends GuestDefinition
class CustomService:
extends GuestService
class FakeCore:
extends RefCounted
var calls := 0
func guest_candidate_batch(_owner, _id, _facilities, _context) -> Dictionary:
calls += 1
return {&"supported": false}
const ProtocolHelper = preload("/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-local-r329/protocol_helper.gd")
var _bulk_records: Array = []
var _bulk_core: Object
var _bulk_cases := 0
func _bulk_state(service) -> Array:
var order: Array[StringName] = service._sorted_guest_ids_cache.duplicate()
var dirty: bool = service._guest_order_dirty
return [service.create_snapshot(), service.last_error, service._decision_rejections.duplicate(true), service._diagnostics.duplicate(true), order, dirty, service._pending_spawn_notifications.duplicate(true), service._external_mutation_blocked, service.current_minute]
func _bulk_prime(service) -> void:
service.get_guests()
func _bulk_original(service):
var oracle = OriginalGuestScript.new()
_expect(oracle.restore_snapshot(service.create_snapshot()), "literal original Guest independent state restored")
_bulk_prime(oracle)
return oracle
func _bulk_array_shape(rows: Array) -> Array:
var shapes: Array = [rows.is_typed(), rows.get_typed_builtin(), rows.is_read_only()]
for row: Dictionary in rows:
shapes.append([row.is_typed(), row.is_read_only()])
return shapes
func _bulk_service() -> GuestService:
var service := _service_with_definitions()
service.spawn_guest(&"bulk", &"adventurer", 0, {
&"wallet_gold": 500, &"planned_exit_at": 1000,
&"state": GuestRuntimeType.State.DECIDING,
&"needs": {&"hunger": 80, &"sleep": 30, &"hygiene": 40, &"medical": 20, &"leisure": 60, &"intimacy": 50},
})
_bulk_prime(service)
return service
func _bulk_compare(label: String, rows: Array, patch: Dictionary = {}, context: Dictionary = {}) -> void:
_bulk_cases += 1
var service := _bulk_service()
var oracle = _bulk_original(service)
var guest := service.get_guest(&"bulk")
for key: Variant in patch:
guest.set(key, patch[key])
oracle.get_guest(&"bulk").set(key, patch[key])
service.last_error = "retained-before-pure-call"
var before := var_to_bytes(_bulk_state(service))
var input_before := var_to_bytes(rows)
var batch: Dictionary = _bulk_core.call(&"guest_candidate_batch", service, &"bulk", rows, context)
_expect(bool(batch.get(&"supported", false)), label + " supported fixed pure input")
_expect(var_to_bytes(_bulk_state(service)) == before, label + " pure call preserves full Guest snapshot/errors/rejections")
_expect(var_to_bytes(rows) == input_before, label + " input ownership preserved")
if not bool(batch.get(&"supported", false)): return
var accepted: Array[Dictionary] = oracle.extract_candidates(&"bulk", rows, context)
var rejected: Array[Dictionary] = oracle.get_last_candidate_rejections(&"bulk")
var ranked: Array[Dictionary] = oracle.rank_candidates(&"bulk", accepted)
_expect(_bulk_array_shape(batch[&"accepted"]) == _bulk_array_shape(accepted), label + " accepted type/readonly shape original equality")
_expect(_bulk_array_shape(batch[&"ranked"]) == _bulk_array_shape(ranked), label + " ranked type/readonly shape original equality")
_expect(var_to_bytes(batch[&"accepted"]) == var_to_bytes(accepted), label + " entire ordered typed accepted original equality")
_expect(var_to_bytes(batch[&"rejected"]) == var_to_bytes(rejected), label + " entire ordered typed rejection original equality")
_expect(var_to_bytes(batch[&"ranked"]) == var_to_bytes(ranked), label + " entire ordered typed scoring/ranking original equality")
_bulk_records.append({&"case": label, &"input": rows.duplicate(true), &"context": context.duplicate(true), &"patch": patch.duplicate(true), &"actual": batch.duplicate(true), &"accepted_original": accepted, &"rejected_original": rejected, &"ranked_original": ranked})
if not (batch[&"ranked"] as Array).is_empty():
var accepted_before := var_to_bytes(batch[&"accepted"])
var actual: Dictionary = batch[&"ranked"][0]
actual[&"ownership_probe"] = true
if actual.get(&"path_handle") is Dictionary: actual[&"path_handle"][&"ownership_probe"] = true
_expect(var_to_bytes(rows) == input_before, label + " ranked mutation is isolated from caller input")
_expect(var_to_bytes(batch[&"accepted"]) == accepted_before, label + " ranked deep copy is isolated from accepted candidates")
func _test_bulk_candidates() -> void:
_bulk_core = ClassDB.instantiate(&"TheTreeNumericCore")
_expect(_bulk_core != null and _bulk_core.has_method(&"guest_candidate_batch"), "exact new batch binding exists")
if _bulk_core == null or not _bulk_core.has_method(&"guest_candidate_batch"): return
var base := _candidate(&"a", {&"need_relief": {&"hunger": 80, &"leisure": 20}, &"facility_tags": [&"meal", &"leisure", &"meal"], &"path_handle": {&"path": [Vector3i.ZERO, Vector3i(1, 0, 0)], &"target_cell": Vector3i(1, 0, 0)}})
_bulk_compare("ordinary", [base])
_bulk_compare("empty", [])
_bulk_compare("skip-nondictionary-and-empty-id", [null, 4, "ignored", {}, {&"facility_id": &""}, base])
var duplicates: Array = []
for i in range(64):
var row := base.duplicate(true)
row[&"facility_id"] = StringName("b" if i % 3 == 0 else "a")
row[&"probe_index"] = i
duplicates.append(row)
_bulk_compare("equal-sort-keys64", duplicates)
var branches := [
{&"need_relief": {&"rest": 1}, &"inputs_available": false},
{&"need_effects": {&"hunger": 1.0}},
{&"need_relief": null}, {&"need_relief": true},
{&"inputs_available": false, &"adult_only": true},
{&"adult_only": true}, {&"required_guest_tags": [&"missing"]},
{&"forbidden_guest_tags": [&"general"]}, {&"allowed_guest_types": [&"other"]},
{&"is_open": false, &"reachable": false}, {&"reachable": false},
{&"travel_minutes": 1001}, {&"price_gold": 10000},
{&"wait_minutes": 120}, {&"risk_level": 100}, {&"illegal_level": 100},
{&"expected_quality": 0}, {&"is_open": false, &"open_at_arrival": true},
{&"credit_allowed": true, &"price_gold": 550},
{&"discretionary": true, &"price_gold": 400},
{&"respect_survival_reserve": false, &"discretionary": true, &"price_gold": 400},
{&"risk": 90, &"risk_level": 0, &"risk_sensitivity": 3},
{&"legal_permission_override": true, &"illegal_level": 100},
{&"need_relief": -100, &"travel_minutes": -2, &"wait_minutes": -3},
{&"ok": false}, {&"ok": 0},
{&"preference": 9223372036854775807, &"group_fit": -9223372036854775808, &"repetition_penalty": -9223372036854775808},
{&"price_gold": 9223372036854775807, &"credit_allowed": true},
{&"risk": 9223372036854775807, &"risk_level": 0, &"risk_sensitivity": 9223372036854775807},
{&"need_relief": {"hunger": 9223372036854775807, "medical": -9223372036854775808}},
{&"novelty": -10, &"urgency": 77, &"price_burden": 100},
]
for i in range(branches.size()):
var row := base.duplicate(true)
for key: Variant in branches[i]: row[key] = branches[i][key]
_bulk_compare("branch-%02d" % i, [row, base])
var string_keys := {}
for key: Variant in base: string_keys[String(key)] = base[key]
_bulk_compare("string-keys", [string_keys])
_bulk_compare("visited-defaults", [base], {&"visited_facility_ids": [&"a"]})
_bulk_compare("addiction-removes-reserve", [_candidate(&"a", {&"discretionary": true, &"price_gold": 500})], {&"addiction_by_tag": {&"gambling": 75}})
_bulk_compare("wallet-wrap", [base], {&"wallet_gold": 9223372036854775807, &"credit_limit_gold": 9223372036854775807, &"debt_gold": -9223372036854775808})
_bulk_compare("context-gates", [base], {}, {&"absolute_minute": 999, &"wait_hard_limit": 1})
var readonly := base.duplicate(true)
readonly.make_read_only()
var readonly_rows: Array = [readonly]
readonly_rows.make_read_only()
_bulk_compare("readonly-input", readonly_rows)
var rank_rows: Array = [
_candidate(&"priority", {&"need_relief": {&"hunger": 1}, &"novelty": 0}),
_candidate(&"medical", {&"need_relief": {&"medical": 100}, &"preference": 100}),
_candidate(&"utility", {&"need_relief": {&"hunger": 1}, &"novelty": 10}),
_candidate(&"urgency-a", {&"need_relief": {&"hunger": 1}, &"urgency": 90}),
_candidate(&"urgency-b", {&"need_relief": {&"hunger": 1}, &"urgency": 10}),
_candidate(&"travel-a", {&"need_relief": {&"hunger": 1}, &"travel_minutes": 1, &"group_fit": 1}),
_candidate(&"travel-b", {&"need_relief": {&"hunger": 1}, &"travel_minutes": 2, &"group_fit": 2}),
]
_bulk_compare("all-rank-tuple-components", rank_rows)
_test_bulk_fallback_and_decision(base)
_test_bulk_custom_and_typed(base)
func _test_bulk_fallback_and_decision(base: Dictionary) -> void:
for label in ["ordinary", "float-conversion", "reach-callback", "reserve-callback"]:
var actual := _bulk_service()
var oracle = _bulk_original(actual)
var a_signals: Array = []
var b_signals: Array = []
actual.guest_state_changed.connect(func(id: StringName, old: int, new_state: int, reason: StringName) -> void: a_signals.append([id, old, new_state, reason]))
oracle.guest_state_changed.connect(func(id: StringName, old: int, new_state: int, reason: StringName) -> void: b_signals.append([id, old, new_state, reason]))
var a_calls: Array = []
var b_calls: Array = []
var a_context := {&"absolute_minute": 10}
var b_context := {&"absolute_minute": 10}
if label == "reach-callback":
a_context[&"reachability_callback"] = func(_guest: GuestRuntime, candidate: Dictionary, _context: Dictionary) -> bool:
a_calls.append(candidate[&"facility_id"]); candidate[&"callback_probe"] = true; return true
b_context[&"reachability_callback"] = func(_guest: GuestRuntime, candidate: Dictionary, _context: Dictionary) -> bool:
b_calls.append(candidate[&"facility_id"]); candidate[&"callback_probe"] = true; return true
if label == "reserve-callback":
a_context[&"reserve_callback"] = func(_guest_id: StringName, facility_id: StringName, candidate: Dictionary) -> bool:
a_calls.append(facility_id); candidate[&"callback_probe"] = true; return true
b_context[&"reserve_callback"] = func(_guest_id: StringName, facility_id: StringName, candidate: Dictionary) -> bool:
b_calls.append(facility_id); candidate[&"callback_probe"] = true; return true
var row := base.duplicate(true)
if label == "float-conversion": row[&"travel_minutes"] = 1.75
var input_before := var_to_bytes([row])
var state_before := var_to_bytes(_bulk_state(actual))
var batch: Dictionary = _bulk_core.call(&"guest_candidate_batch", actual, &"bulk", [row], a_context)
_expect(bool(batch[&"supported"]) == (label == "ordinary"), label + " supported or whole original fallback domain")
_expect(var_to_bytes(_bulk_state(actual)) == state_before and a_calls.is_empty(), label + " probe causes no observable state/callback effects")
var got := actual.decide_with_native_candidates(_bulk_core, &"bulk", [row], 10, a_context)
var expected: Dictionary = oracle.decide(&"bulk", [row], 10, b_context)
_expect(var_to_bytes(got) == var_to_bytes(expected), label + " entire typed decision result matches original")
_expect(var_to_bytes(_bulk_state(actual)) == var_to_bytes(_bulk_state(oracle)), label + " entire Guest state/errors/rejection matches original")
_expect(a_calls == b_calls, label + " callback count/order preserves original single dispatch")
_expect(a_signals == b_signals, label + " state notification content/order original equality")
_expect(var_to_bytes([row]) == input_before, label + " decision input ownership preserved")
_bulk_records.append({&"decision_case": label, &"actual_result": got, &"original_result": expected, &"actual_state": _bulk_state(actual), &"original_state": _bulk_state(oracle), &"actual_calls": a_calls, &"original_calls": b_calls, &"actual_signals": a_signals, &"original_signals": b_signals})
func _test_bulk_custom_and_typed(base: Dictionary) -> void:
for label in ["typed-dictionary", "custom-guest", "custom-definition", "custom-service", "fake-core", "unknown-guest", "missing-definition"]:
var actual = _bulk_service()
var oracle = _bulk_original(actual)
var row: Dictionary = base.duplicate(true)
if label == "typed-dictionary":
var typed: Dictionary[StringName, Variant] = {}
for key: Variant in row: typed[StringName(key)] = row[key]
row = typed
if label == "custom-guest":
var custom := CustomGuest.new()
custom.configure(&"bulk", &"adventurer", actual.get_guest(&"bulk").create_snapshot())
actual._guests[&"bulk"] = custom
if label == "custom-definition":
var custom := CustomDefinition.new()
custom.configure(&"adventurer", actual.get_definition(&"adventurer").create_snapshot())
actual._definitions[&"adventurer"] = custom
if label == "custom-service":
var custom := CustomService.new()
_expect(custom.restore_snapshot(actual.create_snapshot()), label + " custom owner independent restore")
actual = custom
_bulk_prime(actual)
if label == "unknown-guest":
actual._guests.clear(); actual._guest_order_dirty = true
oracle._guests.clear(); oracle._guest_order_dirty = true
if label == "missing-definition":
actual._definitions.erase(&"adventurer")
oracle._definitions.erase(&"adventurer")
_bulk_prime(actual); _bulk_prime(oracle)
var before := var_to_bytes(_bulk_state(actual))
var input_before := var_to_bytes([row])
var selected_core: Object = FakeCore.new() if label == "fake-core" else _bulk_core
var probe: Dictionary = _bulk_core.call(&"guest_candidate_batch", actual, &"bulk", [row], {})
_expect(bool(probe[&"supported"]) == (label == "fake-core"), label + " unsupported domain gate")
_expect(var_to_bytes(_bulk_state(actual)) == before, label + " unsupported returns before error/state changes")
var got: Dictionary = actual.decide_with_native_candidates(selected_core, &"bulk", [row], 10, {})
var expected: Dictionary = oracle.decide(&"bulk", [row], 10, {})
_expect(var_to_bytes(got) == var_to_bytes(expected), label + " literal original decision equality")
_expect(var_to_bytes(_bulk_state(actual)) == var_to_bytes(_bulk_state(oracle)), label + " literal original state/error/rejection equality")
_expect(var_to_bytes([row]) == input_before, label + " original fallback input ownership")
if label == "fake-core": _expect(int(selected_core.get("calls")) == 0, "non-native core does not receive public wrapper call")
_bulk_records.append({&"fallback_case": label, &"actual_result": got, &"original_result": expected, &"actual_state": _bulk_state(actual), &"original_state": _bulk_state(oracle)})
_bulk_core = null
func _bulk_sha256(bytes: PackedByteArray) -> String:
var digest := HashingContext.new()
if digest.start(HashingContext.HASH_SHA256) != OK: return ""
if digest.update(bytes) != OK: return ""
return digest.finish().hex_encode()
func _run() -> void:
_test_definition_and_runtime_contract()
_test_need_updates_and_single_clamp()
_test_need_context_and_adult_gate()
_test_shared_need_context_fast_paths()
_test_batched_need_updates_match_individual_api()
_test_candidate_filtering()
_test_integer_utility_and_stable_tie_break()
_test_primary_need_priority()
_test_state_machine_and_loop_guard()
_test_atomic_queue_abandonment()
_test_service_interruption_is_idempotent()
_test_service_need_effect_schema()
_test_path_failure_safe_recovery()
_test_exit_persistence_boundary()
_test_overdue_departure_snapshot()
_test_snapshot_round_trip_and_atomic_rejection()
_test_v1_need_migration_and_schema_rejection()
_test_deterministic_decision_snapshot()
_test_bulk_candidates()
var output := OS.get_environment("THE_TREE_RUNTIME_MONITOR_OUTPUT")
var protocol = ProtocolHelper.new()
var protocol_core: Object = ClassDB.instantiate(&"TheTreeNumericCore")
var protocol_report: Dictionary = protocol.run_frozen(protocol_core,"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-bridge-Godot-protocol-preparation-r73/pinned-inputs.json")
var core_ref: WeakRef = weakref(protocol_core)
protocol_core = null
_expect(core_ref.get_ref() == null, "combined protocol core with populated cache releases")
_checks += int(protocol_report["checks"])
_failures += protocol_report["failures"].size()
var protocol_file := FileAccess.open(output.path_join("protocol-report.json"),FileAccess.WRITE)
if protocol_file == null: quit(98); return
protocol_file.store_string(JSON.stringify(protocol_report,"\t")+"\n");protocol_file.close()
protocol = null
var bytes := var_to_bytes(_bulk_records)
var file := FileAccess.open(output.path_join("fixtures.varbytes"), FileAccess.WRITE)
if file == null: quit(98); return
file.store_buffer(bytes); file.close()
var report := {"passed": _failures == 0, "checks": _checks, "failures": _failures, "pure_case_count": _bulk_cases, "decision_case_count": 4, "custom_fallback_case_count": 7, "original_s3_invocations": 18, "protocol_cases": 50, "protocol_checks": int(protocol_report["checks"]), "pid": OS.get_process_id(), "fixture_bytes": bytes.size(), "fixture_sha256": _bulk_sha256(bytes), "performance_accepted": false, "unit_accepted": false}
file = FileAccess.open(output.path_join("report.json"), FileAccess.WRITE)
if file == null: quit(98); return
file.store_string(JSON.stringify(report, "\t") + "\n"); file.close()
print("Guest bulk local: %d checks, %d failures" % [_checks, _failures])
quit(0 if _failures == 0 else 1)
@@ -0,0 +1,292 @@
extends RefCounted
# Isolated protocol/marshalling QA only. No production PathService or performance claim.
class EdgeProvider extends RefCounted:
var rows: Array = []
var calls: Array[int] = []
func edges(cell: Vector3i) -> Array:
calls.append(cell.x)
return rows[cell.x]
class ShrinkingProvider extends RefCounted:
var cells: Array[Vector3i] = []
var calls: Array[Vector3i] = []
func edges(cell: Vector3i) -> Array:
calls.append(cell)
cells.resize(2)
return [[Vector3i(1, 0, 0), 7]]
var failures: Array[String] = []
var checks: int = 0
var cases: Array = []
var cached_cases: Array = []
func _check(condition: bool, label: String) -> void:
checks += 1
if not condition:
failures.append(label)
func _ints(text: String) -> Array[int]:
var result: Array[int] = []
for token in text.replace("\n", " ").split(" ", false):
_check(token.is_valid_int() and str(token.to_int()) == token, "canonical signed integer " + token)
result.append(token.to_int())
return result
func _line(values) -> String:
var text: PackedStringArray = []
for value in values:
text.append(str(value))
return " ".join(text) + "\n"
func _serialized(output: Dictionary) -> String:
var status = output.get(&"status", "missing")
_check(typeof(status) == TYPE_STRING, "status String")
var text: String = str(status) + "\n"
for key in output:
_check(typeof(key) == TYPE_STRING_NAME, "output StringName key")
if status != "usable":
_check(output.size() == 1, "unusable/wrapped status only")
return text
_check(output.size() == 6, "usable six output fields")
_check(typeof(output.get(&"cost_values")) == TYPE_PACKED_INT64_ARRAY, "cost PackedInt64Array")
_check(typeof(output.get(&"parent_indices")) == TYPE_PACKED_INT64_ARRAY, "parents PackedInt64Array")
for name in [&"discovered", &"parent_discovered"]:
var values = output.get(name)
_check(typeof(values) == TYPE_ARRAY and values.is_typed() and values.get_typed_builtin() == TYPE_INT, "typed Array[int] " + str(name))
for name in [&"cost_values", &"parent_indices", &"discovered", &"parent_discovered"]:
text += _line(output.get(name, []))
var settled: Dictionary = output.get(&"settled", {})
var indices: Array[int] = []
for cell in settled:
_check(typeof(cell) == TYPE_VECTOR3I and typeof(settled[cell]) == TYPE_BOOL and settled[cell], "settled Vector3i -> true")
indices.append(cell.x)
text += _line(indices)
return text
func _case(core, row: Dictionary) -> void:
var tokens := _ints(FileAccess.get_file_as_string(row["input_path"]))
var count: int = tokens[0]
var start: int = tokens[1]
var goal_count: int = tokens[2]
var cursor: int = 3
var cells: Array[Vector3i] = []
var indices: Dictionary = {}
for i in count:
var cell := Vector3i(i, 0, 0)
cells.append(cell)
indices[cell] = i
var goals: Dictionary = {}
for i in goal_count:
goals[Vector3i(tokens[cursor], 0, 0)] = true
cursor += 1
var provider := EdgeProvider.new()
for i in count:
var edge_count: int = tokens[cursor]
cursor += 1
var edges: Array = []
for j in edge_count:
edges.append([Vector3i(tokens[cursor], 0, 0), tokens[cursor + 1]])
cursor += 2
provider.rows.append(edges)
_check(cursor == tokens.size(), "complete input consumption")
var before := var_to_bytes([cells, indices, goals, provider.rows])
var output = core.call("search", cells, indices, start, goals, Callable(provider, "edges"))
_check(typeof(output) == TYPE_DICTIONARY, "result Dictionary")
var actual := _serialized(output)
var expected := FileAccess.get_file_as_string(row["expected_path"])
_check(actual == expected, "whole protocol bytes: " + str(row["group"]) + " / " + str(row["case"]))
_check(var_to_bytes([cells, indices, goals, provider.rows]) == before, "caller input ownership")
cases.append({"group": row["group"], "case": row["case"], "actual": actual, "expected_sha256": row["expected_sha256"], "equal": actual == expected, "provider_calls": provider.calls.duplicate()})
# Separate cached API: one immutable caller graph until explicit clear.
core.call("clear_edge_cache")
provider.calls.clear()
var cold: Dictionary = core.call("search_cached", cells, indices, start, goals, Callable(provider, "edges"))
var cold_bytes := var_to_bytes(cold)
var cold_calls := provider.calls.duplicate()
_check(_serialized(cold) == expected and cold_bytes == var_to_bytes(output), "cached cold full typed output equals original")
provider.calls.clear()
var warm: Dictionary = core.call("search_cached", cells, indices, start, goals, Callable(provider, "edges"))
_check(_serialized(warm) == expected and var_to_bytes(warm) == cold_bytes, "cached warm full typed output equals original")
var warm_calls := provider.calls.duplicate()
_check(provider.calls.is_empty(), "warm search makes no already-cached provider calls")
# The original API remains uncached even on an instance with a warm cache.
provider.calls.clear()
var uncached: Dictionary = core.call("search", cells, indices, start, goals, Callable(provider, "edges"))
_check(var_to_bytes(uncached) == cold_bytes and provider.calls == cold_calls, "original API ignores warm native cache")
if cold.get(&"status") == "usable":
cold[&"cost_values"][0] = 12345
cold[&"parent_indices"][0] = 12345
cold[&"discovered"].clear()
cold[&"parent_discovered"].clear()
cold[&"settled"].clear()
var owned: Dictionary = core.call("search_cached", cells, indices, start, goals, Callable(provider, "edges"))
_check(var_to_bytes(owned) == cold_bytes, "external result mutations do not alter cached edge vectors or fresh output")
core.call("clear_edge_cache")
provider.calls.clear()
var cleared: Dictionary = core.call("search_cached", cells, indices, start, goals, Callable(provider, "edges"))
_check(var_to_bytes(cleared) == cold_bytes and provider.calls == cold_calls, "clear repeats original lazy calls and full output")
_check(var_to_bytes([cells, indices, goals, provider.rows]) == before, "cached APIs preserve all caller inputs")
cached_cases.append({"group":row["group"], "case":row["case"], "cold":_serialized(cleared), "warm":_serialized(warm), "expected_sha256":row["expected_sha256"], "cold_calls":cold_calls, "warm_calls":warm_calls, "equal":var_to_bytes(cleared)==cold_bytes and var_to_bytes(warm)==cold_bytes})
var provider_weak: WeakRef = weakref(provider)
provider = null
_check(provider_weak.get_ref() == null, "native cache does not retain the provider Callable")
output = null
cold = {}; warm = {}; uncached = {}; cleared = {}
func _prefix_wrap(core, malformed) -> void:
var cells: Array[Vector3i] = [Vector3i.ZERO, Vector3i(1, 0, 0), Vector3i(2, 0, 0)]
var indices: Dictionary = {cells[0]: 0, cells[1]: 1, cells[2]: 2}
var provider := EdgeProvider.new()
provider.rows = [[[cells[1], 9223372036854775802]], [[cells[2], 10], malformed], []]
var goals: Dictionary = {cells[2]: true}
var before := var_to_bytes([cells, indices, goals, provider.rows])
var output = core.call("search", cells, indices, 0, goals, Callable(provider, "edges"))
_check(_serialized(output) == "wrapped\n", "wrap before later malformed row")
_check(var_to_bytes([cells, indices, goals, provider.rows]) == before, "prefix-wrap caller ownership")
provider = null
output = null
func _shrink_transfer(core) -> void:
var cells: Array[Vector3i] = [Vector3i.ZERO, Vector3i(1, 0, 0), Vector3i(2, 0, 0)]
var indices: Dictionary = {cells[0]: 0, cells[1]: 1, cells[2]: 2}
var goals: Dictionary = {cells[1]: true}
var fixed_before := var_to_bytes([indices, goals])
var provider := ShrinkingProvider.new()
provider.cells = cells
var output = core.call("search", cells, indices, 0, goals, Callable(provider, "edges"))
# Old bridge transfers only the post-search prefix: the allocated third slots stay zero.
var expected := "usable\n0 7 0\n-1 0 0\n0 1\n1\n0 1\n"
_check(_serialized(output) == expected, "provider shrink preserves original transferred prefix and zero tail")
_check(cells.size() == 2 and provider.calls == [Vector3i.ZERO], "single lazy callback shrinks shared cells")
_check(var_to_bytes([indices, goals]) == fixed_before, "shrink fixture maps unchanged")
var costs: PackedInt64Array = output[&"cost_values"].duplicate()
var parents: PackedInt64Array = output[&"parent_indices"].duplicate()
costs[0] = 12345
parents[0] = 12345
_check(_serialized(output) == expected, "PackedInt64Array explicit duplicates do not mutate retained result")
var shared_costs: PackedInt64Array = output[&"cost_values"]
var shared_parents: PackedInt64Array = output[&"parent_indices"]
shared_costs[0] = 12345
shared_parents[0] = 12345
_check(_serialized(output) == "usable\n12345 7 0\n12345 0 0\n0 1\n1\n0 1\n", "PackedInt64Array aliases retain documented shared mutation")
# A new search allocates new outputs; external result mutations cannot poison it.
output[&"cost_values"] = PackedInt64Array([12345])
output[&"parent_indices"] = PackedInt64Array([12345])
cells.append(Vector3i(2, 0, 0))
provider.calls.clear()
var repeated = core.call("search", cells, indices, 0, goals, Callable(provider, "edges"))
_check(_serialized(repeated) == expected, "fresh result ownership after caller mutation")
_check(provider.calls == [Vector3i.ZERO] and cells.size() == 2, "repeat shrink lazy callback")
provider = null
output = null
repeated = null
func _cached_goals_and_reset(core) -> void:
core.call("clear_edge_cache")
var cells: Array[Vector3i] = [Vector3i.ZERO, Vector3i(1, 0, 0), Vector3i(2, 0, 0)]
var indices: Dictionary = {cells[0]:0, cells[1]:1, cells[2]:2}
var provider := EdgeProvider.new()
provider.rows = [[[cells[1],7],[cells[2],20]], [[cells[2],3]], []]
var goals: Dictionary = {cells[1]:true}
var first: Dictionary = core.call("search_cached", cells, indices, 0, goals, Callable(provider,"edges"))
_check(first[&"status"] == "usable" and first[&"cost_values"][1] == 7 and provider.calls == [0], "first goal stops before requesting goal edges or unseen node")
provider.calls.clear(); goals = {cells[2]:true}
var later: Dictionary = core.call("search_cached", cells, indices, 0, goals, Callable(provider,"edges"))
_check(provider.calls == [1], "changed goals lazily request only the newly expanded node")
var oracle: Dictionary = core.call("search", cells, indices, 0, goals, Callable(provider,"edges"))
_check(var_to_bytes(later)==var_to_bytes(oracle), "changed goals full typed equivalence")
provider.calls.clear()
var shifted: Dictionary = core.call("search_cached", cells, indices, 1, goals, Callable(provider,"edges"))
_check(provider.calls.is_empty(), "changed start reuses previously expanded node only")
oracle = core.call("search", cells, indices, 1, goals, Callable(provider,"edges"))
_check(var_to_bytes(shifted)==var_to_bytes(oracle), "changed start full typed equivalence")
# Graph mutation obeys the explicit API contract: clear before reuse.
provider.rows[0][0][1] = 2
core.call("clear_edge_cache"); provider.calls.clear()
var changed: Dictionary = core.call("search_cached", cells, indices, 0, goals, Callable(provider,"edges"))
_check(provider.calls == [0,1], "clear after edge mutation repopulates exact lazy nodes")
oracle = core.call("search", cells, indices, 0, goals, Callable(provider,"edges"))
_check(var_to_bytes(changed)==var_to_bytes(oracle) and changed[&"cost_values"][2]==5, "mutated graph after clear has complete correct output")
core.call("clear_edge_cache")
provider = null
func _cached_prefix_wrap(core, malformed) -> void:
core.call("clear_edge_cache")
var cells: Array[Vector3i] = [Vector3i.ZERO,Vector3i(1,0,0),Vector3i(2,0,0)]
var indices: Dictionary = {cells[0]:0,cells[1]:1,cells[2]:2}
var goals: Dictionary = {cells[2]:true}
var provider := EdgeProvider.new()
provider.rows = [[[cells[1],9223372036854775802]], [[cells[2],10],malformed], []]
var before := var_to_bytes([cells,indices,goals,provider.rows])
var cold: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(_serialized(cold)=="wrapped\n" and provider.calls==[0,1], "cached prefix real wrap before later malformed row")
provider.calls.clear()
var warm: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(var_to_bytes(warm)==var_to_bytes(cold) and provider.calls.is_empty(), "cached invalid-prefix wrap repeat unchanged")
_check(var_to_bytes([cells,indices,goals,provider.rows])==before, "cached prefix all caller inputs unchanged")
core.call("clear_edge_cache"); provider = null
func _warm_for_teardown(core) -> void:
core.call("clear_edge_cache")
var cells: Array[Vector3i] = [Vector3i.ZERO,Vector3i(1,0,0)]
var indices: Dictionary = {cells[0]:0,cells[1]:1}
var goals: Dictionary = {cells[1]:true}
var provider := EdgeProvider.new()
provider.rows = [[[cells[1],7]], []]
var output: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(output[&"status"]=="usable" and output[&"cost_values"][1]==7 and provider.calls==[0],"populate native cache before actual core teardown")
var provider_weak: WeakRef = weakref(provider)
provider = null
_check(provider_weak.get_ref()==null,"warm native cache retains no Callable or caller objects")
class ReentrantProvider extends RefCounted:
var core: Object
var cells: Array[Vector3i]
var indices: Dictionary
var goals: Dictionary
var entered := false
var inner_result: Dictionary
func edges(cell: Vector3i) -> Array:
if cell.x != 0: return []
if not entered:
entered = true
core.call("clear_edge_cache")
var inner := EdgeProvider.new()
inner.rows = [[[cells[1],9]], []]
inner_result = core.call("search_cached",cells,indices,0,goals,Callable(inner,"edges"))
return [[cells[1],7]]
func _reentrant_collision(core) -> Dictionary:
core.call("clear_edge_cache")
var cells: Array[Vector3i] = [Vector3i.ZERO,Vector3i(1,0,0)]
var indices: Dictionary = {cells[0]:0,cells[1]:1}
var goals: Dictionary = {cells[1]:true}
var provider := ReentrantProvider.new()
provider.core=core;provider.cells=cells;provider.indices=indices;provider.goals=goals
var outer: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(outer[&"status"] == "usable" and outer[&"cost_values"][1] == 7, "reentrant collision returns original converted outer row")
_check(provider.inner_result[&"status"] == "usable" and provider.inner_result[&"cost_values"][1] == 9, "inner populated same cache key before outer insertion")
var warm: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(warm[&"status"] == "usable" and warm[&"cost_values"][1] == 9, "warm preserves inner first cache publication")
var result := {"outer":outer,"inner":provider.inner_result,"warm":warm}
var ref: WeakRef = weakref(provider)
provider = null
_check(ref.get_ref() == null, "borrowed native cache retains no reentrant provider")
core.call("clear_edge_cache")
return result
func run_frozen(core, manifest_path: String) -> Dictionary:
var manifest: Dictionary = JSON.parse_string(FileAccess.get_file_as_string(manifest_path))
_check(manifest["cases"].size() == 50, "same frozen fifty-input scope")
for row: Dictionary in manifest["cases"]: _case(core,row)
_prefix_wrap(core,true)
_prefix_wrap(core,[Vector3i(2,0,0),false])
_shrink_transfer(core)
_cached_goals_and_reset(core)
_cached_prefix_wrap(core,true)
_cached_prefix_wrap(core,[Vector3i(2,0,0),false])
var collision := _reentrant_collision(core)
_warm_for_teardown(core)
return {"passed":failures.is_empty(),"checks":checks,"failures":failures,"cases":cases,"cached_cases":cached_cases,"reentrant_collision":collision,"unit_accepted":false,"performance_accepted":false}
@@ -0,0 +1,64 @@
# coding: utf-8
"""One owned Guest batch ABI/local/affected-S3 execution; no full regression or release acceptance."""
from pathlib import Path
import hashlib,importlib.util,json,os,shutil,sys,uuid
sys.dont_write_bytecode=True
R=Path(__file__).resolve().parents[2];A=R/'artifacts/original-completion-2026-10-02';O=A/'p23-02-native-hot-loop-local-r329';D=R/'docs/plans/original-completion-2026-10-02'
NAMES=['IMPLEMENTATION_PLAN.md','PROGRESS_INTEGRATION.md','work_packages.json','progress_snapshot.json']
def mod(name,p):
s=importlib.util.spec_from_file_location(name,p);m=importlib.util.module_from_spec(s);s.loader.exec_module(m);return m
def main():
r=mod('guest_local_runner',R/'tools/run_all_tests.py');outer=mod('guest_local_owned',r.SUPPORT/'owned_outer.py');plan=r.read(O/'input.json');fixed=plan['pins']
assert not (O/'execution.json').exists()
stage=Path(plan['stage']);parent=Path(plan['parent']);public=(stage/'project.godot').read_bytes();private=Path(fixed['private_library']['path']).parent
source=r.source_refs(R);player=r.default_player(R);docs={n:r.sha(D/n) for n in NAMES}
assert source==plan['source_before'] and player==plan['default_before'] and docs==plan['doc4_before']
def protect():
assert r.source_refs(R)==source and r.default_player(R)==player and {n:r.sha(D/n) for n in NAMES}==docs
assert r.inventory(parent,stage=True)==plan['parent_stage_inventory'] and r.inventory(stage,stage=True)==plan['expected_stage']
assert r.inventory(r.SUPPORT)==plan['support_inventory'] and r.inventory(private)==plan['private_library_inventory']
for k,q in fixed.items():
p=Path(q['path']);assert p.stat().st_size==q['bytes'] and r.sha(p)==q['sha256'],k
def growth():return sum(p.stat().st_size for p in O.rglob('*') if p.is_file() and p.relative_to(O).parts[0]!='stage')
protect();host=r.read(fixed['host_review']['path']);assert host['host_build_accepted'] and not host['blockers']
prepath=A/'p23-02-native-hot-loop-local-preexecution-independent-review-r329.json';pre=r.read(prepath);assert pre['execution_allowed'] and not pre['blockers']
for group in ['evidence_sha256','canonical_doc4_context_pins']:
for q in pre[group].values():
p=Path(q['path']);assert p.stat().st_size==q['bytes'] and r.sha(p)==q['sha256']
root=r.read(O/'preexecution-root-verification.json');assert root['passed'] and root['review_sha256']==r.sha(prepath)
phases=[];samples=[];error=None;cleanup=[];cleanup_errors=[];report=None
try:
protect();assert not outer.native.helper['live_engines']() and shutil.disk_usage(A).free>=plan['capacity_floor_bytes'] and growth()<=plan['maximum_measurement_growth_bytes']
output=O/'local-measurement';output.mkdir();ident=uuid.uuid4().hex;startup='TheTree-PCK-tests-'+ident+'-guest-startup';profile='TheTree-PCK-tests-'+ident+'-guest-runtime'
assert not r.profile_path(startup).exists() and not r.profile_path(profile).exists()
env=r.fresh_environment(os.environ);env.update(THE_TREE_PACK_PROFILE_NAME=profile,THE_TREE_PACK_PROFILE_EXPECTED=str(r.profile_path(profile)),THE_TREE_PACK_PROFILE_REPORT=str(O/'local-profile.json'),THE_TREE_RUNTIME_MONITOR_OUTPUT=str(output))
(stage/'project.godot').write_bytes(r.private_project(public,startup));phase=O/'local'
argv=[fixed['engine']['path'],'--headless','--path',str(stage),'--script',fixed['starter']['path'],'--verbose','--log-file',str(phase/'engine-native.log')]
result,capture=outer.run_phase(argv,phase,90,env,now_fn=r.now,dump_fn=r.write,sha_fn=r.sha,live_engines_fn=outer.native.helper['live_engines'])
phases.append(dict(name='local',result=result,capture=capture));r.write(O/'local-phase.json',phases[0])
report=r.read(output/'report.json') if (output/'report.json').exists() else None
if report:samples.append(dict(name='local',report=report))
assert result is not None and result['exit_code']==0 and not result['error_lines'] and not result['timed_out'] and capture['passed']
logs=''.join((phase/n).read_text() for n in ['stdout.log','stderr.log','engine-native.log'])
assert 'Orphan StringName:' not in logs and 'unclaimed string names' not in logs
assert report and report['passed'] and report['failures']==0 and report['pid']==result['pid']
count=plan['expected_case_counts'];assert report['pure_case_count']==count['pure'] and report['decision_case_count']==count['decision'] and report['custom_fallback_case_count']==count['custom_fallback'] and report['original_s3_invocations']==count['original_s3_invocations']
stdout=(phase/'stdout.log').read_text();assert stdout.count('Guest bulk local: %d checks, 0 failures'%report['checks'])==1 and stdout.count('NATIVE_ADAPTER_LIBRARY_REGISTERED')==1
fixture=output/'fixtures.varbytes';assert fixture.stat().st_size==report['fixture_bytes'] and r.sha(fixture)==report['fixture_sha256']
protocol=r.read(output/'protocol-report.json');assert protocol['passed'] and not protocol['failures'] and len(protocol['cases'])==50 and len(protocol['cached_cases'])==50 and protocol['checks']==report['protocol_checks']
assert fixture.read_bytes()==Path(plan['original_Guest_fixture']['path']).read_bytes(), 'Unchanged full Guest53 original fixture bytes'
r.profile_gate(r.profile_path(profile),O/'local-profile.json',profile)
assert growth()<=plan['maximum_measurement_growth_bytes']
(stage/'project.godot').write_bytes(public);protect()
except BaseException as caught:error=type(caught).__name__+': '+str(caught)
finally:
cleanup,cleanup_errors=outer.finish_captured(outer.OWNED)
if all(q['engine_ended'] is True for q in cleanup):(stage/'project.godot').write_bytes(public)
else:cleanup_errors.append('Restoration refused while actual owned child remains live')
guard_errors=[]
try:protect()
except BaseException as caught:guard_errors.append(type(caught).__name__+': '+str(caught))
passed=error is None and not guard_errors and not cleanup_errors and len(phases)==1 and len(samples)==1
r.write(O/'execution.json',dict(passed=passed,error=error,guard_errors=guard_errors,phases=phases,samples=samples,cleanup=cleanup,cleanup_errors=cleanup_errors,input_source_default_doc4_parent_support_private_preserved=not guard_errors,compiler_processes=0,full_regression_runs=0,candidate_selected=False,candidate_adopted=False,unit_accepted=False,performance_accepted=False,normal_OS_accepted=False,Windows_accepted=False,limitations=['Finite Guest53 and18 affected original S3 methods plus frozen50 protocols/shrink/ownership/reentrant collision on same new bridge. Literal original Guest source oracle removes class_name line only. No Runtime cold646→647 whole state, ordinary OS/reentry domain, arbitrary conversion or memory failure, final full regression, performance budget/P95/D10, Windows or adoption/unit acceptance.']))
print(json.dumps(dict(passed=passed,error=error,guard_errors=guard_errors)),flush=True);return 0 if passed else 1
if __name__=='__main__':raise SystemExit(main())
@@ -0,0 +1,40 @@
{
"passed": true,
"error": null,
"phases": [
{
"pid": 34107,
"argv": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-std=c++17",
"-O2",
"-o",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle.cpp"
],
"exit_code": 0,
"seconds": 1.136918583,
"ended": true,
"foreign_signals": 0
},
{
"pid": 34122,
"argv": [
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/corpus.tsv"
],
"exit_code": 0,
"seconds": 0.557632916,
"ended": true,
"foreign_signals": 0
}
],
"all_inputs_preserved": true,
"corpus": {
"path": "/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/corpus.tsv",
"bytes": 4556458,
"sha256": "51036394c19bd2c3212a80fb67f7406e6f0d049ec018910d36a8d3856a0b270c"
},
"unit_accepted": false,
"performance_accepted": false
}
@@ -0,0 +1,48 @@
{
"pins": {
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/tree_core.hpp": {
"path": "/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/tree_core.hpp",
"bytes": 3299,
"sha256": "be46852fe55aeee4e18996b4d87222662b031fd1b946977c81092f4d0707e480"
},
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp": {
"path": "/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp",
"bytes": 3467,
"sha256": "5f67d85bfc91d5c7830aabd8089f4bca05883045d671d4e683d7c532cf3a34a1"
},
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++": {
"path": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"bytes": 141373024,
"sha256": "7def90dd8829726686213a747fc5bff1583df933dae5edc55d755479e0bfe00a"
},
"/private/tmp/thetree-numeric-oracle-r328.py": {
"path": "/private/tmp/thetree-numeric-oracle-r328.py",
"bytes": 5646,
"sha256": "21675754454c5d8fca8b35145217f32762243e39908e67bf2a1bdb783028c94c"
},
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle.cpp": {
"path": "/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle.cpp",
"bytes": 3291,
"sha256": "5d786e3c3be56c87c4311f80f5e9d64411f0875bb00f97ca778d191dbffe8b66"
}
},
"argv": [
[
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++",
"-std=c++17",
"-O2",
"-o",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle.cpp"
],
[
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/oracle",
"/Users/korizatou114/Projects/\u3068\u308a\u306b\u304f\u5de5\u623f\u30b2\u30fc\u30e0\u5236\u4f5c\u90e8/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-numeric-r328/corpus.tsv"
]
],
"case_count": 16388,
"timeout_seconds": 30,
"growth_cap_bytes": 16777216,
"Godot_runs": 0,
"unit_accepted": false
}
@@ -0,0 +1,54 @@
#include <random>
#include <sstream>
#include <cassert>
#define the_tree_native original_numeric
#include "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/tree_core.hpp"
#undef the_tree_native
#define the_tree_native candidate_numeric
#include "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp"
#undef the_tree_native
using I=std::int64_t;
struct E {I neighbor,cost;};
std::string vec(const std::vector<I>& a) {std::ostringstream out;for(auto x:a)out<<x<<",";return out.str();}
template<class T> std::string result(const T &r,const std::vector<I>& calls) {
return r.status+"|"+vec(r.costs)+"|"+vec(r.parents)+"|"+vec(r.discovered)+"|"+vec(r.parent_discovered)+"|"+vec(r.settled)+"|"+vec(calls);
}
int main(int argc,char **argv) {
if(argc!=2)return 98; std::ofstream corpus(argv[1]);if(!corpus)return 98;
std::uint64_t cases=0;bool passed=true;
auto run=[&](I n,I start,const std::vector<I>& goals,const std::vector<std::vector<E>>& graph) {
std::vector<I> old_calls,new_calls;
auto old_provider=[&](I current) {old_calls.push_back(current);std::vector<original_numeric::Edge> r;for(auto e:graph[current])r.push_back({e.neighbor,e.cost});return r;};
auto new_provider=[&](I current) {new_calls.push_back(current);std::vector<candidate_numeric::Edge> r;for(auto e:graph[current])r.push_back({e.neighbor,e.cost});return r;};
auto old=original_numeric::search(n,start,goals,old_provider);
auto now=candidate_numeric::search(n,start,goals,new_provider);
const auto a=result(old,old_calls),b=result(now,new_calls);passed=passed && a==b;
corpus<<cases<<"\t"<<n<<","<<start<<":"<<vec(goals)<<":";
for(const auto& row:graph) {for(auto e:row)corpus<<e.neighbor<<","<<e.cost<<";";corpus<<"/";}
corpus<<"\t"<<a<<"\t"<<b<<"\n";++cases;
};
// Exhaustive directed 3-node binary graphs, including self-loops and all goal subsets.
for(I mask=0;mask<512;++mask) {
std::vector<std::vector<E>> g(3);for(I a=0;a<3;++a)for(I b=0;b<3;++b)if(mask&(I(1)<<(a*3+b)))g[a].push_back({b,1});
for(I start=0;start<3;++start)for(I target=0;target<8;++target) {std::vector<I> goals;for(I i=0;i<3;++i)if(target&(I(1)<<i))goals.push_back(i);run(3,start,goals,g);}
}
std::mt19937_64 rng(0x54524545333238ULL);
for(I test=0;test<4096;++test) {
I n=1+rng()%24;std::vector<std::vector<E>> g(n);
for(I i=0;i<n;++i)for(I j=0,count=rng()%6;j<count;++j) {
I node=rng()%(n+2)-1;I cost=1+rng()%12;
if(test%23==0)cost=0;if(test%29==0)cost=-1;if(test%31==0)cost=std::numeric_limits<I>::max();
g[i].push_back({node,cost});
}
std::vector<I> goals;for(I i=0,count=rng()%8;i<count;++i)goals.push_back(rng()%(n+2)-1);
run(n,rng()%(n+2)-1,goals,g);
}
// Explicit signed64 overflow, duplicate ties/edges, unknown goals and invalid starts.
const I maximum=std::numeric_limits<I>::max();
run(3,0,{2},{{{1,maximum}},{{2,1}}, {}});
run(4,0,{3,3,99},{{{2,1},{1,1},{1,1}},{{3,2}},{{3,2}}, {}});
run(0,-1,{},{});run(1,1,{0},{{}});
corpus.close();if(!corpus)return 98;
std::cout<<"NUMERIC_DIFFERENTIAL "<<cases<<" "<<(passed?"PASS":"FAIL")<<"\n";
return passed?0:1;
}
@@ -0,0 +1 @@
NUMERIC_DIFFERENTIAL 16388 PASS
@@ -0,0 +1,113 @@
{
"passed": true,
"review_sha256": "717f8aa9a1b12425b79f7dbbb81b4e0526de32ddd836114525b53d4fd7bc05e1",
"verified_entries": [
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/input.json",
"bytes": 3185,
"sha256": "27141ccb37a741cc468bf57cf6e5da2250b729a2fa21bbda5fa1b7f15df7b254"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/input.json",
"bytes": 4775,
"sha256": "80734ba89f84a086ef5b79a0443296a73ec5aab0478edcfaabb3dfd89450d71f"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-work-contract-r325.json",
"bytes": 2313,
"sha256": "bbb488bbb0229c31711982867375f41487ec7f5c9343eb6eb5903b8321e05602"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/guest_service.gd",
"bytes": 62505,
"sha256": "77ce52ebeed6a89f3e397de01572b17ea3e3cb246f7daca9145a1a192389969e"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/scripts/simulation_runtime.gd",
"bytes": 612068,
"sha256": "7eb24adbf91fe53cde14954dda12abd5efb05130de7d356d8df281ee99065e86"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/guest_candidate_batch.inc",
"bytes": 28222,
"sha256": "3623a7ca03b96118c927662fc5a95c1f73e20251d5ef4b04ec519603c3c05ba9"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp",
"bytes": 3467,
"sha256": "5f67d85bfc91d5c7830aabd8089f4bca05883045d671d4e683d7c532cf3a34a1"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-hot-loop-candidate-r326/source/tree_numeric_core.cpp",
"bytes": 56138,
"sha256": "a2434ef2fbc9624aa3b62746cebde2cacdce78712d4d866774df54fbd291bee3"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/tree_numeric_core.cpp",
"bytes": 54255,
"sha256": "8282c32d2dfcc1e6c95e7cf6c0d9edd575167e8e4fb101423f3cb94d9dfdb2dc"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/tree_core.hpp",
"bytes": 3299,
"sha256": "be46852fe55aeee4e18996b4d87222662b031fd1b946977c81092f4d0707e480"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/source/guest_candidate_batch.inc",
"bytes": 21688,
"sha256": "ddf183eb62279311495a5cc941e3f31e2881f4deb267124b77e1883e9e2db81b"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/scripts/guest_service.gd",
"bytes": 62505,
"sha256": "77ce52ebeed6a89f3e397de01572b17ea3e3cb246f7daca9145a1a192389969e"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/scripts/simulation_runtime.gd",
"bytes": 612068,
"sha256": "7eb24adbf91fe53cde14954dda12abd5efb05130de7d356d8df281ee99065e86"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-static-independent-review-r313-r02.json",
"bytes": 20466,
"sha256": "d456055ced3efb1950d4ee59efe685bc021409105dbd7ff3ff8d33e692a84f24"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-build-actual-independent-review-r314-r02.json",
"bytes": 47929,
"sha256": "b999a5435c7eea5dfda952f96b640a2ffbacf0281255aea90cb3e60c27e626dc"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-current-native-diagnostic-actual-independent-review-r323.json",
"bytes": 64703,
"sha256": "fd40ab0cfc79160c4e437f970be1631da14cf625f2eef49ab48c722c1eed814d"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-current-native-diagnostic-r323/actual-root-verification.json",
"bytes": 38855,
"sha256": "973fe78e64f1989e4937ffc9c154d08f76aa39946d2559700af1d1d008dd0fe8"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/docs/plans/original-completion-2026-10-02/IMPLEMENTATION_PLAN.md",
"bytes": 491120,
"sha256": "1a3a063f451581a57842cfed1a269ae5696381577ff0dec48c64512030930816"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/docs/plans/original-completion-2026-10-02/PROGRESS_INTEGRATION.md",
"bytes": 409184,
"sha256": "80d0d2718a35ddbfa79cae504cabec017ac034fd31c8e1deafaa651b0dcdd7f9"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/docs/plans/original-completion-2026-10-02/work_packages.json",
"bytes": 1203820,
"sha256": "285cabc1156ec828b4621be8af88494ac4e386e9312db18b8dcf42dfa7249311"
},
{
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/docs/plans/original-completion-2026-10-02/progress_snapshot.json",
"bytes": 590336,
"sha256": "183a35f79c6b251b115e46f517843cce21b78abe35d0803f8f0773b920b280ed"
}
],
"unit_accepted": false,
"performance_accepted": false
}
@@ -0,0 +1,45 @@
{
"plan_id": "P23-02",
"parent": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-native-guest-bulk-candidate-r313-r02/input.json",
"bytes": 4775,
"sha256": "80734ba89f84a086ef5b79a0443296a73ec5aab0478edcfaabb3dfd89450d71f"
},
"diagnostic": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-current-native-diagnostic-actual-independent-review-r323.json",
"bytes": 64703,
"sha256": "fd40ab0cfc79160c4e437f970be1631da14cf625f2eef49ab48c722c1eed814d"
},
"matrix": {
"path": "/Users/korizatou114/Projects/とりにく工房ゲーム制作部/artifacts/original-completion-2026-10-02/p23-02-current-progress-disposition-r320.json",
"bytes": 80450,
"sha256": "7593e571391744be89a50e6cdfc69ea2421a6c7c8b28fc6debb934b008fa00a3"
},
"scope": [
"lexicographic numeric frontier, same positive-cost ordering/overflow/provider behavior",
"borrow cached edges through callback-free numeric loops, preserve reentrant first-return rows",
"private packed writes and per-scan numeric views",
"per-call compiled Guest keys with identical StringName-before-String lookup precedence",
"fixed-size performance guard maps, identical alias checks/order"
],
"validation": [
"independent static review and retained SDK build1/link1",
"differential standalone numeric oracle including equal-cost order, overflow, unknown goals, provider calls",
"existing50 cached protocol plus explicit reentrant provider case, same output/order/clear/weak ownership",
"existing315 Guest53 and originalS3 18 on unchanged stage and original literal oracle",
"single adjacent uninstrumented cold646 pair/full11487732-byte original oracle on candidate and313 parent; no P95/budget claim",
"required exact final regression/OS/x3/small-screen/Windows/independent acceptance before unit closure"
],
"capacity": {
"preparation_floor_bytes": 553648128,
"live_floor_bytes": 536870912,
"growth_cap_bytes": 16777216
},
"clone_count": 0,
"SDK_compilations": 0,
"full_regression_planned_now": 0,
"formal_completed_added": 0,
"unit_accepted": false,
"selected": false,
"adopted": false
}
@@ -0,0 +1,84 @@
# coding: utf-8
from pathlib import Path
import importlib.util,json,hashlib,shutil,subprocess,sys,time
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';O=A/'p23-02-native-hot-loop-numeric-r328';P=A/'p23-02-native-guest-bulk-candidate-r313-r02/source/tree_core.hpp';C=A/'p23-02-native-hot-loop-candidate-r326/source/tree_core.hpp'
assert not O.exists() and shutil.disk_usage(A).free>=528*1048576;O.mkdir()
def pin(p):return dict(path=str(p),bytes=p.stat().st_size,sha256=hashlib.sha256(p.read_bytes()).hexdigest())
old=json.loads((A/'p23-02-native-bridge-build-r76/input.json').read_text());compiler=Path(old['compiler_pins']['clang++']['path']);assert pin(compiler)==old['compiler_pins']['clang++']
cpp='''#include <random>
#include <sstream>
#include <cassert>
#define the_tree_native original_numeric
#include "'''+str(P)+'''"
#undef the_tree_native
#define the_tree_native candidate_numeric
#include "'''+str(C)+'''"
#undef the_tree_native
using I=std::int64_t;
struct E {I neighbor,cost;};
std::string vec(const std::vector<I>& a) {std::ostringstream out;for(auto x:a)out<<x<<",";return out.str();}
template<class T> std::string result(const T &r,const std::vector<I>& calls) {
return r.status+"|"+vec(r.costs)+"|"+vec(r.parents)+"|"+vec(r.discovered)+"|"+vec(r.parent_discovered)+"|"+vec(r.settled)+"|"+vec(calls);
}
int main(int argc,char **argv) {
if(argc!=2)return 98; std::ofstream corpus(argv[1]);if(!corpus)return 98;
std::uint64_t cases=0;bool passed=true;
auto run=[&](I n,I start,const std::vector<I>& goals,const std::vector<std::vector<E>>& graph) {
std::vector<I> old_calls,new_calls;
auto old_provider=[&](I current) {old_calls.push_back(current);std::vector<original_numeric::Edge> r;for(auto e:graph[current])r.push_back({e.neighbor,e.cost});return r;};
auto new_provider=[&](I current) {new_calls.push_back(current);std::vector<candidate_numeric::Edge> r;for(auto e:graph[current])r.push_back({e.neighbor,e.cost});return r;};
auto old=original_numeric::search(n,start,goals,old_provider);
auto now=candidate_numeric::search(n,start,goals,new_provider);
const auto a=result(old,old_calls),b=result(now,new_calls);passed=passed && a==b;
corpus<<cases<<"\\t"<<n<<","<<start<<":"<<vec(goals)<<":";
for(const auto& row:graph) {for(auto e:row)corpus<<e.neighbor<<","<<e.cost<<";";corpus<<"/";}
corpus<<"\\t"<<a<<"\\t"<<b<<"\\n";++cases;
};
// Exhaustive directed 3-node binary graphs, including self-loops and all goal subsets.
for(I mask=0;mask<512;++mask) {
std::vector<std::vector<E>> g(3);for(I a=0;a<3;++a)for(I b=0;b<3;++b)if(mask&(I(1)<<(a*3+b)))g[a].push_back({b,1});
for(I start=0;start<3;++start)for(I target=0;target<8;++target) {std::vector<I> goals;for(I i=0;i<3;++i)if(target&(I(1)<<i))goals.push_back(i);run(3,start,goals,g);}
}
std::mt19937_64 rng(0x54524545333238ULL);
for(I test=0;test<4096;++test) {
I n=1+rng()%24;std::vector<std::vector<E>> g(n);
for(I i=0;i<n;++i)for(I j=0,count=rng()%6;j<count;++j) {
I node=rng()%(n+2)-1;I cost=1+rng()%12;
if(test%23==0)cost=0;if(test%29==0)cost=-1;if(test%31==0)cost=std::numeric_limits<I>::max();
g[i].push_back({node,cost});
}
std::vector<I> goals;for(I i=0,count=rng()%8;i<count;++i)goals.push_back(rng()%(n+2)-1);
run(n,rng()%(n+2)-1,goals,g);
}
// Explicit signed64 overflow, duplicate ties/edges, unknown goals and invalid starts.
const I maximum=std::numeric_limits<I>::max();
run(3,0,{2},{{{1,maximum}},{{2,1}}, {}});
run(4,0,{3,3,99},{{{2,1},{1,1},{1,1}},{{3,2}},{{3,2}}, {}});
run(0,-1,{},{});run(1,1,{0},{{}});
corpus.close();if(!corpus)return 98;
std::cout<<"NUMERIC_DIFFERENTIAL "<<cases<<" "<<(passed?"PASS":"FAIL")<<"\\n";
return passed?0:1;
}
'''
(O/'oracle.cpp').write_text(cpp);exe=O/'oracle';plan=[[str(compiler),'-std=c++17','-O2','-o',str(exe),str(O/'oracle.cpp')],[str(exe),str(O/'corpus.tsv')]]
protected={str(p):pin(p) for p in [P,C,compiler,Path(__file__),O/'oracle.cpp']};(O/'input.json').write_text(json.dumps(dict(pins=protected,argv=plan,case_count=16388,timeout_seconds=30,growth_cap_bytes=16*1048576,Godot_runs=0,unit_accepted=False),indent=2)+'\n')
rows=[];error=None
try:
for i,argv in enumerate(plan):
assert shutil.disk_usage(A).free>=528*1048576;start=time.monotonic()
process=subprocess.Popen(argv,stdout=subprocess.PIPE,stderr=subprocess.PIPE,start_new_session=True)
try:out,err=process.communicate(timeout=30)
except BaseException:
if process.poll() is None:process.terminate()
try:process.wait(timeout=3)
except subprocess.TimeoutExpired:process.kill();process.wait(timeout=3)
raise
(O/('phase%d.stdout'%i)).write_bytes(out);(O/('phase%d.stderr'%i)).write_bytes(err)
rows.append(dict(pid=process.pid,argv=argv,exit_code=process.returncode,seconds=time.monotonic()-start,ended=process.poll() is not None,foreign_signals=0))
assert process.returncode==0 and not err
assert sum(p.stat().st_size for p in O.rglob('*') if p.is_file())<=16*1048576
assert (O/'phase1.stdout').read_text()=='NUMERIC_DIFFERENTIAL 16388 PASS\n'
for path,p in protected.items():assert pin(Path(path))==p
except BaseException as ex:error=repr(ex)
(O/'execution.json').write_text(json.dumps(dict(passed=error is None,error=error,phases=rows,all_inputs_preserved=all(pin(Path(k))==v for k,v in protected.items()),corpus=pin(O/'corpus.tsv') if (O/'corpus.tsv').exists() else None,unit_accepted=False,performance_accepted=False),indent=2)+'\n')
print(json.dumps(dict(passed=error is None,error=error,phases=rows,corpus_bytes=(O/'corpus.tsv').stat().st_size if (O/'corpus.tsv').exists() else None)))
@@ -0,0 +1,24 @@
# coding: utf-8
from pathlib import Path
import importlib.util,json,shutil,uuid
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';O=A/'p23-02-native-hot-loop-local-r329';C=A/'p23-02-native-hot-loop-candidate-r326';B=A/'p23-02-native-hot-loop-build-r327'
s=importlib.util.spec_from_file_location('prepare329',R/'tools/run_all_tests.py');r=importlib.util.module_from_spec(s);s.loader.exec_module(r)
def pin(p):return dict(path=str(p),bytes=p.stat().st_size,sha256=r.sha(p))
assert r.read(B/'execution.json')['passed'] and shutil.disk_usage(A).free>=528*1048576
review=A/'p23-02-native-hot-loop-build-actual-independent-review-r327.json';assert r.read(review)['host_build_accepted']
old=r.read(A/'p23-02-native-guest-bulk-local-r315/input.json');stage=A/'p23-02-native-guest-bulk-local-r315/stage';parent=Path(old['parent']);assert r.inventory(stage,stage=True)==old['expected_stage'];assert r.inventory(parent,stage=True)==old['parent_stage_inventory']
private=Path('/private/tmp')/('TheTree-hot-loop-r329-'+uuid.uuid4().hex);private.mkdir();lib=private/'candidate.dylib'
with lib.open('xb') as f:f.write((B/'libtree_numeric_core.macos.template_debug.dylib').read_bytes())
assert lib.read_bytes()==(B/'libtree_numeric_core.macos.template_debug.dylib').read_bytes()
with (O/'candidate.gdextension').open('x') as f:f.write('[configuration]\nentry_symbol="tree_numeric_core_init"\ncompatibility_minimum="4.7.2"\nreloadable=false\n\n[libraries]\nmacos.arm64="'+str(lib)+'"\n')
fixed=old['pins'].copy()
updates=dict(host_review=review,host_root=A/'p23-02-native-hot-loop-build-root-verification-r327.json',library=B/'libtree_numeric_core.macos.template_debug.dylib',private_library=lib,config=O/'candidate.gdextension',qa=O/'local.gd',candidate=C/'input.json',candidate_guest=C/'scripts/guest_service.gd',candidate_runtime=C/'scripts/simulation_runtime.gd',candidate_cpp=C/'source/tree_numeric_core.cpp',candidate_include=C/'source/guest_candidate_batch.inc',contract=A/'p23-02-native-hot-loop-work-contract-r325.json',starter=O/'candidate-guarded.gd',runner=A/'p23-02-native-hot-loop-local-r329.py',prepare=Path(__file__),protocol_helper=O/'protocol_helper.gd',protocol_original=A/'p23-02-native-lazy-edge-cache-protocol-r143.gd',protocol_manifest=A/'p23-02-native-bridge-Godot-protocol-preparation-r73/pinned-inputs.json',numeric_execution=A/'p23-02-native-hot-loop-numeric-r328/execution.json',header=C/'source/tree_core.hpp')
for k,p in updates.items():fixed[k]=pin(p)
# Pin all 50 frozen full inputs and expected outputs, once; never copy this corpus.
manifest=r.read(updates['protocol_manifest'])
for i,row in enumerate(manifest['cases']):
for kind in ['input','expected']:
p=Path(row[kind+'_path']);q=pin(p);assert q['sha256']==row[kind+'_sha256'];fixed['protocol_%d_%s'%(i,kind)]=q
v=old.copy();v.update(pins=fixed,stage=str(stage),source_before=r.source_refs(R),default_before=r.default_player(R),doc4_before={n:r.sha(R/'docs/plans/original-completion-2026-10-02'/n) for n in old['doc4_before']},support_inventory=r.inventory(r.SUPPORT),private_library_inventory=r.inventory(private),original_Guest_fixture=pin(A/'p23-02-native-guest-bulk-local-r315/local-measurement/fixtures.varbytes'),additional_protocol_cases=50,stage_clones=0,expected_duration_seconds=[2,30],capacity_floor_bytes=528*1048576)
with (O/'input.json').open('x') as f:json.dump(v,f,ensure_ascii=False,indent=2);f.write('\n')
print(json.dumps(dict(plan=str(O/'input.json'),pins=len(fixed),clone_count=0,free=shutil.disk_usage(A).free)))
@@ -0,0 +1,88 @@
# coding: utf-8
from pathlib import Path
import json,re
R=Path('/Users/korizatou114/Projects/とりにく工房ゲーム制作部');A=R/'artifacts/original-completion-2026-10-02';O=A/'p23-02-native-hot-loop-local-r329';assert not O.exists();O.mkdir()
def write(p,s):
with p.open('x') as f:f.write(s)
old=A/'p23-02-native-lazy-edge-cache-protocol-r143.gd';s=old.read_text();s=s.replace('extends SceneTree','extends RefCounted',1)
s=re.sub(r'func _initialize\(\) -> void:\n.*?(?=\nfunc )','',s,count=1,flags=re.S)
s=s[:s.index('func _run() -> void:')]
s+='''class ReentrantProvider extends RefCounted:
var core: Object
var cells: Array[Vector3i]
var indices: Dictionary
var goals: Dictionary
var entered := false
var inner_result: Dictionary
func edges(cell: Vector3i) -> Array:
if cell.x != 0: return []
if not entered:
entered = true
core.call("clear_edge_cache")
var inner := EdgeProvider.new()
inner.rows = [[[cells[1],9]], []]
inner_result = core.call("search_cached",cells,indices,0,goals,Callable(inner,"edges"))
return [[cells[1],7]]
func _reentrant_collision(core) -> Dictionary:
core.call("clear_edge_cache")
var cells: Array[Vector3i] = [Vector3i.ZERO,Vector3i(1,0,0)]
var indices: Dictionary = {cells[0]:0,cells[1]:1}
var goals: Dictionary = {cells[1]:true}
var provider := ReentrantProvider.new()
provider.core=core;provider.cells=cells;provider.indices=indices;provider.goals=goals
var outer: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(outer[&"status"] == "usable" and outer[&"cost_values"][1] == 7, "reentrant collision returns original converted outer row")
_check(provider.inner_result[&"status"] == "usable" and provider.inner_result[&"cost_values"][1] == 9, "inner populated same cache key before outer insertion")
var warm: Dictionary = core.call("search_cached",cells,indices,0,goals,Callable(provider,"edges"))
_check(warm[&"status"] == "usable" and warm[&"cost_values"][1] == 9, "warm preserves inner first cache publication")
var result := {"outer":outer,"inner":provider.inner_result,"warm":warm}
var ref: WeakRef = weakref(provider)
provider = null
_check(ref.get_ref() == null, "borrowed native cache retains no reentrant provider")
core.call("clear_edge_cache")
return result
func run_frozen(core, manifest_path: String) -> Dictionary:
var manifest: Dictionary = JSON.parse_string(FileAccess.get_file_as_string(manifest_path))
_check(manifest["cases"].size() == 50, "same frozen fifty-input scope")
for row: Dictionary in manifest["cases"]: _case(core,row)
_prefix_wrap(core,true)
_prefix_wrap(core,[Vector3i(2,0,0),false])
_shrink_transfer(core)
_cached_goals_and_reset(core)
_cached_prefix_wrap(core,true)
_cached_prefix_wrap(core,[Vector3i(2,0,0),false])
var collision := _reentrant_collision(core)
_warm_for_teardown(core)
return {"passed":failures.is_empty(),"checks":checks,"failures":failures,"cases":cases,"cached_cases":cached_cases,"reentrant_collision":collision,"unit_accepted":false,"performance_accepted":false}
'''
write(O/'protocol_helper.gd',s)
qa=(A/'p23-02-native-guest-bulk-local-r315.gd').read_text()
qa=qa.replace('var _bulk_records: Array = []','const ProtocolHelper = preload('+json.dumps(str(O/'protocol_helper.gd'))+')\n\nvar _bulk_records: Array = []',1)
a='\t_test_bulk_candidates()\n\tvar output := OS.get_environment("THE_TREE_RUNTIME_MONITOR_OUTPUT")';b='''\t_test_bulk_candidates()
var output := OS.get_environment("THE_TREE_RUNTIME_MONITOR_OUTPUT")
var protocol = ProtocolHelper.new()
var protocol_core: Object = ClassDB.instantiate(&"TheTreeNumericCore")
var protocol_report: Dictionary = protocol.run_frozen(protocol_core,'''+json.dumps(str(A/'p23-02-native-bridge-Godot-protocol-preparation-r73/pinned-inputs.json'))+''')
var core_ref: WeakRef = weakref(protocol_core)
protocol_core = null
_expect(core_ref.get_ref() == null, "combined protocol core with populated cache releases")
_checks += int(protocol_report["checks"])
_failures += protocol_report["failures"].size()
var protocol_file := FileAccess.open(output.path_join("protocol-report.json"),FileAccess.WRITE)
if protocol_file == null: quit(98); return
protocol_file.store_string(JSON.stringify(protocol_report,"\\t")+"\\n");protocol_file.close()
protocol = null''';assert a in qa;qa=qa.replace(a,b,1)
qa=qa.replace('"original_s3_invocations": 18,','"original_s3_invocations": 18, "protocol_cases": 50, "protocol_checks": int(protocol_report["checks"]),')
write(O/'local.gd',qa)
guard=(A/'p23-02-native-guest-bulk-local-r315/candidate-guarded.gd').read_text()
guard=guard.replace('p23-02-native-guest-bulk-local-r315.gd','p23-02-native-hot-loop-local-r329/local.gd').replace('p23-02-native-guest-bulk-local-r315/candidate.gdextension','p23-02-native-hot-loop-local-r329/candidate.gdextension')
write(O/'candidate-guarded.gd',guard)
runner=(A/'p23-02-native-guest-bulk-local-r315.py').read_text().replace('p23-02-native-guest-bulk-local-r315','p23-02-native-hot-loop-local-r329')
a=" fixture=output/'fixtures.varbytes';assert fixture.stat().st_size==report['fixture_bytes'] and r.sha(fixture)==report['fixture_sha256']"
b=a+"\n protocol=r.read(output/'protocol-report.json');assert protocol['passed'] and not protocol['failures'] and len(protocol['cases'])==50 and len(protocol['cached_cases'])==50 and protocol['checks']==report['protocol_checks']\n assert fixture.read_bytes()==Path(plan['original_Guest_fixture']['path']).read_bytes(), 'Unchanged full Guest53 original fixture bytes'"
assert a in runner;runner=runner.replace(a,b,1)
runner=runner.replace('Finite standalone Guest candidate ABI/local and18 affected original S3 methods only.','Finite Guest53 and18 affected original S3 methods plus frozen50 protocols/shrink/ownership/reentrant collision on same new bridge.')
write(A/'p23-02-native-hot-loop-local-r329.py',runner)
print('Prepared single-engine combined local/protocol QA. Engine0.')
@@ -0,0 +1,3 @@
# Native hot loop candidate r325–r329
The manifest preserves source, build, numeric corpus, local evidence, review receipts and root verification. Compressed copies were decompressed and compared against every original byte. Originals remain in the artifact area. Files are checkpoints, not a production deployment. Candidate r326/library327 remains unselected and unadopted. Whole-state comparison, final regression and unit acceptance are pending. See the current execution note for scope.
@@ -0,0 +1,17 @@
# P23-02 native修正候補 r325–r329
ユーザーの現在成果をコミット・pushする指示に従い、r326/library327のソース、ビルド、局所証拠と独立レビューを保存する。制作r32、選定済み実装親r274/library275は変更していない。新候補は未選定・未採用であり、正式完了追加0。30パッケージ/88成果単位、部分点なし、正式9/着手19/予定60を維持する。
修正はnumeric frontierのheap化、cached edge参照、PackedInt64Array書込、nearest goal読取、性能記録の固定長配列、Guest99キーの呼出内保持にまとめた。callback順・算術・保存値・公開出力を保つ範囲で実装した。生成初期版から縮小入力互換性を修正した最終CPPはSHA256 a2434ef2fbc9624aa3b62746cebde2cacdce78712d4d866774df54fbd291bee3。Guest/Runtimeは親r313-r02とbyte不変。
r327はbridge compile1/link1、SDK compile0で正常終了し、libraryは417,184 bytes/SHA256 64608dccb3441594603fa5561fad3e2e90b055f32e4823c4864d2486a298602c。r328の16,388入力で原版・候補の7出力fieldsが全文一致した。実statusはusable13,549/unusable2,839/wrapped0であり、numeric corpus単独のwrap到達を認定しない。
r329はPID36884正常終了、7,415チェック/失敗0。Guest53記録606,268 bytesが原315と全文一致し、その固定rawに対応する既存codec証拠を再利用した。既存50protocolの原/cold/warm/clear、縮小入力、解放、同じcacheへの再入inner9/outer7/warm9を確認した。実wrap-prefixはこの局所protocol検査が支える。試験件数を成果単位の完了数に換算しない。
静的r326、build実r327、局所実r329は読取専用の独立レビューで有限scopeのみ支持された。r329 receiptは88,603 bytes/SHA256 56fab0fb4c8b9218dcfdf22b914f12843dad0b8fbadcfd96d81f0ef8ea8fa895、blockers=[]。rootがdirect161/current D4 4/archive4の169pinsを再照合し全一致した。ビルド、stage、source/default、canonical D4保持の証拠を保存している。
次に閉じる1件はP23-02、依存P08/P22。全受入条件・対象版はcurrent r320 dispositionと前記CURRENT_NATIVE_DIAGNOSTIC_R321_R323.mdを継承する。C01〜C09/X1〜X8の17条件は未受入。C08/X8だけWindows実機block。Ctrl+ホイールと左ボタン保持ドラッグはユーザー指示で延期し、未達・非免除のまま残す。
次の必要な検証は同じ保存入力によるS6とwhole647の比較(準備中r330、未実行)。代表負荷性能、安定利益、50ms/P95/D10、通常OS操作、小画面、x3、同一Windows、正確な最終版の必須全回帰・独立受入は未達。未確定の環境・数値は設定しない。今回の有限証拠を全状態一致・性能改善・正式単位受入へ拡張しない。
保存入口はcheckpoints/native-hot-loop-r325-r329/manifest.json。ソースと全証拠を内容保持圧縮し、全保存コピーの復元byte一致を検証した。既存成果や未実行検証を削除せず、今回のpushのために追加回帰や別の実装を起動していない。