Feat/tos grace dialog - #1099
Conversation
… same login session
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📝 SummarySummary by CodeRabbit
WalkthroughAdds a grace-period Terms of Service prompt. The root loader detects pending updates, the dialog submits accept or dismiss actions, session state records dismissals, and localized copy and seed data support the flow. ChangesTerms grace-period consent
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant TosGraceDialog
participant TosGraceAction
participant SessionService
User->>TosGraceDialog: choose accept or dismiss
TosGraceDialog->>TosGraceAction: submit intent and Terms version
TosGraceAction->>SessionService: save acceptance or dismissal
SessionService-->>TosGraceAction: return result or Set-Cookie
TosGraceAction-->>TosGraceDialog: return success or error
Merge Risk: 🔵 Low · up to The dialog can display a grace-period deadline one calendar day earlier for some users, creating confusion about when acceptance is required. The impact is limited to deadline presentation and should be fixed or explicitly accepted. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 5 files. (2 skipped: 2 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: ed2f5467-7506-4a1f-a503-1edbcba08c1c
📒 Files selected for processing (7)
app/components/tos-grace-dialog.tsxapp/root.tsxapp/routes/resources.tos-grace.tsapp/services/session-service.server.tspublic/locales/de/tos.jsonpublic/locales/en/tos.jsonscripts/db/seed-tos.ts
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
| dismissedGraceTosVersionId !== tosRequirement.tos.id | ||
| ? { | ||
| id: tosRequirement.tos.id, | ||
| acceptBy: tosRequirement.acceptBy?.toISOString() ?? '', |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the configured deadline representation.
rg -n -C 4 'acceptBy|2027-01-01|2026-09' \
scripts/db/seed-tos.ts app/db/models/tos.server.ts
# A midnight-UTC deadline renders as the prior local calendar date in US timezones.
TZ=America/New_York node - <<'NODE'
console.log(
new Date('2027-01-01T00:00:00.000Z').toLocaleDateString('en-US', {
dateStyle: 'long',
}),
)
NODERepository: openSenseMap/frontend
Length of output: 2928
🤖 get_repo_knowledge executed:
get_repo_knowledge openSenseMap/frontend /tmp/coderabbit-repo-knowledge/opensensemap-frontend-df8e5696/architecture
Length of output: 12483
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- app/root.tsx ---'
sed -n '70,120p' app/root.tsx
printf '%s\n' '--- app/components/tos-grace-dialog.tsx ---'
sed -n '1,90p' app/components/tos-grace-dialog.tsx
printf '%s\n' '--- ToS model and schema references ---'
rg -n -C 5 'acceptBy|mustBlock|inGrace|effectiveFrom|tosVersion' app/db app routes scripts/db --glob '*.ts' --glob '*.tsx' | head -n 260Repository: openSenseMap/frontend
Length of output: 18077
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- deadline wording and seed entrypoint ---'
rg -n -C 5 'grace_description|acceptBy|seedTos|accept by|deadline|January|Januar' \
app scripts package.json README.md --glob '*.ts' --glob '*.tsx' --glob '*.json' --glob '*.md' \
| head -n 260
printf '%s\n' '--- enforcement branches ---'
sed -n '1,90p' app/routes/resources.tos-grace.ts
sed -n '1,85p' app/db/models/tos.server.tsRepository: openSenseMap/frontend
Length of output: 11411
Format the deadline in the enforcement timezone.
acceptBy is a timezone-aware instant. Enforcement compares it with now, while app/components/tos-grace-dialog.tsx formats it in the browser timezone. The default 2027-01-01T00:00:00.000Z deadline can therefore display as December 31, 2026 for users west of UTC. Format the instant in UTC, or return a date-only value when acceptBy represents a calendar date.
📍 Affects 2 files
app/root.tsx#L103-L103(this comment)app/components/tos-grace-dialog.tsx#L46-L48
Type of Change
Implementation
Add dismissible Terms of Service dialog for logged-in users during the grace period. Users can review and accept the current terms immediately or postpone acceptance until their next login, while the existing mandatory flow remains active after the deadline. Dismissal is stored per ToS version in the authenticated session, and acceptance is handled through a server-side resource route. Thenow uses version 2026-09, effective from September 10, 2026, with an acceptance deadline of January 01 2027 (these parameters can be passed to the script as input arguments, so they can be adjusted).
Checklist
devbranchAdditional Information