Skip to content

Wire Idriç Ballotpedia client through ICU - #3

Open
isomorphisms wants to merge 7 commits into
clifrom
ballotpedia-cli
Open

Wire Idriç Ballotpedia client through ICU#3
isomorphisms wants to merge 7 commits into
clifrom
ballotpedia-cli

Conversation

@isomorphisms

@isomorphisms isomorphisms commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Boundary

Completes the page-one Ballotpedia API4 elections client in Idriç. Idriç owns argument validation, request meaning, environment lookup, typed JSON projection, and TSV rendering; ICU remains the only HTTP/TLS implementation.

Re-evaluation of the original holes

  • Environment: Idriç #64 did merge environment_value : String → IO (Maybe String), including unset/empty distinction and invalid-name rejection. A later source-layout rewrite dropped it from the buildable _ tree, so Idriç #67 restores that exact narrow surface. CI pins the corresponding compiler integration commit.
  • Caller headers and captured body: ICU #13's current head accepts checked repeatable -H values and writes the response body to stdout. The CLI invokes ICU with System.run, checks its exit status, and decodes the captured stdout. No second HTTP implementation is present.
  • JSON: Language.JSON parses the body, following the working pattern already exercised by idric-cli Add CourtListener search through ICU #2. Ballotpedia then projects the JSON into typed Candidate values before rendering.

Request/response correction

The opened checkpoint used date= and a flat data.candidates fixture. Available Ballotpedia client implementations instead support:

  • election_date=YYYY-MM-DD&page=1
  • data.districts → races → candidates → person / party_affiliation

The fixture, decoder, and TSV columns now follow that nested shape.

Receipts

  • focused request, header, typed decode, invalid-JSON, wrong-envelope, and TSV-cleaning checks
  • deterministic end-to-end server receipt that verifies the exact request path, x-api-key, and Accept header, then proves ICU body capture, typed decoding, and exact TSV output
  • missing and empty API-key behavior remains distinct
  • existing Amazon and AbeBooks tests still pass

Genuinely remaining boundaries

  • ICU #13 and the Idriç layout restoration (#67) are not yet merged dependencies
  • ICU's executable interface carries header values in the child-process argument vector; a non-argv credential channel is still absent
  • only page 1 is implemented; pagination is not
  • the nested fixture is synthetic, and no paid live API receipt has been captured with an explicitly supplied key

Normal execution uses https://api4.ballotpedia.org/data/elections_by_state. BALLOTPEDIA_API_BASE exists only to make the deterministic receipt possible.

@isomorphisms isomorphisms changed the title Add Idriç Ballotpedia CLI checkpoint Wire Idriç Ballotpedia client through ICU Sep 2, 2026
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