feat(llvm): Phase 97 Box/Policy refactoring complete

Box化完了:
- CallRoutePolicyBox: Call routing SSoT
- PrintArgMarshallerBox: Print marshalling SSoT
- TypeFactsBox: Type propagation SSoT
- PhiSnapshotPolicyBox: PHI contract SSoT
- PluginErrorContext: Structured error reporting

📋 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-17 04:14:26 +09:00
parent 65763c1ed6
commit 6d73fc3404
16 changed files with 1861 additions and 64 deletions

View File

@ -21,32 +21,45 @@ fi
FILEBOX_SO="$NYASH_ROOT/plugins/nyash-filebox-plugin/libnyash_filebox_plugin.so"
MAPBOX_SO="$NYASH_ROOT/plugins/nyash-map-plugin/libnyash_map_plugin.so"
# Phase 98 P0: Ensure required dynamic plugin artifacts exist and are loadable.
echo "[INFO] Ensuring plugin artifacts (FileBox/MapBox)"
if ! bash "$NYASH_ROOT/tools/plugins/build-all.sh" nyash-filebox-plugin nyash-map-plugin >/dev/null; then
echo "[FAIL] tools/plugins/build-all.sh failed for FileBox/MapBox"
exit 1
fi
if [ ! -f "$FILEBOX_SO" ] || [ ! -f "$MAPBOX_SO" ]; then
echo "[FAIL] Required plugin artifacts still missing after build-all (FileBox/MapBox)"
echo "[INFO] FileBox: $FILEBOX_SO"
echo "[INFO] MapBox: $MAPBOX_SO"
exit 1
fi
if ! python3 - <<PY 2>/dev/null; then
check_plugins() {
python3 - "$FILEBOX_SO" "$MAPBOX_SO" <<'PY'
import ctypes
ctypes.CDLL(r"$FILEBOX_SO")
ctypes.CDLL(r"$MAPBOX_SO")
import os
import sys
names = ["FileBox", "MapBox"]
paths = sys.argv[1:]
failures = []
for name, path in zip(names, paths):
if not os.path.isfile(path):
failures.append(f"[plugin/missing] {name}: {path}")
continue
try:
ctypes.CDLL(path)
except Exception as e: # noqa: BLE001
failures.append(f"[plugin/dlopen] {name}: {path} ({e})")
if failures:
print("\n".join(failures))
sys.exit(1)
print("OK")
PY
echo "[FAIL] Plugin dlopen check failed for FileBox/MapBox"
python3 - <<PY 2>&1 | tail -n 80
import ctypes
ctypes.CDLL(r"$FILEBOX_SO")
ctypes.CDLL(r"$MAPBOX_SO")
print("OK")
PY
exit 1
}
echo "[INFO] Checking plugin artifacts (FileBox/MapBox)"
if ! CHECK_OUTPUT=$(check_plugins 2>&1); then
echo "$CHECK_OUTPUT"
echo "[INFO] Missing/broken plugin detected, running build-all (FileBox/MapBox)"
BUILD_LOG="/tmp/phase97_json_loader_escape_plugin_build.log"
if ! bash "$NYASH_ROOT/tools/plugins/build-all.sh" nyash-filebox-plugin nyash-map-plugin >"$BUILD_LOG" 2>&1; then
echo "[FAIL] tools/plugins/build-all.sh failed for FileBox/MapBox"
tail -n 80 "$BUILD_LOG"
exit 1
fi
if ! CHECK_OUTPUT=$(check_plugins 2>&1); then
echo "$CHECK_OUTPUT"
echo "[FAIL] Plugin artifacts still missing or unloadable after build-all"
tail -n 80 "$BUILD_LOG"
exit 1
fi
fi
mkdir -p "$NYASH_ROOT/tmp"

View File

@ -21,32 +21,45 @@ fi
FILEBOX_SO="$NYASH_ROOT/plugins/nyash-filebox-plugin/libnyash_filebox_plugin.so"
MAPBOX_SO="$NYASH_ROOT/plugins/nyash-map-plugin/libnyash_map_plugin.so"
# Phase 98 P0: Ensure required dynamic plugin artifacts exist and are loadable.
echo "[INFO] Ensuring plugin artifacts (FileBox/MapBox)"
if ! bash "$NYASH_ROOT/tools/plugins/build-all.sh" nyash-filebox-plugin nyash-map-plugin >/dev/null; then
echo "[FAIL] tools/plugins/build-all.sh failed for FileBox/MapBox"
exit 1
fi
if [ ! -f "$FILEBOX_SO" ] || [ ! -f "$MAPBOX_SO" ]; then
echo "[FAIL] Required plugin artifacts still missing after build-all (FileBox/MapBox)"
echo "[INFO] FileBox: $FILEBOX_SO"
echo "[INFO] MapBox: $MAPBOX_SO"
exit 1
fi
if ! python3 - <<PY 2>/dev/null; then
check_plugins() {
python3 - "$FILEBOX_SO" "$MAPBOX_SO" <<'PY'
import ctypes
ctypes.CDLL(r"$FILEBOX_SO")
ctypes.CDLL(r"$MAPBOX_SO")
import os
import sys
names = ["FileBox", "MapBox"]
paths = sys.argv[1:]
failures = []
for name, path in zip(names, paths):
if not os.path.isfile(path):
failures.append(f"[plugin/missing] {name}: {path}")
continue
try:
ctypes.CDLL(path)
except Exception as e: # noqa: BLE001
failures.append(f"[plugin/dlopen] {name}: {path} ({e})")
if failures:
print("\n".join(failures))
sys.exit(1)
print("OK")
PY
echo "[FAIL] Plugin dlopen check failed for FileBox/MapBox"
python3 - <<PY 2>&1 | tail -n 80
import ctypes
ctypes.CDLL(r"$FILEBOX_SO")
ctypes.CDLL(r"$MAPBOX_SO")
print("OK")
PY
exit 1
}
echo "[INFO] Checking plugin artifacts (FileBox/MapBox)"
if ! CHECK_OUTPUT=$(check_plugins 2>&1); then
echo "$CHECK_OUTPUT"
echo "[INFO] Missing/broken plugin detected, running build-all (FileBox/MapBox)"
BUILD_LOG="/tmp/phase97_next_non_ws_plugin_build.log"
if ! bash "$NYASH_ROOT/tools/plugins/build-all.sh" nyash-filebox-plugin nyash-map-plugin >"$BUILD_LOG" 2>&1; then
echo "[FAIL] tools/plugins/build-all.sh failed for FileBox/MapBox"
tail -n 80 "$BUILD_LOG"
exit 1
fi
if ! CHECK_OUTPUT=$(check_plugins 2>&1); then
echo "$CHECK_OUTPUT"
echo "[FAIL] Plugin artifacts still missing or unloadable after build-all"
tail -n 80 "$BUILD_LOG"
exit 1
fi
fi
mkdir -p "$NYASH_ROOT/tmp"