Skip to content

Release: research into main (PRs #72–#101) - #102

Merged
LEVELING2108 merged 61 commits into
mainfrom
research
Nov 10, 2026
Merged

LEVELING2108 merged 61 commits into
mainfrom
research

Conversation

@LEVELING2108

Copy link
Copy Markdown
Owner

Brings main up to date with research: everything below is tested and already live from research.

  • Places & maps: nearby places, visited places, Google Places data, photos, help points outside Pune, 52 curated places
  • Trip mode, SMS from the phone, SMS error reasons, Google sign-in fixes, safe-area fix
  • Landing page on puneexplorer.dev (Signboard design, phone/tablet layout), waitlist API, app moved to app.puneexplorer.dev with the bridge for old installs
  • New app icon (Gilded night)
  • Ops: automatic deploys, nightly backups with alerts, nightly cleanup job, jobs on the deployed image, CORS 403, branch rules (guard + main-from-research)

Checks on the merged code (identical to research): API 144/144, web 134/134, type-check and lint clean.

Pune Tour Guide becomes Pune Explorer: the travel guide merged with the RoadSoS safety app,
in two themes (Classic and Deccan) and four languages (English, Marathi, Hindi, Gujarati).

App
- Discover: Home, Explore with filters and search, place pages, curated routes
- Plan: day plans, stamps and XP, route optimisation, map with places, route and help layers,
  walking and auto directions, hand-off to Google Maps for voice navigation and reviews
- Safety: SOS with countdown, shake to SOS and a direct 112 call that works offline; SMS alerts
  to emergency contacts with live location; shareable live trip; nearest hospitals and police
  from OpenStreetMap; encrypted medical info
- Accounts: email, mobile OTP and Google sign-in, password reset, onboarding, account deletion,
  Terms and Privacy pages
- Offline packs, installable PWA and an Android app (Capacitor)

Platform
- Monorepo: React + Vite web app, Express + Prisma + PostGIS Tour API, FastAPI safety service
- Redis for shared rate limits, caches, the SMS queue and live-tracking fan-out
- Structured logs, error reporting, accessibility (WCAG 2.1 AA) and load tests
- Production images built by GitHub Actions; one-command local setup; server setup script and
  Docker Compose with automatic HTTPS
Failed texts were logged only as 'Request failed with status code 400'. Twilio's error code is now kept with a short reason (for example 'Twilio 21608: number not verified on the trial account'), with any phone number masked. Wrong, unverified or blocked numbers and bad credentials fail at once instead of retrying three times; network errors, rate limits and Twilio outages still retry.

Tests also force console mode for email, so a real EMAIL_API_KEY in .env never sends mail during tests.
fix(sms): record why a text failed and stop retrying hopeless sends
Browsers hide the One Tap prompt for hours to weeks after a user closes
it once, which left that user with no way to sign in with Google. The
official button is never suppressed.

- Render the GSI button on Log in and Sign up (both themes), in the
  app's language, with the themed button standing in until it loads
- Initialise GSI once instead of on every tap; drop the prompt status
  methods that stop working once FedCM is mandatory
- Explain why when Google sign-in is unavailable (not configured or
  offline)
fix(auth): use Google's sign-in button instead of the One Tap prompt
Every add went to Day 1 because the app never told the API which day,
so Day 2 could not be filled.

- Ask "Add to which day?" in a bottom sheet from Explore "+", Place
  "Add to plan" and route tickets; it starts on the Plan tab last viewed
  or added to, and the toast names the day
- Plan opens on the day you last viewed or added to, so going to
  Explore from an empty Day 2 and back stays on Day 2
- "Move to Day N" on each stop (both themes); PATCH /itinerary/stops/:id
  now takes dayId, appends to that day and re-times the stop
- API and component tests; e2e picks Day 2; docs and FEATURES updated
fix(plan): let people add places and routes to Day 2
Each place now shows what else is worth seeing close by, so people can
hop from one spot to the next without going back to Explore.

- GET /places/:id/nearby: up to 6 places and 6 food spots within 3 km
  (10 km when fewer than 3, for forts and hills), nearest first, never
  the place itself, closed-now last; distance is from that place.
  Rows cached per place for an hour; open/closed and plan flags are
  worked out per request
- "Also nearby" and "Food nearby" rows on the Place screen in both
  themes: distance, rough walk/drive time, open or closed now, and "+"
  to add to a chosen day with the day picker
- "See on map" opens the Map centred on the place (?at=lat,lng)
- API, component and helper tests; docs and FEATURES updated
feat(place): suggest places and food nearby on every place
People could only record a visit by planning a place and ticking it,
and Classic had no list of where they had been at all.

- Profile → Places visited (both themes): every stamp, newest first,
  grouped by month in Pune time, with area, date and XP; a summary of
  stamps collected, XP from visits and categories. Classic gets a row
  under the level card, the Deccan passport a "See all" link
- "Been here?" on every place: a confirm sheet, then
  POST /places/:id/visit collects the stamp and XP once per place and
  ticks it wherever it is in the plan (rate-limited per account).
  Afterwards the place shows "Visited · date" and no longer promises XP
- Places carry visitedAt for the signed-in user; stamps return area and
  XP; "places visited" in the level card now counts every stamp
- Shared bottom Sheet for the day picker and the new confirm sheet
- API, helper and component tests; docs and FEATURES updated
feat(profile): show every place visited, and let people mark a visit
First step of moving everything except SOS to Google Maps Platform.
Each place now shows a real photo, its Google rating and whether it's
open now, plus nearby side quests (viewpoints, trails, landmarks) and
food with photos and ratings. SOS and nearby help stay on OpenStreetMap.

- Places store only their Google place id (migration; linked once with
  `npm run google:link`, Text Search IDs only, no charge)
- /api/v1/google: place info, side quests + food nearby (1.5 km in the
  city, 5 km out of town; our own places and hotels left out), side
  quest pages, and photos redirected to Google's short-lived URLs so
  the key stays on the server
- Side quest page with photos, rating, hours, address, Directions and
  Open in Google Maps; "Been here?" gives +10 XP once (SpotVisit, only
  for spots the app has shown); Places visited counts side quests
- Google's terms: nothing from Google is stored or cached (no-store,
  outside the offline cache), never on our map, credited on every row
  and photo; Privacy and Terms updated, hosting now Google Cloud
- Cost: server key in a header and restricted to Places + Routes;
  daily caps per call kind counted in Redis (console quotas can't be
  lowered on this account); when capped or failing the app falls back
  to its own data
- Shared haversine in lib/geo; API tests use a fake Google client;
  docs, FEATURES and LAUNCH_SETUP (step 17b) updated
feat(google): live photos, ratings and side quests from Google Maps
The setup script was written for Azure's managed database, so on a
single server it left DATABASE_URL as CHANGE_ME and Postgres switched
off.

- server-setup.sh now generates the Postgres password, sets
  DATABASE_URL to the local container and COMPOSE_PROFILES=db
  (DB=managed keeps the old behaviour)
- set_env keeps "&", "|" and "\" literally (the URL has "&")
- The finish message includes linking places to Google
- .env.production.example: GOOGLE_MAPS_SERVER_KEY
- LAUNCH_SETUP Parts 3 and 5 rewritten for Google Cloud (Mumbai
  e2-medium, browser SSH, database on the server)
On a new server "crontab -l" fails (no crontab for the user). Under
set -e and pipefail that ended the script silently before it saved the
nightly help-point import and printed the next steps. Treat an empty
crontab, and grep finding nothing, as normal.
fix(deploy): don't stop the setup script on a server with no crontab yet
…ether

On the live site the Google client ID came out as the ID followed by
the Sentry DSN, contact email and release ("Error 401: invalid_client"
on sign-in), and the map tile URL was missing: build-push-action
mis-split the multi-line build-args list.

- The workflow trims each Variable, refuses values with a line break,
  " or $, and sends all settings as one base64 build arg
- The Dockerfile decodes it into apps/web/.env.production.local, which
  Vite reads for production builds (single build args still work for
  local docker compose builds)
- After the build, a check runs the image and fails the release if the
  Google client ID or contact email is missing or glued to something
fix(release): pass website settings as one line so none get glued tog…
The site runs on one Google Cloud VM with Docker Compose, built by the
Release workflow. render.yaml was never used by any build, and the docs
still described Vercel, Render, Azure, Neon and Upstash. They now describe
the real setup.
chore: remove the unused Render setup and old Vercel/Azure hosting notes
Helmet's default Cross-Origin-Opener-Policy (same-origin) cut the link
between the page and Google's sign-in popup, so after the user allowed
access the popup stayed on a blank page and nothing signed in. Use
same-origin-allow-popups, as Google Identity Services requires.
fix(auth): let the Google sign-in popup return to the page
… time

Help nearby outside the imported area asked public Overpass servers live
and gave up after 8 s; they often need 10-20 s, so travellers saw nothing.

- Nightly import now covers Pune district plus the highways out of it
  (Expressway to Panvel, NH48 to Satara, NH60 to Nashik): about 2,000
  points, answered instantly from our own data.
- The safety service waits up to 20 s per Overpass server, within an
  overall 25 s deadline, so a slow server still answers and nobody waits
  forever.
fix(help): import help for all of Pune district and give live lookups…
The screens came from mockups drawn inside a phone frame with a 44px
status bar, so every screen left 54-68px empty at the top on a real
phone, pushing content under the tab bar. Screens now offset from
--sb / --sab (the phone's real safe areas: 0 in a browser tab, the
status or gesture bar in the installed app).

- Tab, settings, auth, map, navigation, place and SOS screens move up
  44px; the place photo is 44px shorter.
- Tab bar, SOS button, toasts and sheets clear the gesture bar.
- Intro slides end above the dots and buttons, so the text no longer
  runs under them; the picture shrinks first on short phones.
- Deccan login and sign-up panels start lower, so their taller headers
  are no longer cut off.
fix(web): drop the mockup's status-bar gap at the top of every screen
After planning, nothing walked the traveller through the day. The Plan
tab now has Start Day N / Continue Day N, opening a trip screen:

- Next stop (stop N of M, distance, usually-closed note, weak signal),
  Directions (back returns to the trip), Google Maps, I'm here, Skip.
- Arrival: asks "You've arrived?" only for the next stop, with good
  GPS, after 30 s nearby, not when passing fast; 100 m in the city,
  400 m at forts and lakes; once per stop; never ticks by itself.
- Works with no signal: ticks, skips and end are queued on the phone
  and sent in order when back online.
- Live share, honestly: per-contact Sent / Couldn't text / Sending from
  the SMS log, and Send the link yourself (share sheet).
- Open the whole day in Google Maps (next 10 stops on a long day).
- Day summary (places, XP, km, time); a forgotten trip ends itself
  after 14 h or at 4 AM, and the share Start Day turned on ends too.

Server: DayRun (one running per user, partial unique index), doneAt and
xpAwarded on stops, TripShare.smsLogIds, start/run/skip/end and share
delivery endpoints. Also drops the mockup status-bar gap on the Legal,
Delete account, Places visited and side-quest screens.
feat(trip): Start Day N - trip mode for the day's plan
The 300-a-day photo cap ran out on 2026-10-22 (599 requests): one place
page asked for up to 17 photos, because the browser fetched every card in
the side-quest and food rows at once.

- Row cards fetch their photo only once they are on screen
- Photos split into two daily shares: photo (big photo, 150) and thumb
  (row thumbnails up to 480 px, 250), 400 in all; an older config with
  photo only keeps thumbnails inside that one limit
- A "Photo not available right now" panel replaces the mockup's dashed
  PLACE PHOTO box on the place page (both themes) and the side-quest page
- Docs: new caps and their cost
fix(sms): send SOS, trip-share and test texts from the phone itself
- Check the server's host key fingerprint before using the deploy key
- Pin the exact built version in a separate .env.release instead of
  editing .env.production, so a separate deploy user never touches the
  secrets file; the manual command keeps working as a fallback
- Launch guide Part 7: deploy user, deploy-only key, fingerprint,
  firewall, GitHub secrets, rollback by re-running an older Release
ci(deploy): safer automatic deploys to the server
Temples (Omkareshwar, Tulshibaug Ram Mandir, ISKCON NVCC, Jejuri,
Dehu, Alandi), forts (Shivneri, Purandar, Visapur, Tikona), caves
(Karla, Bhaja), heritage (Shinde Chhatri, National War Memorial),
nature (Katraj zoo, Pu La Deshpande Garden, Osho Teerth, Bund Garden,
Taljai, Panshet, Bhushi Dam, Lion Point), Joshi's railway museum and
food (Chitale Bandhu, Kayani Bakery, German Bakery).

Coordinates checked against OpenStreetMap; hours and fees left empty
where not certain (the app shows "Check locally" and Google's live
hours). 52 curated places in all.
feat(places): add 26 more famous places across Pune district
…drill

- deploy/backup-db.sh: pg_dump -Fc, checks the dump reads back with the
  key tables before uploading to a private bucket (02:00 IST); optional
  Healthchecks.io ping so a missing night is noticed
- deploy/restore-test.sh: restores the newest backup into a temporary
  database, compares row counts with live, then drops it
- server-setup.sh fetches both and adds the cron line once BACKUP_BUCKET
  is set; launch guide step 20b: bucket, no-delete service account, VM
  access, drill and a real restore
ops(backups): nightly database backup to Cloud Storage and a restore …
Static landing page for puneexplorer.dev built from the Signboard design kit:
- apps/landing: page, styles, Deccan/Classic switch, waitlist form,
  self-hosted Khand / Anek / DM Serif fonts, real app screenshots,
  SEO head (canonical, Open Graph, JSON-LD), robots.txt, sitemap.xml
- SOS countdown drawn inside the phone frame
- design-reference/landing-signboard: the kit (spec, reference, assets);
  the 18 MB motion walkthrough stays local via .gitignore

Not served yet: the host split (app.puneexplorer.dev) and the waitlist
endpoint come in separate PRs.
feat(landing): add signboard landing page
A local .env holding live Twilio keys sent real, paid texts to real
phones during development. Outside production a real provider now also
needs SMS_DEV_SEND=true; otherwise texts only go to the log. Production
behaviour is unchanged.
fix(sms): keep texts in the log outside production
POST /api/v1/waitlist stores only the email (trimmed, lower-cased,
max 254) in the new WaitlistEntry table (migration 20261108120000).
- Insert or ignore, and always 201, so the form cannot reveal who
  signed up
- 20 sign-ups per hour per IP through the shared Redis limiter
- No read endpoint: `npm run waitlist:export` prints the pending list
  on the server; `--mark-notified <id>` marks only what was exported
- Privacy policy: one launch email, deleted 30 days after it is sent
- Tests: saved lower-cased, duplicate, bad input, rate limit
feat(waitlist): Android waitlist endpoint for the landing page
The upload and dump errors went to /dev/null, so two nights of failed
backups (billing account delinquent) only showed "upload failed".
backup.log now ends the FAILED line with the tool's last error line.
LAUNCH_SETUP.md: Healthchecks.io alert and what the billing error means.
ops(backups): log why a backup failed
New job (scripts/cleanup.ts, compose service `cleanup` in the jobs
profile, cron 22:00 UTC = 03:30 IST via server-setup.sh) deletes:
- login codes and password-reset links a day after expiry or use
- sessions 30 days after expiry or sign-out
- trip shares 30 days after they end (or start, if never ended)
- text delivery records after 90 days
- waitlist emails 30 days after the launch email
SOS events are never touched. Each table is its own step, logs show
counts only, --dry-run only counts, and CLEANUP_PING_URL (Healthchecks)
is pinged on start, success and failure.

