Skip to content

Conversation

@simoninns
Copy link
Collaborator

Bug:
The SQLite rewrite used seqNo directly for field_id, but appendField was not assigning seqNo when creating new fields during disc mapping. Some fields were appended with the default seqNo=0, which translated to field_id=-1 after the seqNo-1 conversion. Because (capture_id, field_id) is a primary key, the -1 rows collided, causing dropped/overwritten rows, shrinking field_record (missing fields) and triggering out-of-bounds errors in consumers like ld-analyse. JSON output was fine because it didn’t rely on field_id PKs.

Fix:
Ensure every appended field receives a contiguous seqNo (fields.size()+1) before being stored. Applied in both the TBC library (lddecodemetadata.cpp) and the json-converter copy (lddecodemetadata.cpp). This guarantees field_id stays 0..N-1 with no negatives or duplicates, so all fields persist in SQLite and downstream tools no longer see missing/invalid field numbers.

@simoninns simoninns merged commit ee53939 into happycube:main Dec 7, 2025
2 checks passed
@simoninns simoninns deleted the issue970-2025 branch December 7, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant