Show only Toronto election coverage - #63
Merged
Merged
Conversation
Brampton, Hamilton and Ottawa have built-out election pages, but Toronto is the only race we're standing behind right now. Rather than delete the work, mark those regions `hidden` in the elections registry: the configs stay so their routes keep type-checking and each one can be turned back on by dropping a single line. Hidden regions are left off the /vote index entirely — not listed without a link — and every URL beneath them redirects to /vote, along with their legacy /elections shapes. Toronto's /vote/get-involved page is switched off the same way, redirecting to the election landing. All of these redirects are temporary (307), so nothing sticks in a browser cache when a region comes back. The generic /:city(toronto|brampton|hamilton|ottawa)/elections rules are narrowed to Toronto and the hidden cities get their own rules ahead of them, so no redirect chains through another. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Greptile SummaryThe PR limits published election coverage to Toronto while retaining the hidden cities’ implementation for future reactivation.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains in the eligible follow-up scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| next.config.ts | Adds temporary redirects that make hidden-city coverage and Toronto’s get-involved page unreachable while preserving Toronto’s active election routes. |
| src/lib/elections/registry.ts | Extends election configuration with visibility and nomination-date override fields, hiding all supported regions except Toronto. |
| src/app/vote/data.ts | Filters hidden registry elections from the public index and centralizes nomination-close label selection. |
| src/lib/elections/election-data.ts | Introduces shared nomination-close formatting with registry overrides taking precedence over API data. |
| src/app/toronto/vote/2026/data.ts | Uses the shared nomination-close helper in Toronto’s fallback election view. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Incoming election URL] --> B{City and route}
B -->|Brampton, Hamilton, or Ottawa| C[307 redirect to /vote]
B -->|Toronto get-involved| D[307 redirect to /toronto/vote/2026]
B -->|Toronto election coverage| E[Serve Toronto election page]
F[York Factory election list] --> G{Registry entry hidden?}
G -->|Yes| H[Exclude from /vote]
G -->|No| I[Render on /vote]
Reviews (2): Last reviewed commit: "Hardcode Toronto's nomination close date" | Re-trigger Greptile
The City Clerk's calendar puts nomination day at August 21, 2026, but York Factory still carries September 18 on toronto-2026, so /vote and every ward page were showing the wrong date. Add an optional `nominationCloseIso` to the elections registry, set for Toronto, and reconcile it against the API in one helper — a registry date wins wherever we render one. The helper looks the election up by exact slug rather than through getElection, so an unrecognised slug gets no date instead of quietly inheriting Toronto's. Toronto's API-unreachable fallback now carries the date too; it had nothing to fall back on before and dropped the date from the copy. Drop the override once upstream agrees. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
greptile-apps
Bot
dismissed
their stale review
August 19, 2026 17:28
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Toronto is the only election coverage we're standing behind right now. Brampton, Hamilton and Ottawa have built-out pages, and Toronto's
/vote/get-involvedpage exists, but none of them should be reachable.What changed
Registry (
src/lib/elections/registry.ts) — added an optionalhiddenflag toSupportedElectionand set it on Brampton, Hamilton and Ottawa. The configs stay so those route folders keep type-checking; turning a region back on is one line./voteindex (src/app/vote/data.ts) — hidden elections are dropped from the list entirely, rather than listed without a link the way genuinely uncovered elections are.Redirects (
next.config.ts)/{brampton,hamilton,ottawa}/vote/*and their legacy/electionsshapes →/vote/elections/brampton/2026*→/vote(previously pointed at the Brampton page)/toronto/vote/get-involvedand/toronto/elections/get-involved→/toronto/vote/2026All of the new redirects are temporary (307) so nothing sticks in a browser cache when a region comes back. The generic
/:city(toronto|brampton|hamilton|ottawa)/electionsrules are narrowed to Toronto, and the hidden cities get their own rules ahead of them, so no redirect chains through another.Verified against the dev server
/ottawa/vote/2026/vote/ottawa/vote/2026/pledge/abc/vote/brampton/vote/2026/vote/hamilton/vote/2026/vote/ottawa/elections/2026/vote/elections/brampton/2026/vote/toronto/vote/get-involved/toronto/vote/2026/toronto/elections/get-involved/toronto/vote/2026/toronto/vote/2026/toronto/elections/2026/toronto/vote/2026/voterenders City of Toronto only.tsc --noEmitclean;npm run linthas 0 errors (4 pre-existing warnings in unrelated files).Notes
/toronto/vote/get-involved, so there were no nav or CTA links to strip./api/elections/pledge) still accepts hidden slugs likeottawa-2026in its allowlist. No UI reaches it now — say the word if it should reject them too.🤖 Generated with Claude Code