Skip to content

feat(parser): skip malformed JSONL lines; add tests#5

Open
annenpolka wants to merge 2 commits intomainfrom
wip-phantom-2025-09-15
Open

feat(parser): skip malformed JSONL lines; add tests#5
annenpolka wants to merge 2 commits intomainfrom
wip-phantom-2025-09-15

Conversation

@annenpolka
Copy link
Owner

What

  • Skip malformed JSONL lines during parsing
  • Add test to fix desired behavior (TDD: Red→Green)
  • Keep existing behavior for empty files and directory parsing

Why

  • Real-world logs may include partially written or corrupt lines. Parsing should be resilient and continue for valid lines.

How (Implementation)

  • On json.Unmarshal failure for a line, continue instead of returning error.
  • Test: file with valid1\ninvalid\nvalid2 should produce 2 messages without error.

Tests

  • make fmt vet test all pass locally.

Notes

  • Followed repository guidelines (table-driven tests style, co-located tests).

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