feat(pods): Verhaltensprobe als Prüfschritt

Beim Prüfen schreibt und liest PodsProbe auf einem Wegwerf-Entwurf ein Textfeld genau so, wie LIT MCP es tut, vergleicht die Werte und löscht den Entwurf wieder. Bevorzugt von Pods angelegte Typen; ohne Pod mit Textfeld gilt der Schritt als grün mit Hinweis „nicht geprüft“. Ein roter Schritt sperrt Pods über die Berichtssperre. Liegengebliebene Probe-Einträge räumt der Load-Hook des Reiters auf. Pods-Smoke um Probe und Bereinigung erweitert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-11-06 14:33:26 +01:00
co-authored by Claude Opus 5.5
parent 42aa4f8dc9
commit 1a294b7881
11 changed files with 812 additions and 10 deletions
+27 -1
View File
@@ -62,9 +62,16 @@ REPORT=$(stored_option lit_mcp_pods_check_report)
echo "$REPORT" | jq -e '(.steps | length) >= 1 and all(.steps[]; .problems == [] and .skipped == false)
and .version == "3.3.9.2" and (has("divi_version") | not)' >/dev/null || fail "the stored report must be green with key version: $REPORT"
[ -z "$(stored_option lit_mcp_pods_check_lock)" ] || fail "the check lock must be released"
# The behaviour probe is part of the report (green, not skipped, its label is the real probe, not "not probed") ...
echo "$REPORT" | jq -e '[.steps[] | select(.key == "probe")] | length == 1 and (.[0] | .problems == [] and .skipped == false
and (.label | contains("nicht geprüft") | not))' >/dev/null || fail "the report must contain the green probe step: $REPORT"
# ... and leaves no entry behind (it ran on lit_person; any status, any marked entry).
LEFT=$(wp post list --post_type=any --post_status=any --meta_key=_lit_mcp_check_entry --format=count)
[ "$LEFT" = "0" ] || fail "the probe left $LEFT entries behind"
[ "$(wp post list --post_type=lit_person --post_status=any --format=count)" = "0" ] || fail "the probe left a lit_person entry"
UNAUTH=$(curl -s -o /dev/null -w '%{http_code}' -X POST -H "Host: $HOST" -H 'X-Forwarded-Proto: https' "$BASE/wp-json/lit-mcp/v1/pods-check")
[ "$UNAUTH" = "401" ] || [ "$UNAUTH" = "403" ] || fail "anonymous check must be refused, got $UNAUTH"
pass "/pods-check: 303 to the tab, green report with key version, lock released, anonymous refused"
pass "/pods-check: 303 to the tab, green report with key version and probe step, no probe entry left, lock released, anonymous refused"
# 3. The tab renders the Pods section and, as 3.3.9.2 is tested, offers no release
TAB=$(wp --user="$ADMIN_LOGIN" eval '
@@ -78,6 +85,25 @@ echo "$TAB" | grep -q 'lit-mcp-compat-check-pods' || fail "the Pods section must
echo "$TAB" | grep -q 'lit-mcp-compat-release-pods' && fail "no release button for a tested version"
pass "tab Compatibility: Pods section with version and state, check button, no release button"
# 3b. Orphan cleanup: an old marked probe entry (a dead check) is deleted on the tab's profile-load hook, a young one and
# an unmarked entry with the same title are not.
ORPHANS=$(wp --user="$ADMIN_LOGIN" eval '
$make = static fn (string $date, bool $marked): int => (int) wp_insert_post([
"post_type" => "lit_person", "post_status" => "draft", "post_title" => LIT\MCP\Integrations\Pods\PodsProbe::TITLE . " smoke",
"post_date" => get_date_from_gmt($date), "post_date_gmt" => $date,
"meta_input" => $marked ? [LIT\MCP\Integrations\Pods\PodsProbe::MARKER => "1"] : [],
]);
$old = $make(gmdate("Y-m-d H:i:s", time() - 3600), true);
$young = $make(gmdate("Y-m-d H:i:s"), true);
$unmarked = $make(gmdate("Y-m-d H:i:s", time() - 3600), false);
do_action(LIT\MCP\Admin\CompatibilityTab::LOAD_ACTION, "pods");
echo json_encode([$old, $young, $unmarked, get_post_status($old), get_post_status($young), get_post_status($unmarked)]);')
OLD_ID=$(echo "$ORPHANS" | jq -r '.[0]'); YOUNG_ID=$(echo "$ORPHANS" | jq -r '.[1]'); UNMARKED_ID=$(echo "$ORPHANS" | jq -r '.[2]')
CREATED_POSTS+=("$OLD_ID" "$YOUNG_ID" "$UNMARKED_ID")
echo "$ORPHANS" | jq -e '.[3] == false and .[4] == "draft" and .[5] == "draft"' >/dev/null \
|| fail "orphan cleanup must delete only the old marked entry: $ORPHANS"
pass "orphan cleanup: old marked probe entry deleted, young and unmarked ones kept"
# 4. Release: refused for the tested version; for an untested one (simulated profile) it is only documented
[ "$(handler release real)" = "compat_release_refused" ] || fail "releasing a tested version must be refused"
[ -z "$(stored_option lit_mcp_pods_releases)" ] || fail "a refused release must write nothing"