parseSessionEntryLinesSync function
Parses one batch right here — the inline executor's body and the isolate worker's entry point share it, so both paths run the exact same parse code (issue #199 AC4 parity).
Implementation
SessionParseResult parseSessionEntryLinesSync(SessionParseBatch batch) {
final records = List<SessionRecord?>.filled(
batch.lines.length,
null,
growable: false,
);
for (var i = 0; i < batch.lines.length; i++) {
try {
// Issue #503 round 3b: the resume boundary walk parses giant
// `custom` ledger payloads header-only (data stubbed to null) —
// they count zero context tokens, so the full decode was pure
// cost. Falls back to the full decode on any shape mismatch.
final shallow = batch.shallowGiantCustoms
? parseShallowCustomRecord(batch.lines[i])
: null;
records[i] =
shallow ??
parseSessionEntryLine(
batch.lines[i],
batch.filePath,
batch.firstLineNumber + i,
);
} on Object {
records[i] = null; // torn/foreign line: data, not an error
}
}
return SessionParseResult(records);
}