Uh oh!
There was an error while loading. Please reload this page.
Make polls public and add methodology, privacy policy, and latest poll hero - #79
Conversation
Greptile SummaryThe 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.
Confidence Score: 4/5The 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
|
| Filename | Overview |
|---|---|
| src/lib/api/polls.ts | Adds image and subtitle normalization, but subtitle is not present in the upstream list contract and therefore always normalizes to null. |
| src/app/polls/page.tsx | Adds the latest-poll hero and earlier-card layout, both of which depend on the unavailable subtitle value for descriptive copy. |
| src/app/sitemap.ts | Adds static and dynamic poll URLs while safely reducing poll-fetch failures to an empty poll group. |
| src/proxy.ts | Enables poll Markdown routing while excluding the two static polling information pages from content-detail rewrites. |
| src/app/api/polls/[slug]/downloads/[asset]/route.ts | Makes approved published poll assets public while preserving asset allowlisting, restricted query forwarding, and private no-store responses. |
| src/app/feeds/[feed]/route.ts | Makes poll RSS public and includes polls in the combined feed without forwarding requester credentials. |
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
Uh oh!
There was an error while loading. Please reload this page.
| ); | ||
| 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, |
There was a problem hiding this comment.
Subtitle 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.| ); | ||
| 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, |
There was a problem hiding this 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
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!
Uh oh!
There was an error while loading. Please reload this page.
| ); | ||
| 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, |
There was a problem hiding this comment.
Subtitle 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.
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/methodologyand/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.