Privacy policy states the new periods. The landing page says "refreshed
every night" again: the help import runs nightly (confirmed on the
server). LAUNCH_SETUP.md step 20c.
ops(cleanup): nightly deletion of data past its retention period
Cron jobs used only .env.production, whose bare APP_IMAGE tag is never
re-pulled after the first install, so refresh-help ran an old copy of
the app and the new cleanup script would not exist in it. They now also
read .env.release (written by every deploy), like the deploy itself.
ops(jobs): run nightly jobs on the deployed image
With LANDING_HOST set, the app shows apps/landing on that host and
moves every other page (texted /track links, reset emails, bookmarks)
permanently to the same path on APP_URL. /api and /safety keep working
on both hosts, so installed copies and Android test builds still work.
Unset LANDING_HOST to undo.

Phones that installed the app from the main address get a bridge
service worker: it drops the old app's caches and keeps an offline
page that calls 112 and texts the contacts saved on that phone (checked
in Chromium: old install -> bridge -> offline page with both contacts).
Online, their icon opens the landing, which forwards installed apps to
app./?install=1, where the app offers to install it again.

- Caddy serves DOMAIN and app.DOMAIN from one site snippet
- Landing shipped in the app image; tests for the host routing
- LAUNCH_SETUP step 24: DNS, Google/Maps/MapTiler origins, CORS_ORIGINS,
  the switch, checks in order, undo
feat(landing): landing on the main address, app on app. (host split)
The design kit covers 1440 and 390 only; in between and below:
- Phones: one-row header (logo + Open the app; section links hidden
  under 600 px), the destination sign gets the full width, nearby
  diagram labels rearranged so none overlap down to 320 px, readable
  ring labels
- Tablets (601-900 px): headline next to the phone, the three feature
  phones in one row (page 10,236 -> 8,705 px at 768)
- The scroll rail hides below 1290 px, where it ran over the headline
- Menu, footer and waitlist links are 44 px tall for touch
- QR code now opens app.puneexplorer.dev (the old one opened the
  landing itself) and shows only on screens wider than 900 px

Checked at 320-1280 px: no sideways scroll, no label overlaps; axe
WCAG 2.2 AA clean (only the hero lines mid fade-in, as on the live page).
fix(landing): fit phones and tablets, QR opens the app
A gold Shaniwar Wada gate (Delhi Darwaza: two bastions, studded door,
lit windows) with the bhagwa, on a dark sky with a warm glow. Drawn as
SVG (apps/web/art/icon.svg, plus icon-small.svg for 16-32 px), so every
size is rendered sharp instead of scaled from one picture; the old icon
had text that was unreadable below ~96 px.

npm run icons -w apps/web now builds everything from the SVG:
- web app: any (rounded) and maskable icons, Apple touch icon, SVG tab icon
- landing page: icons and SVG tab icon
- Android: legacy and round launcher icons, adaptive icon as separate
  background and foreground layers, launch screens
feat(icon): new app icon, Gilded night
A request with an Origin not in CORS_ORIGINS became a 500 and a Sentry
alert (seen once during the host split, from our own test). Anyone can
send a foreign Origin, so it is now a 403 ORIGIN_NOT_ALLOWED through the
normal error path: no Sentry event, no alert noise. The rule moved into
corsOrigin() so its production behaviour is tested.
fix(api): refuse other sites' browser calls with 403, not a server error
main and research deploy to the same server, so the last deploy wins.
- Release: new first job `guard` refuses to deploy a branch that lacks
  changes the other branch has (e.g. a fix committed straight to main),
  comparing content so research -> main merge commits pass. Re-runs skip
  it, so rolling back by re-running an older run still works.
- CI: `main-from-research` fails any PR into main whose head isn't
  research (branch names passed through env, not into the script).
- LAUNCH_SETUP Part 7: the branch rules and the GitHub rulesets to set.

Checked the guard on five cases in a scratch clone: research today
(deploys), a stale main (blocked), after a research -> main merge commit
(both deploy), new work on research (deploys), a fix only on main
(research blocked).
ops(branches): enforce research -> main and protect the shared server
@LEVELING2108
LEVELING2108 merged commit 564fc41 into main Nov 10, 2026
11 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