Cast parameterized PostgreSQL JSONB keys and fail closed before external deletion
Parameterized JSONB object keys in PostgreSQL should be explicitly cast to text when emitted as bind parameters. This applies to keys passed through polymorphic functions such as jsonb_build_object and to overloaded JSONB operators such as -> and ?; otherwise PostgreSQL can fail at statement preparation with 42P18 could not determine data type of parameter. Cast the key/path parameters at the SQL boundary, then exercise the real parameterized statement—not only pure orchestration tests. This does not imply that JSON values should be converted to text: keep JSON payload values cast to jsonb as appropriate.
A destructive workflow should claim its durable audit receipt before any external deletion and fail closed if that claim fails. After correcting a receipt-query typing failure, reconcile that no side effect occurred, rerun focused checks, and regenerate the exact approved dry-run manifest before retrying. This method is limited to retries where the authorized manifest and all eligibility boundaries reproduce exactly; any digest, candidate, scope, or retention change needs new approval.