-- 20260517 ChatGPT
-- $Header$
--
-- Example:
--   cd /usr/local/src/ble-reticulum/migration
--   sqlite3 ble_migration.sqlite ".read sql/mark_fragmentation_cpp_field_accepted_20260517.sql"
--
-- Purpose:
--   Mark Phase 1 C++ fragmentation/reassembly/HDLC work as field accepted
--   after successful bilateral Constitution transfer using the C++ backend.

BEGIN;

UPDATE symbols
   SET status = 'FIELD_ACCEPTED',
       phase = '1_protocol_core',
       notes = trim(COALESCE(notes, '') || char(10) ||
           '2026-05-17: FIELD_ACCEPTED. C++ protocol-core backend passed live bilateral Constitution transfer after rebooting devzero1 and increasing transfer timeout from 60 to 90 seconds. A forensic run directory was preserved for the pre-reboot hardware/timeout lock investigation.'),
       updated_at = CURRENT_TIMESTAMP
 WHERE source_file = 'src/ble_reticulum/BLEFragmentation.py'
   AND (
        symbol_name IN (
            'BLEFragmenter',
            '__init__',
            'fragment_packet',
            'get_fragment_overhead',
            'BLEReassembler',
            'receive_fragment',
            '_reassemble',
            'cleanup_stale_buffers',
            'get_statistics',
            'reset_statistics',
            'HDLCFramer',
            'frame_packet',
            'deframe_packet'
        )
        OR class_name IN ('BLEFragmenter', 'BLEReassembler', 'HDLCFramer')
   );

INSERT INTO reviews (
    symbol_id,
    reviewer,
    old_tag,
    new_tag,
    old_status,
    new_status,
    note
)
SELECT
    symbol_id,
    'jlpoole + Codex + ChatGPT',
    tag,
    tag,
    status,
    'FIELD_ACCEPTED',
    '2026-05-17: C++ fragmentation/reassembly/HDLC backend accepted after live bilateral Constitution transfer. Reboot of devzero1 cleared suspected BLE/hardware lock after earlier 60-second timeout runs. Timeout increased to 90 seconds. Forensic run directory preserved.'
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEFragmentation.py'
  AND (
        symbol_name IN (
            'BLEFragmenter',
            '__init__',
            'fragment_packet',
            'get_fragment_overhead',
            'BLEReassembler',
            'receive_fragment',
            '_reassemble',
            'cleanup_stale_buffers',
            'get_statistics',
            'reset_statistics',
            'HDLCFramer',
            'frame_packet',
            'deframe_packet'
        )
        OR class_name IN ('BLEFragmenter', 'BLEReassembler', 'HDLCFramer')
  );

COMMIT;
