Skip to content

Make polls public and add methodology, privacy policy, and latest poll hero - #79

Merged
xrendan merged 4 commits into
mainfrom
codex/poll-methodology-privacy
Sep 8, 2026
Merged

Make polls public and add methodology, privacy policy, and latest poll hero#79
xrendan merged 4 commits into
mainfrom
codex/poll-methodology-privacy

Conversation

@xrendan

@xrendanxrendan commented Sep 8, 2026

Copy link
Copy Markdown
Member

The polling section is now accessible without signing in, with a latest-poll hero using the memos page's featured-card design, earlier poll cards, and footer links to /polls/methodology and /polls/privacy-policy.

Removes public-access gates from poll pages, downloads, Markdown, and RSS; exposes polling navigation/feed discovery and enables search indexing. Authenticated admin draft previews remain protected. Old polling login links redirect to their polling destination.

The privacy policy is titled “Build Canada Polling - Privacy Policy” and has no draft notice. The remaining supplied copy includes the [90] retention placeholder and optional prize-award wording (which differs from the methodology's no-prizes statement).

Validation: TypeScript, targeted ESLint, 14 poll tests, 5 feed tests, and diff checks pass. Repository token lint reports a pre-existing inline CSS-variable violation in src/app/bills/components/ui/select.tsx; this PR does not change that file. Browser-checked both information pages, the empty state against the live API, and the latest-first hero/earlier-poll layout using local sample data. Anonymous HTTP checks returned 200 for the index, information pages, and poll RSS. The live API currently returns no published polls.

@greptile-apps

greptile-appsBot commented Sep 8, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes published polling content publicly accessible and adds polling discovery, information pages, feeds, navigation, and indexing support. The attempted descriptive-copy mapping remains incompatible with the upstream list contract.

  • Adds a latest-poll hero, earlier-poll cards, methodology, and privacy-policy pages.
  • Removes public poll access gates while retaining administrator draft-preview token handling.
  • Advertises polling through navigation, RSS discovery, robots rules, and the sitemap.
  • Isolates poll API failures so they no longer break sitemap generation.

Confidence Score: 4/5

The PR is not yet safe to merge because the new poll cards rely on descriptive data that the upstream list API never supplies.

The current York Factory list serializer omits subtitle and all other descriptive fields, while the changed mapper and both card variants continue to depend on subtitle, leaving the intended hero and card descriptions empty for every normal poll-list response.

Files Needing Attention: src/lib/api/polls.ts and src/app/polls/page.tsx

Important Files Changed

FilenameOverview
src/lib/api/polls.tsAdds image and subtitle normalization, but subtitle is not present in the upstream list contract and therefore always normalizes to null.
src/app/polls/page.tsxAdds the latest-poll hero and earlier-card layout, both of which depend on the unavailable subtitle value for descriptive copy.
src/app/sitemap.tsAdds static and dynamic poll URLs while safely reducing poll-fetch failures to an empty poll group.
src/proxy.tsEnables poll Markdown routing while excluding the two static polling information pages from content-detail rewrites.
src/app/api/polls/[slug]/downloads/[asset]/route.tsMakes approved published poll assets public while preserving asset allowlisting, restricted query forwarding, and private no-store responses.
src/app/feeds/[feed]/route.tsMakes poll RSS public and includes polls in the combined feed without forwarding requester credentials.

Fix all with GreploopFix All in CodexFix All in Claude Code

Prompt To Fix All With AI
### Issue 1
src/lib/api/polls.ts:17
**Subtitle mapping remains empty**
When `fetchPolls()` processes a normal list response, it reads `poll.subtitle`, but the [York Factory poll serializer](https://github.com/buildcanada/york_factory/blob/HEAD/app/controllers/api/v1/polls_controller.rb) does not emit that field or another descriptive field for list records. Every subtitle therefore becomes `null`, causing the latest hero and earlier cards to omit their intended descriptive copy.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (4): Last reviewed commit: "Keep sitemap available when polling API ..." | Re-trigger Greptile

Comment threadsrc/app/sitemap.ts Outdated
Comment threadsrc/lib/api/polls.ts
);
return [first, ...rest].flatMap(({ data }) => data).map((poll) => ({
id: String(poll.id), slug: poll.slug, title: poll.title, publishedAt: poll.published_at,
subtitle: poll.subtitle?.trim() || null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2Subtitle field is never supplied

The new cards derive all descriptive copy from poll.subtitle, but the York Factory poll serializer does not emit that field. As a result, the latest hero and earlier cards omit their intended subtitle or key-message content; map a field present in the API contract or add it to the serializer.

Knowledge Base Used:Content data clients and structured schemas

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/api/polls.ts
Line: 17
Comment:
**Subtitle field is never supplied**
The new cards derive all descriptive copy from `poll.subtitle`, but the [York Factory poll serializer](https://github.com/buildcanada/york_factory/blob/HEAD/app/controllers/api/v1/polls_controller.rb) does not emit that field. As a result, the latest hero and earlier cards omit their intended subtitle or key-message content; map a field present in the API contract or add it to the serializer.
**Knowledge Base Used:**[Content data clients and structured schemas](https://app.greptile.com/buildcanada/-/custom-context/knowledge-base/buildcanada/tradingpost/-/docs/content-data-and-schemas.md)---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in CodexFix in Claude Code

Comment threadsrc/lib/api/polls.ts
);
return [first, ...rest].flatMap(({ data }) => data).map((poll) => ({
id: String(poll.id), slug: poll.slug, title: poll.title, publishedAt: poll.published_at,
subtitle: poll.subtitle?.trim() || null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1Subtitle mapping still stays empty

When fetchPolls() processes the normal York Factory poll-list response, it reads a subtitle field that the list serializer does not emit and normalizes it to null, causing both the latest-poll hero and earlier cards to omit their intended descriptive copy.

Knowledge Base Used:Content data clients and structured schemas

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/api/polls.ts
Line: 17
Comment:
**Subtitle mapping still stays empty**
When `fetchPolls()` processes the normal York Factory poll-list response, it reads a `subtitle` field that the list serializer does not emit and normalizes it to `null`, causing both the latest-poll hero and earlier cards to omit their intended descriptive copy.
**Knowledge Base Used:**[Content data clients and structured schemas](https://app.greptile.com/buildcanada/-/custom-context/knowledge-base/buildcanada/tradingpost/-/docs/content-data-and-schemas.md)---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in CodexFix in Claude Code

@xrendan
xrendan merged commit f08c802 into mainSep 8, 2026
2 checks passed
Comment threadsrc/lib/api/polls.ts
);
return [first, ...rest].flatMap(({ data }) => data).map((poll) => ({
id: String(poll.id), slug: poll.slug, title: poll.title, publishedAt: poll.published_at,
subtitle: poll.subtitle?.trim() || null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1Subtitle mapping remains empty

When fetchPolls() processes a normal list response, it reads poll.subtitle, but the York Factory poll serializer does not emit that field or another descriptive field for list records. Every subtitle therefore becomes null, causing the latest hero and earlier cards to omit their intended descriptive copy.

Knowledge Base Used:Content data clients and structured schemas

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/lib/api/polls.ts
Line: 17
Comment:
**Subtitle mapping remains empty**
When `fetchPolls()` processes a normal list response, it reads `poll.subtitle`, but the [York Factory poll serializer](https://github.com/buildcanada/york_factory/blob/HEAD/app/controllers/api/v1/polls_controller.rb) does not emit that field or another descriptive field for list records. Every subtitle therefore becomes `null`, causing the latest hero and earlier cards to omit their intended descriptive copy.
**Knowledge Base Used:**[Content data clients and structured schemas](https://app.greptile.com/buildcanada/-/custom-context/knowledge-base/buildcanada/tradingpost/-/docs/content-data-and-schemas.md)---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in CodexFix in Claude Code

Sign up for freeto 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

@xrendan