feat: seal available compliant - #196
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟡 Changes recommended
Data-failure states are missing, and several date, pagination, localization, and accessibility paths can render inaccurate or inaccessible results.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds detailed Available and Compliant Seal of Reliability visualizations to feed pages.
Changes:
- Adds availability heatmaps, uptime metrics, compliance summaries, and report links.
- Adds grace-period and probation progress displays.
- Extends data loading, localization, skeletons, and tests.
Applied Vercel React/Next.js performance guidance.
File summaries
| File | Description |
|---|---|
src/app/utils/date.ts |
Adds month formatting. |
src/app/screens/Feed/lib/compliance-report.ts |
Builds compliance summaries. |
src/app/screens/Feed/lib/compliance-report.spec.ts |
Tests compliance summaries. |
src/app/screens/Feed/lib/availability-history.ts |
Builds availability calendars and summaries. |
src/app/screens/Feed/lib/availability-history.spec.ts |
Tests availability logic. |
src/app/screens/Feed/components/FeedReliabilityView.tsx |
Adds Available and Compliant cards. |
src/app/screens/Feed/components/CriterionSection.tsx |
Supports custom bodies and deadline indicators. |
src/app/screens/Feed/components/CriterionSection.spec.tsx |
Tests new criterion behavior. |
src/app/screens/Feed/components/CriterionProbationProgress.tsx |
Displays probation progress. |
src/app/screens/Feed/components/CriterionGraceCountdown.tsx |
Displays grace-period warnings. |
src/app/screens/Feed/components/ComplianceCriterionBody.tsx |
Renders compliance details. |
src/app/screens/Feed/components/AvailabilityUptimeChip.tsx |
Displays uptime percentage. |
src/app/screens/Feed/components/AvailabilityHeatmap.tsx |
Renders daily availability history. |
src/app/screens/Feed/components/AvailabilityCriterionBody.tsx |
Composes availability details. |
src/app/constants/sealCriteria.ts |
Adds criterion probation-window logic. |
src/app/constants/sealCriteria.spec.ts |
Tests probation aggregation. |
src/app/[locale]/feeds/[feedDataType]/[feedId]/static/seal-of-reliability/page.tsx |
Supplies guest dataset reports. |
src/app/[locale]/feeds/[feedDataType]/[feedId]/lib/seal-analysis-data.ts |
Fetches paginated availability history. |
src/app/[locale]/feeds/[feedDataType]/[feedId]/lib/seal-analysis-data.spec.ts |
Tests history fetching. |
src/app/[locale]/feeds/[feedDataType]/[feedId]/components/SealReliabilitySkeleton.tsx |
Expands the loading skeleton. |
src/app/[locale]/feeds/[feedDataType]/[feedId]/authed/seal-of-reliability/page.tsx |
Supplies authenticated dataset reports. |
messages/fr.json |
Adds French criterion copy. |
messages/en.json |
Adds English criterion copy. |
Review details
Suppressed comments (2)
src/app/screens/Feed/components/FeedReliabilityView.tsx:228
- This conflates a dataset-endpoint failure with a legitimate latest dataset that has no validation report:
fetchDatasetscatches failures and returns[], which the guest wrapper can cache for 14 days, so both becomeundefinedhere and render “No validation report available.” Issue #187 requires a distinct data-failed state. Carry a dataset fetch-error signal into this page and avoid caching that failure as valid data.
report={latestDataset?.validation_report}
src/app/[locale]/feeds/[feedDataType]/[feedId]/lib/seal-analysis-data.ts:75
- This month subtraction also overflows at month ends: on August 31, requesting February 31 normalizes the API
fromvalue to March 3, so valid February checks are never fetched. Share a UTC-safe, end-of-month-clamping calculation withbuildAvailabilityCalendarso the fetched and rendered windows both cover the intended six months.
Date.UTC(
now.getUTCFullYear(),
now.getUTCMonth() - AVAILABILITY_HISTORY_MONTHS,
now.getUTCDate(),
),
- Files reviewed: 23/23 changed files
- Comments generated: 9
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * with room to spare. The cap keeps a feed checked more than once a day from | ||
| * turning one render into an unbounded page walk. | ||
| */ | ||
| const AVAILABILITY_MAX_PAGES = 2; |
|
*Lighthouse ran on https://mobilitydatabase-cdqticlka-mobility-data.vercel.app/ * (Desktop)
*Lighthouse ran on https://mobilitydatabase-cdqticlka-mobility-data.vercel.app/feeds * (Desktop)
*Lighthouse ran on https://mobilitydatabase-cdqticlka-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-cdqticlka-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-cdqticlka-mobility-data.vercel.app/feeds/gbfs/gbfs-flamingo_porirua * (Desktop)
|
emmambd
left a comment
There was a problem hiding this comment.
Great work! Some design/content feedback:
- Available component: I think 3 different chips in the right hand corner might be too noisy. Could we move the "x days left" information to the On probation bar and grace period text sections?
- For when the validation report fails, revise text to "The latest validation report has 22 errors. Resolve these validation errors to pass this criterion."
We should include a link to the validation report HTML report so the user can troubleshoot further.
As a note, @abigailmbd the path for testing is /feeds/gtfs/{path-in-github-issue}/seal-of-reliability
|
Ah great! LGTM! |
There was a problem hiding this comment.
🟡 Changes recommended
Month-end calculations, Compliant failure handling, and feature/session gating contain correctness regressions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
src/app/screens/Feed/lib/availability-history.ts:93
- This direct month arithmetic has the same month-end rollover problem: for an Aug 31 end date and six months, the grid starts Mar 4, omitting Mar 1–3. Clamp the subtraction to the target month's last day (for example via the corrected
subMonthsUtc) and then add one UTC day.
src/app/[locale]/feeds/[feedDataType]/[feedId]/lib/seal-analysis-data.ts:239 - Removing the Remote Config check means the global rollout/kill switch no longer gates the dedicated route: a direct
/seal-of-reliabilityrequest still fetches all three endpoints and renders the analysis while the flag is off; the new client checks only hide links elsewhere. Restore a server-side effective-config check in these loaders/routes, including the authenticated admin-bypass behavior.
function isSealAnalysisApplicable(feedDataType: string): boolean {
// The three endpoints exist only under /v1/gtfs_feeds.
return feedDataType === 'gtfs';
- Files reviewed: 37/37 changed files
- Comments generated: 6
- Review effort level: Balanced
| <ComplianceCriterionBody | ||
| criterion={compliantCriterion} | ||
| report={latestDataset?.validation_report} | ||
| now={now} |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Summary:
closes #187
Includes the seal of reliability criteria: available and compliant
Also fixes a bug regarding the session cookie
To reduce complexity, removed the feature flag for making the API call in the server side
Expected behavior:
It should display the correct visualizations for the criteria available and compliant based on their reliability status
Testing tips:
Using the following feed ids assure that the correct UI elements and expected state are displayed
Please make sure these boxes are checked before submitting your pull request - thanks!
yarn testto make sure you didn't break anything