Why Àgora has no live results feed on election night

Àgora has no live results feed. There is no counter that moves while the votes are being counted, no push to the browser and no map that fills in province by province. The result is published as a file, once the provisional count is complete, and again when the final count is known. This post describes how that is built, from the code at commit ed8170d0 of the Àgora repo, and what the script refuses to accept.

It is a description of the design and the checks. It does not report what happened on the night or any figure from the count.

What was dropped, and what replaced it

The first plan for the site had a live feed. PLA-V2-LEGISLATURA.md (section 1) lists what was removed: a LiveHub, server-sent events, a key-value store, a poller of the Interior ministry, a cron job every minute, and a replay mode and a manual mode. It also removes the live municipality view, the live projection and the “rewind the night” feature, because all of them depended on the feed. The same table records that nothing of this was deployed yet, so no migration was needed.

Decision 8 of that document sets the consequence: the site is 100% static, served by Cloudflare Workers Assets with no script, no KV and no Durable Object. The document records the decision and the list of parts; it does not give a longer argument for it. What the code does show is what a static site can do on the night: it can serve whatever files were in the last deploy, and nothing else. The poll blackout post describes the other side of that: the same limitation is why the site has to be redeployed to go quiet.

So the result is a file in data/results/, read at build time: 2026-11-29-congreso-provincias.json is the one that turns on the final-result mode (docs/runbook-29n.md). The seat projection from polls, explained in From polls to seats, is a different thing and stays under the blackout rules until 21:00 on the 29th.

One script, two ways in

The file is produced by scripts/results/final.mjs, run as npm run results:final. It needs Node 22.18 or later because it imports src/lib/dhondt.ts directly. There are two inputs, and they cannot be combined: the script exits with a message if both are given.

A separate --senate-csv produces the Senate file. It is optional: without it the Senate section is hidden.

Both routes end in the same validation, so a number typed by hand and a number read from a feed are held to the same rules.

What makes it refuse

The validation runs before anything is written. scripts/results/lib/build.mjs collects every problem into a list, not just the first. For each province, these are errors:

If the list has any error, the script prints each one, says how many there are and exits with status 1. No file is written, for either chamber. The runbook states that this is intended: a file with errors cannot be forced through. A test in scripts/results/final.test.mjs runs the command line on a deliberately broken CSV and checks for exit status 1, the word ERROR in the output and no output folder. Another test checks that the blank template for the 29th fails validation and lists every missing item.

The D’Hondt check is a warning, on purpose

Seats are the one thing the script computes itself, with src/lib/dhondt.ts. It follows article 163 of the electoral law: only candidacies above 3% of valid votes, with blank votes counted as valid, share the seats by the quotients v/1, v/2, v/3 and so on. Ties go to the party with more votes and then to the lower id, which the file says is deterministic and not what the law does (the law draws lots).

The script then compares that result to the seats declared in the input. If they differ, it prints a warning with both numbers for each party that differs. It does not block. The warning text says to check against the Interior ministry: ties, coalitions and the 3% threshold are the usual reasons. The runbook says to look at each warning and, if the ministry says what the template says, go ahead. The official distribution wins, and the check only exists to catch a typo.

--compute-seats covers the case where seats are not available at all. If a province comes with no seats, the script fills them with D’Hondt and warns that it did. The runbook allows leaving the seats column empty only for a whole province, and only with that option.

Dry run, then deploy

--dry-run runs the whole validation and writes nothing. The runbook has two rehearsals with it: before the night, the 2023 example CSV must report “validated (0 warnings)”; on the night, the filled CSV is checked with --dry-run first and generated only when the errors are gone.

Writing the file is not publishing it. The sequence in the runbook is: generate the JSON, run scripts/data/verify-results.mjs for coherence with known figures, build, look at the preview (the hemicycle must add up to 350 and the totals must match the Interior’s), run the checks and the tests, deploy, and then scripts/ops/verify-site.mjs --expect open against production. The national total is the sum of the provinces, not a separate input.

One rule ties this to the blackout: the runbook forbids any build or deploy of the result before 21:00 on 29 November, because it would either put the poll silence back or lift it too early. A rollback to a version from before 24 November 00:00 is also forbidden until after that hour, since it would bring the polls back.

What this does not do