Skip to content

[EPAC-1988]: reduce LobbyistService parser complexity#547

Merged
riddim-developer-bot[bot] merged 2 commits into
mainfrom
symphony/epac-1988-reduce-cyclomatic-complexity-in-lobbyistservice
May 24, 2026
Merged

[EPAC-1988]: reduce LobbyistService parser complexity#547
riddim-developer-bot[bot] merged 2 commits into
mainfrom
symphony/epac-1988-reduce-cyclomatic-complexity-in-lobbyistservice

Conversation

@riddim-developer-bot

Copy link
Copy Markdown
Contributor

Why

LobbyistService.swift had three cyclomatic complexity violations in ZIP parsing, CSV row parsing, and communication mapping. This PR decomposes those branches without changing the public LobbyistService API.

What changed

  • Split ZIP local-header parsing into private helpers for header reads, entry matching, and stored/deflated payload decoding.
  • Reworked the RFC 4180 CSV parser around a small private parser state and private character-processing helpers.
  • Extracted communication matching, subject formatting, and date sorting helpers.
  • Added LobbyistServiceTests covering quoted fields, embedded commas, embedded newlines, escaped quotes, empty fields, CRLF rows, and skip-header behavior.

Trade-offs not taken

  • Did not replace the parser with a third-party library, per issue scope.
  • Kept the test access as a DEBUG-only internal hook while the extracted implementation helpers remain private.

Test plan

  • swiftlint lint --strict --only-rule cyclomatic_complexity ios/epac/Util/LobbyistService.swift — passed, 0 violations.
  • swiftlint --strict ios/epacTests/LobbyistServiceTests.swift — passed, 0 violations.
  • cd ios && make build — passed; Xcode emitted existing Swift macro redundant Sendable warnings.
  • python3 scripts/localization/check_localizations.py --github-warnings — exited 0; reported existing missing onboarding.welcome.title localization warnings.
  • cd ios && make test — built and ran, but failed on existing snapshot baseline mismatches; new LobbyistServiceTests executed, with one CRLF assertion exposing a parser edge case that this PR then fixed.
  • xcodebuild test ... -skip-testing:epacTests/SnapshotTests -skip-testing:epacUITests — new LobbyistServiceTests passed; command still failed on existing unrelated FollowPreferenceAdapterTests.savedMemberNameReflectsPostalCodeStore state leakage.

Reviewer-Boundary: review-only

Resolves EPAC-1988

@riddim-developer-bot riddim-developer-bot Bot added the autonomous Enrolled in prconverged daemon for automated review and merge label May 24, 2026
@riddim-developer-bot riddim-developer-bot Bot added the autonomous Enrolled in prconverged daemon for automated review and merge label May 24, 2026
@riddim-developer-bot riddim-developer-bot Bot enabled auto-merge (squash) May 24, 2026 02:06
@riddim-developer-bot riddim-developer-bot Bot added the agent:working Symphony developer-bot lease (not a CI required check) label May 24, 2026
@riddim-developer-bot riddim-developer-bot Bot removed the agent:working Symphony developer-bot lease (not a CI required check) label May 24, 2026
@riddim-developer-bot riddim-developer-bot Bot merged commit f7ca886 into main May 24, 2026
4 checks passed
@riddim-developer-bot riddim-developer-bot Bot deleted the symphony/epac-1988-reduce-cyclomatic-complexity-in-lobbyistservice branch May 24, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autonomous Enrolled in prconverged daemon for automated review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants