Compare commits

..

2 commits

Author SHA1 Message Date
91037ea77d Freeze phase 1 BLE protocol core migration 2026-05-17 13:32:09 -07:00
097bf9e988 Identities works 2026-05-17 13:22:25 -07:00
6 changed files with 485 additions and 1 deletions

View file

@ -122,3 +122,4 @@ Caution: one-way latency assumes sender and receiver clocks are synchronized.
Your chronyc tracking output helps bound this error, but it is not a substitute for ACK/round-trip timing.
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum/scripts $
```
May 17, 2026 1:21 PM Identities CPP works and tested in field with bilateral Constitution test. Report: migration/reports/identities_20260517_report.md

View file

@ -1 +1 @@
5/17/26: This branch is for runs which I might laster want to reference. Case in point: run13 - something, possible a timeout taking effect before a [bilateral Constitution] transfer was completed left zerodev1 in such a state that a reboot was necessary. This is very bad and needs to be duplicated and understood so in production if the same conditions are met, they are gracefully handled. "runX" directories here are moved from the tmp/runs branch which is not under source control.
5/17/26: This branch is for runs which I might laster want to reference. Case in point: run14 - something, possible a timeout taking effect before a [bilateral Constitution] transfer was completed left zerodev1 in such a state that a reboot was necessary. This is very bad and needs to be duplicated and understood so in production if the same conditions are met, they are gracefully handled. "runX" directories here are moved from the tmp/runs branch which is not under source control.

View file

@ -0,0 +1,266 @@
============================================================
BLE Reticulum Migration Executive Summary
============================================================
1. Counts by phase/status/tag
phase status tag symbol_c
-------------- -------------- ---------- --------
0_inventory REVIEWED GLUE 39
0_inventory REVIEWED PLATFORM 33
0_inventory REVIEWED TEST 3
1_protocol_cor FIELD_ACCEPTED CORE 16
e
2. Phase-1 C++ candidates
source_file class_name symbol_nam line_num tag status
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------
src/ble_reticu BLEFragmen 52 CORE FIELD_ACCEPTED
lum/BLEFragmen ter
tation.py
src/ble_reticu BLEFragmenter __init__ 68 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu BLEFragmenter fragment_p 82 CORE FIELD_ACCEPTED
lum/BLEFragmen acket
tation.py
src/ble_reticu BLEFragmenter get_fragme 158 CORE FIELD_ACCEPTED
lum/BLEFragmen nt_overhea
tation.py d
src/ble_reticu BLEReassem 176 CORE FIELD_ACCEPTED
lum/BLEFragmen bler
tation.py
src/ble_reticu BLEReassembler __init__ 187 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu BLEReassembler receive_fr 205 CORE FIELD_ACCEPTED
lum/BLEFragmen agment
tation.py
src/ble_reticu BLEReassembler _reassembl 380 CORE FIELD_ACCEPTED
lum/BLEFragmen e
tation.py
src/ble_reticu BLEReassembler cleanup_st 402 CORE FIELD_ACCEPTED
lum/BLEFragmen ale_buffer
tation.py s
src/ble_reticu BLEReassembler get_statis 429 CORE FIELD_ACCEPTED
lum/BLEFragmen tics
tation.py
src/ble_reticu BLEReassembler reset_stat 443 CORE FIELD_ACCEPTED
lum/BLEFragmen istics
tation.py
src/ble_reticu HDLCFramer 450 CORE FIELD_ACCEPTED
lum/BLEFragmen
tation.py
src/ble_reticu HDLCFramer frame_pack 464 CORE FIELD_ACCEPTED
lum/BLEFragmen et
tation.py
src/ble_reticu HDLCFramer deframe_pa 491 CORE FIELD_ACCEPTED
lum/BLEFragmen cket
tation.py
src/ble_reticu BLEInterface _get_fragm 1858 CORE FIELD_ACCEPTED
lum/BLEInterfa enter_key
ce.py
src/ble_reticu BLEInterface _compute_i 1871 CORE FIELD_ACCEPTED
lum/BLEInterfa dentity_ha
ce.py sh
3. Symbols marked TESTED or ACCEPTED
source_file class_name symbol_nam phase status notes_preview
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------
src/ble_reticu BLEFragmen 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ter ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter __init__ 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter fragment_p 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen acket ol_core ACCEPT ol cell: BLEFragment
tation.py ED
src/ble_reticu BLEFragmenter get_fragme 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen nt_overhea ol_core ACCEPT ol cell: BLEFragment
tation.py d ED
src/ble_reticu BLEReassem 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen bler ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler __init__ 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler receive_fr 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen agment ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler _reassembl 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen e ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler cleanup_st 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ale_buffer ol_core ACCEPT ol cell: BLEReassemb
tation.py s ED
src/ble_reticu BLEReassembler get_statis 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen tics ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu BLEReassembler reset_stat 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen istics ol_core ACCEPT ol cell: BLEReassemb
tation.py ED
src/ble_reticu HDLCFramer 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen ol_core ACCEPT ol cell: HDLCFramer
tation.py ED
src/ble_reticu HDLCFramer frame_pack 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen et ol_core ACCEPT ol cell: HDLCFramer.
tation.py ED
src/ble_reticu HDLCFramer deframe_pa 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEFragmen cket ol_core ACCEPT ol cell: HDLCFramer.
tation.py ED
src/ble_reticu BLEInterface _get_fragm 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEInterfa enter_key ol_core ACCEPT ol cell: _get_fragme
ce.py ED
src/ble_reticu BLEInterface _compute_i 1_protoc FIELD_ Imported from Codex_response_20260616_1514.md; original symb
lum/BLEInterfa dentity_ha ol_core ACCEPT ol cell: _compute_id
ce.py sh ED
4. Remaining CORE symbols not accepted
5. Unknown or needs-review symbols
6. Do-not-port-yet inventory
tag symbol_count
-------------- --------------
GLUE 39
PLATFORM 33
TEST 3
7. Candidate next tasks
8. Latest review notes
reviewed_at reviewer source_fil class_na symbol old_status new_status note_preview
-------------- -------------- ---------- -------- ------ ------------------------------------------------------------ -------------- ------------------------------------------------------------
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _compu FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Identity helper C++ equivalents accepted after A
25:58 x + ChatGPT ticulum/BL face te_ide RM equivalence tests and successful bila
EInterface ntity_
.py hash
2026-05-17 20: jlpoole + Code src/ble_re BLEInter _get_f FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: Identity helper C++ equivalents accepted after A
25:58 x + ChatGPT ticulum/BL face ragmen RM equivalence tests and successful bila
EInterface ter_ke
.py y
2026-05-17 19: jlpoole + Code src/ble_re BLEFra FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL gmente ed after live bilateral Constitution tra
EFragmenta r
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLERea FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL ssembl ed after live bilateral Constitution tra
EFragmenta er
tion.py
2026-05-17 19: jlpoole + Code src/ble_re HDLCFr FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL amer ed after live bilateral Constitution tra
EFragmenta
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEFragm __init FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL enter __ ed after live bilateral Constitution tra
EFragmenta
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEFragm fragme FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL enter nt_pac ed after live bilateral Constitution tra
EFragmenta ket
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEFragm get_fr FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL enter agment ed after live bilateral Constitution tra
EFragmenta _overh
tion.py ead
2026-05-17 19: jlpoole + Code src/ble_re BLEReass __init FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler __ ed after live bilateral Constitution tra
EFragmenta
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEReass _reass FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler emble ed after live bilateral Constitution tra
EFragmenta
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEReass cleanu FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler p_stal ed after live bilateral Constitution tra
EFragmenta e_buff
tion.py ers
2026-05-17 19: jlpoole + Code src/ble_re BLEReass get_st FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler atisti ed after live bilateral Constitution tra
EFragmenta cs
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEReass receiv FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler e_frag ed after live bilateral Constitution tra
EFragmenta ment
tion.py
2026-05-17 19: jlpoole + Code src/ble_re BLEReass reset_ FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL embler statis ed after live bilateral Constitution tra
EFragmenta tics
tion.py
2026-05-17 19: jlpoole + Code src/ble_re HDLCFram defram FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL er e_pack ed after live bilateral Constitution tra
EFragmenta et
tion.py
2026-05-17 19: jlpoole + Code src/ble_re HDLCFram frame_ FIELD_ACCEPTED FIELD_ACCEPTED 2026-05-17: C++ fragmentation/reassembly/HDLC backend accept
27:31 x + ChatGPT ticulum/BL er packet ed after live bilateral Constitution tra
EFragmenta
tion.py
2026-05-16 22: codex src/ble_re BLEFra REVIEWED Imported from Codex Markdown review. Rationale: Pure BLE pac
50:00 ticulum/BL gmente ket fragmentation format; RNS only loggi
EFragmenta r
tion.py
2026-05-16 22: codex src/ble_re BLEFragm __init REVIEWED Imported from Codex Markdown review. Rationale: MTU/header s
50:00 ticulum/BL enter __ izing logic.
EFragmenta
tion.py
2026-05-16 22: codex src/ble_re BLEFragm fragme REVIEWED Imported from Codex Markdown review. Rationale: Core packet-
50:00 ticulum/BL enter nt_pac to-fragments encoding.
EFragmenta ket
tion.py
2026-05-16 22: codex src/ble_re BLEFragm get_fr REVIEWED Imported from Codex Markdown review. Rationale: Pure sizing/
50:00 ticulum/BL enter agment overhead calculation.
EFragmenta _overh
tion.py ead

View file

@ -0,0 +1,101 @@
zerodev1 & 2 compile and tests succeeded, example form zerodev2:
```
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ python3 -m pytest migration/tests/test_identity_helpers_cpp_equivalence.py -q -rs
===================================== test session starts =====================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 21 items
migration/tests/test_identity_helpers_cpp_equivalence.py ..s.................. [100%]
=================================== short test summary info ===================================
SKIPPED [1] migration/tests/test_identity_helpers_cpp_equivalence.py:64: BLEInterface importable; source fallback not used
================================ 20 passed, 1 skipped in 2.60s ================================
jlpoole@zerodev2:/usr/local/src/ble-reticulum $ python3 -m pytest migration/tests/test_fragmentation_cpp_equivalence.py migration/tests/test_fragmentation_backend_shim.py -q
===================================== test session starts =====================================
platform linux -- Python 3.13.5, pytest-8.3.5, pluggy-1.5.0
rootdir: /usr/local/src/ble-reticulum
configfile: pytest.ini
plugins: typeguard-4.4.2, asyncio-0.25.1
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function
collected 36 items
migration/tests/test_fragmentation_cpp_equivalence.py ............................ [ 77%]
migration/tests/test_fragmentation_backend_shim.py ........ [100%]
===================================== 36 passed in 5.07s ======================================
jlpoole@zerodev2:/usr/local/src/ble-reticulum $
```
## Field test results
```bash
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum/scripts $ ./analyze_reticulum_file_transfer_20260516_1130.pl ../tmp/run16/20260517_1316_zerodev1_BilateralConstitution_CPP.txt ../tmp/run16/20260517_1316_zerodev2_BilateralConstitution_CPP.txt
Reticulum BLE file transfer analysis
Generated: 2026-05-17 13:18:17 PDT
Input files:
../tmp/run16/20260517_1316_zerodev1_BilateralConstitution_CPP.txt
../tmp/run16/20260517_1316_zerodev2_BilateralConstitution_CPP.txt
Log provenance summary:
20260517_1316_zerodev1_BilateralConstitution_CPP.txt receiver=zerodev1 date='Sun May 17 13:14:42 PDT 2026' command_lines=21 post_marker_lines=591
20260517_1316_zerodev2_BilateralConstitution_CPP.txt receiver=zerodev2 date='Sun May 17 01:14:44 PM PDT 2026' command_lines=20 post_marker_lines=587
Chrony clock notes from logs:
20260517_1316_zerodev1_BilateralConstitution_CPP.txt
System time : 0.000601033 seconds slow of NTP time
System time : 0.000489284 seconds slow of NTP time
20260517_1316_zerodev2_BilateralConstitution_CPP.txt
System time : 0.000179263 seconds slow of NTP time
System time : 0.000172438 seconds slow of NTP time
Declared outbound sends observed in logs:
sender=zerodev1 file=US_Constitution.txt chunks= 140 bytes= 44225 chunk_data_bytes=316
sender=zerodev2 file=US_Constitution.txt chunks= 148 bytes= 44225 chunk_data_bytes=n/a
Direction: zerodev1->zerodev2
file : US_Constitution.txt
chunks received : 140 of 140
completeness : 100.00%
missing chunks : none
duplicate chunks : none
payload bytes RX : 44225
first chunk RX : 13:15:09.853
last chunk RX : 13:15:46.269
receiver span : 36.416 s
sender span : 14.301 s
payload rate RX span : 1214.4 B/s 9715.5 bit/s
payload rate TX span : 3092.5 B/s 24739.9 bit/s
one-way latency min/median/mean/p95/max/stddev: 243.979 / 11512.287 / 11498.435 / 21675.719 / 22359.194 / 6564.508 ms
receiver inter-chunk gap min/median/mean/p95/max/stddev: 149.000 / 247.000 / 261.986 / 340.000 / 391.000 / 41.138 ms
sender inter-chunk gap min/median/mean/p95/max/stddev: 101.950 / 102.959 / 102.883 / 103.934 / 108.573 / 1.017 ms
Direction: zerodev2->zerodev1
file : US_Constitution.txt
chunks received : 148 of 148
completeness : 100.00%
missing chunks : none
duplicate chunks : none
payload bytes RX : 44225
first chunk RX : 13:15:09.804
last chunk RX : 13:15:44.712
receiver span : 34.908 s
sender span : 15.452 s
payload rate RX span : 1266.9 B/s 10135.2 bit/s
payload rate TX span : 2862.1 B/s 22897.1 bit/s
one-way latency min/median/mean/p95/max/stddev: 247.634 / 9976.582 / 9997.460 / 18882.898 / 19703.868 / 5718.277 ms
receiver inter-chunk gap min/median/mean/p95/max/stddev: 146.000 / 243.000 / 237.469 / 292.000 / 341.000 / 28.719 ms
sender inter-chunk gap min/median/mean/p95/max/stddev: 103.746 / 103.952 / 105.114 / 108.940 / 123.369 / 3.165 ms
Hello/handshake RX records:
zerodev2 -> zerodev1 recv=13:15:09.530 latency= 169.698 ms message='hello'
zerodev1 -> zerodev2 recv=13:15:09.537 latency= 118.429 ms message='hello back'
Caution: one-way latency assumes sender and receiver clocks are synchronized.
Your chronyc tracking output helps bound this error, but it is not a substitute for ACK/round-trip timing.
(rnsenv) jlpoole@jp /usr/local/src/ble-reticulum/scripts $
```

View file

@ -0,0 +1,63 @@
# Phase 1 Freeze: C++ BLE Protocol Core
Date: 2026-05-17
Host: jp / zerodev1 / zerodev2
Project: ble-reticulum
## Scope
Phase 1 extracted and validated the protocol-core portions of the BLE Reticulum implementation.
Accepted CORE symbols:
- BLEFragmenter
- BLEFragmenter.__init__
- BLEFragmenter.fragment_packet
- BLEFragmenter.get_fragment_overhead
- BLEReassembler
- BLEReassembler.__init__
- BLEReassembler.receive_fragment
- BLEReassembler._reassemble
- BLEReassembler.cleanup_stale_buffers
- BLEReassembler.get_statistics
- BLEReassembler.reset_statistics
- HDLCFramer
- HDLCFramer.frame_packet
- HDLCFramer.deframe_packet
- BLEInterface._get_fragmenter_key
- BLEInterface._compute_identity_hash
## Evidence
- Fragmentation/reassembly/HDLC C++ equivalence tests passed.
- Backend shim tests passed.
- Identity helper C++ equivalence tests passed.
- ARM compile and tests passed on zerodev1 and zerodev2.
- Bilateral US Constitution transfer field test succeeded using the C++ backend.
- Transfer completed 100% in both directions.
- No missing chunks.
- No duplicate chunks.
## Database status
SQLite migration database reports:
- 16 CORE symbols FIELD_ACCEPTED.
- No remaining CORE symbols not accepted.
- No UNKNOWN or NEEDS_REVIEW symbols.
- No candidate next tasks remaining for Phase 1.
## Freeze meaning
This freezes Phase 1 as a completed milestone.
Further changes to these accepted Phase 1 protocol-core functions should be treated as bug fixes or Phase 2 work, not as continuing Phase 1 development.
## Next likely work
Potential Phase 2 investigation:
- Determine whether BLEInterface._handle_identity_handshake can be split into:
- a pure protocol helper suitable for C++/Rust, and
- Python GLUE that performs Reticulum and driver state updates.

View file

@ -0,0 +1,53 @@
-- 20260517 ChatGPT
-- $Header$
--
-- Example:
-- cd /usr/local/src/ble-reticulum/migration
-- sqlite3 ble_migration.sqlite ".read sql/mark_identity_helpers_field_accepted_20260517.sql"
--
-- Purpose:
-- Mark BLEInterface identity helper extraction as field accepted
-- after C++ equivalence tests, ARM tests on Zero devices, and
-- successful bilateral Constitution transfer.
BEGIN;
UPDATE symbols
SET status = 'FIELD_ACCEPTED',
phase = '1_protocol_core',
notes = trim(COALESCE(notes, '') || char(10) ||
'2026-05-17: FIELD_ACCEPTED. Identity helper C++ equivalents passed ARM tests on zerodev1/zerodev2. zerodev2 example: test_identity_helpers_cpp_equivalence.py reported 20 passed, 1 skipped. Fragmentation equivalence plus backend shim regression tests reported 36 passed. Bilateral Constitution transfer using C++ backend completed 100% in both directions with no missing or duplicate chunks.'),
updated_at = CURRENT_TIMESTAMP
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name IN (
'_get_fragmenter_key',
'_compute_identity_hash'
);
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: Identity helper C++ equivalents accepted after ARM equivalence tests and successful bilateral Constitution transfer. zerodev2 identity helper test: 20 passed, 1 skipped. Fragmentation/backend shim regression: 36 passed. Field transfer: 100% complete both directions, no missing chunks, no duplicates.'
FROM symbols
WHERE source_file = 'src/ble_reticulum/BLEInterface.py'
AND class_name = 'BLEInterface'
AND symbol_name IN (
'_get_fragmenter_key',
'_compute_identity_hash'
);
COMMIT;