Cascade-delete an agent and all dependent data (TEST-001 fix)
Cascade-delete an agent and all dependent data (TEST-001 fix).
Intended for test/cleanup flows. Safety guard: requires the agent name
to begin with __ (the smoke-test naming convention) OR for the agent
to have fewer than 100 traces. This prevents accidental deletion of
production agents from leaked test scripts.
H1021: scoped by caller’s org_id. Pre-fix, a valid API key from Org A
could DELETE Org B’s traces+manifests by guessing the agent_name; the
cascade had no tenant boundary. All discovery and cascade queries now
filter .org_id == org_id so the destructive operation is contained
to the caller’s own data.
H1023 (batched): the unused key_ctx: KeyContext parameter (which
referenced an unimported name and would have failed mypy —strict)
is replaced by the org_id dep above.