Skip to content

Show only Toronto election coverage - #63

Merged
mikaalnaik merged 2 commits into
mainfrom
mikaal/hide-ottawa
Aug 19, 2026
Merged

Show only Toronto election coverage#63
mikaalnaik merged 2 commits into
mainfrom
mikaal/hide-ottawa

Conversation

@mikaalnaik

Copy link
Copy Markdown
Contributor

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-involved page exists, but none of them should be reachable.

What changed

Registry (src/lib/elections/registry.ts) — added an optional hidden flag to SupportedElection and 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.

/vote index (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)

  • Everything under /{brampton,hamilton,ottawa}/vote/* and their legacy /elections shapes → /vote
  • /elections/brampton/2026*/vote (previously pointed at the Brampton page)
  • /toronto/vote/get-involved and /toronto/elections/get-involved/toronto/vote/2026

All 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)/elections rules 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

Path Result
/ottawa/vote/2026 307 → /vote
/ottawa/vote/2026/pledge/abc 307 → /vote
/brampton/vote/2026 307 → /vote
/hamilton/vote/2026 307 → /vote
/ottawa/elections/2026 307 → /vote
/elections/brampton/2026 307 → /vote
/toronto/vote/get-involved 307 → /toronto/vote/2026
/toronto/elections/get-involved 307 → /toronto/vote/2026
/toronto/vote/2026 200
/toronto/elections/2026 308 → /toronto/vote/2026

/vote renders City of Toronto only. tsc --noEmit clean; npm run lint has 0 errors (4 pre-existing warnings in unrelated files).

Notes

  • Nothing in the codebase linked to /toronto/vote/get-involved, so there were no nav or CTA links to strip.
  • The pledge API (/api/elections/pledge) still accepts hidden slugs like ottawa-2026 in its allowlist. No UI reaches it now — say the word if it should reject them too.
  • The sitemap doesn't enumerate election pages, so nothing to remove there.

🤖 Generated with Claude Code

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-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Greptile Summary

The PR limits published election coverage to Toronto while retaining the hidden cities’ implementation for future reactivation.

  • Marks Brampton, Hamilton, and Ottawa elections as hidden and removes them from the /vote index.
  • Redirects hidden-city election routes and Toronto’s disabled get-involved routes to supported destinations.
  • Adds a registry-backed Toronto nomination-close date used consistently by API and fallback views.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the eligible follow-up scope.

No blocking failure remains.

Important Files Changed

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]
Loading

Reviews (2): Last reviewed commit: "Hardcode Toronto's nomination close date" | Re-trigger Greptile

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 19, 2026
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
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.

@mikaalnaik
mikaalnaik merged commit 17feffd into main Aug 19, 2026
2 checks passed
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