teleo-infrastructure/docs/reports/leo-working-state-20260709/rio-strategy-preflight.sql
twentyOne2x b508a1106b
Some checks are pending
CI / lint-and-test (push) Waiting to run
Add Rio strategy context packet
- Create guarded Rio strategy nodes and anchors after the mapped base packet
- Prove clone apply and rollback while production rows and Leo runtime stay unchanged
- Retain packet docs, state image, and focused tests for future apply review

`docs/reports/leo-working-state-20260709/current-truth-index.md`
`docs/reports/leo-working-state-20260709/leo-db-state-23-rio-strategy-context.svg`
`docs/reports/leo-working-state-20260709/rio-strategy-apply-authorized-commit.sql`
`docs/reports/leo-working-state-20260709/rio-strategy-apply-rollback-rehearsal.sql`
`docs/reports/leo-working-state-20260709/rio-strategy-clone-rehearsal-current.log`
`docs/reports/leo-working-state-20260709/rio-strategy-context-current.md`
`docs/reports/leo-working-state-20260709/rio-strategy-delete-rollback.sql`
`docs/reports/leo-working-state-20260709/rio-strategy-packet.json`
`docs/reports/leo-working-state-20260709/rio-strategy-postflight.sql`
`docs/reports/leo-working-state-20260709/rio-strategy-preflight.sql`
`docs/reports/leo-working-state-20260709/working-leo-current-state-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-execution-plan-current.md`
`scripts/kb_rio_strategy_context_packet.py`
`tests/test_kb_rio_strategy_context_packet.py`
2026-07-10 00:11:23 +02:00

66 lines
2.2 KiB
SQL

\set ON_ERROR_STOP on
-- Rio strategy-context companion preflight. Read-only.
-- Run after the mapped rich proposal packet has been applied.
select 'rio_agent' as check_name, id::text, handle, kind
from public.agents
where id = '22222222-2222-2222-2222-222222222222'::uuid;
select 'required_base_claim' as check_name,
c.id::text,
c.status,
left(c.text, 220) as text
from public.claims c
where c.id in (select id from (values
('004195cc-ab62-526c-90fb-51cb0f826ec0'::uuid),
('67003e10-e1ee-5905-8b51-1b0cb263ec11'::uuid),
('e6ce4e36-15d2-53bc-8b74-dda0efc095c1'::uuid)
) as v(id))
order by c.id;
select 'back_shared_root' as check_name,
id::text,
title,
left(body, 220) as body
from public.shared_root
where id = '6248818e-fe16-4d3b-8008-ef9752b80632'::uuid;
select 'existing_exact_rio_strategy_title' as check_name,
id::text,
agent_id::text,
title,
status
from public.strategy_nodes
where agent_id = '22222222-2222-2222-2222-222222222222'::uuid
and title in (
'Rio capital deployment layer',
'Rio internet-finance capital product'
)
order by title;
-- Must be 0/0 before authorized apply.
select
(select count(*) from public.strategy_nodes where id in (select id from (values
('4f3e3d77-50fa-520a-8c8b-5a4269d94a9b'::uuid),
('063528a6-a07c-5c14-abdf-dc12a0b10fcf'::uuid)
) as v(id))) as generated_strategy_node_rows,
(select count(*) from public.strategy_node_anchors where id in (select id from (values
('3a0e2228-a74f-5971-b467-fb527ccdfb37'::uuid),
('3f7a9f84-eb2e-5d94-9ca4-afc3bad47f96'::uuid),
('d18eaa71-d458-53cc-baac-e5306a1779e2'::uuid),
('33d9eb08-c9c2-5e2d-a9a7-3d7f1b5f0f0c'::uuid),
('3b2a8908-120d-59a5-bbd5-d2711a123aa3'::uuid)
) as v(id))) as generated_strategy_anchor_rows;
select 'governance_gate_known_not_written' as check_name,
id::text,
name,
left(criteria, 180) as criteria,
left(evidence_bar, 180) as evidence_bar
from public.governance_gates
where id in (select id from (values
('fa88e31b-6fca-4801-bf72-f5db81950a11'::uuid),
('45695897-2a9c-4279-ac25-e59f166dec6a'::uuid)
) as v(id))
order by name;