feat(compat): sweep of components against the real core with strict diagnostics

This commit is contained in:
kj
2026-10-05 17:36:08 -03:00
parent 1127272330
commit 0b98b7a26b
19 changed files with 740 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Smoke HTTP del paquete text. Recibe BASE, PROJ, PKG, LOG, RESULTS.
set -u
check() {
local comp="$1" path="$2" expect="$3" body
if ! body="$(curl -fsS "$BASE$path" 2>/dev/null)"; then
echo "$PKG:$comp|fail" >> "$RESULTS"
return
fi
if printf '%s' "$body" | grep -qF "$expect"; then
echo "$PKG:$comp|ok" >> "$RESULTS"
else
echo " respuesta inesperada en $path: $(printf '%s' "$body" | head -c 200)" >&2
echo "$PKG:$comp|fail" >> "$RESULTS"
fi
}
check filter /compat/text/filter 'HOLA MUNDIN'
check replacement /compat/text/replacement 'bar y food'
+28
View File
@@ -0,0 +1,28 @@
<?php
// Router de compatibilidad del paquete text (inyectado en src/Routers/Compat.php
// por scripts/compat-sweep). Ejercita Filter y Replacement sobre el arranque
// real del core (Loader -> Router::apply()).
use Libs\Filter;
use Libs\Replacement;
use Libs\Router;
Router::get('/compat/text/filter', function () {
Filter::add(
fn (string $content): string => str_replace('mundo', 'MUNDIN', $content),
'compat',
5
);
Filter::add(
fn (string $content): string => strtoupper($content) . '|',
'compat',
20
);
echo 'FILTER_OK:' . Filter::apply('hola mundo', 'compat');
});
Router::get('/compat/text/replacement', function () {
Replacement::add('/\bfoo\b/', 'bar');
echo 'REPL_OK:' . Replacement::apply('foo y food y foo');
});