ble-reticulum/migration/sql/executive_summary.sql

145 lines
3.2 KiB
MySQL
Raw Normal View History

2026-05-17 12:49:55 -07:00
--
-- For ChatGPT's tracking
--
-- 20260517 ChatGPT
-- $Header$
--
-- Example:
-- cd /usr/local/src/ble-reticulum/migration
-- sqlite3 ble_migration.sqlite ".read sql/executive_summary.sql"
--
-- Purpose:
-- Executive summary of BLE Reticulum C++ migration status.
.headers on
.mode column
.width 14 14 10 8 6 60
.print ''
.print '============================================================'
.print 'BLE Reticulum Migration Executive Summary'
.print '============================================================'
.print ''
.print '1. Counts by phase/status/tag'
SELECT
phase,
status,
tag,
COUNT(*) AS symbol_count
FROM symbols
GROUP BY phase, status, tag
ORDER BY phase, status, tag;
.print ''
.print '2. Phase-1 C++ candidates'
SELECT
source_file,
COALESCE(class_name, '') AS class_name,
symbol_name,
line_number,
tag,
status
FROM symbols
WHERE phase = '1_protocol_core'
OR cpp_candidate = 1
ORDER BY source_file, line_number;
.print ''
.print '3. Symbols marked TESTED or ACCEPTED'
SELECT
source_file,
COALESCE(class_name, '') AS class_name,
symbol_name,
phase,
status,
substr(COALESCE(notes, ''), 1, 80) AS notes_preview
FROM symbols
WHERE status IN ('TESTED', 'ACCEPTED', 'FIELD_ACCEPTED', 'WRAPPED_FOR_PYTHON')
ORDER BY source_file, line_number;
.print ''
.print '4. Remaining CORE symbols not accepted'
SELECT
source_file,
COALESCE(class_name, '') AS class_name,
symbol_name,
line_number,
phase,
status,
substr(COALESCE(rationale, ''), 1, 80) AS rationale_preview
FROM symbols
WHERE tag = 'CORE'
AND status NOT IN ('ACCEPTED', 'FIELD_ACCEPTED', 'REJECTED', 'DEFERRED')
ORDER BY source_file, line_number;
.print ''
.print '5. Unknown or needs-review symbols'
SELECT
source_file,
COALESCE(class_name, '') AS class_name,
symbol_name,
line_number,
tag,
status,
substr(COALESCE(rationale, ''), 1, 80) AS rationale_preview
FROM symbols
WHERE tag = 'UNKNOWN'
OR status = 'NEEDS_REVIEW'
ORDER BY source_file, line_number;
.print ''
.print '6. Do-not-port-yet inventory'
SELECT
tag,
COUNT(*) AS symbol_count
FROM symbols
WHERE tag IN ('GLUE', 'PLATFORM', 'TEST')
GROUP BY tag
ORDER BY tag;
.print ''
.print '7. Candidate next tasks'
SELECT
source_file,
COALESCE(class_name, '') AS class_name,
symbol_name,
line_number,
tag,
phase,
status,
cpp_candidate,
substr(COALESCE(rationale, ''), 1, 100) AS rationale_preview
FROM symbols
WHERE (
tag = 'CORE'
AND status IN ('DISCOVERED', 'CLASSIFIED', 'TESTED', 'WRAPPED_FOR_PYTHON')
)
OR (
cpp_candidate = 1
AND status NOT IN ('ACCEPTED', 'FIELD_ACCEPTED', 'REJECTED', 'DEFERRED')
)
ORDER BY
CASE
WHEN source_file LIKE '%BLEInterface.py%' THEN 1
WHEN source_file LIKE '%BLEFragmentation.py%' THEN 2
ELSE 3
END,
source_file,
line_number;
.print ''
.print '8. Latest review notes'
SELECT
r.reviewed_at,
r.reviewer,
s.source_file,
COALESCE(s.class_name, '') AS class_name,
s.symbol_name,
r.old_status,
r.new_status,
substr(COALESCE(r.note, ''), 1, 100) AS note_preview
FROM reviews r
JOIN symbols s ON s.symbol_id = r.symbol_id
ORDER BY r.reviewed_at DESC
LIMIT 20;