Skip to content

Fix: graceful free-form time + starting-address parsing - #2

Draft
jssturm wants to merge 3 commits into
mainfrom
cursor/graceful-departure-time-parse-72c3
Draft

jssturm wants to merge 3 commits into
mainfrom
cursor/graceful-departure-time-parse-72c3

Conversation

@jssturm

@jssturm jssturm commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

Problem

Entering a departure time like 0800 AM (or filling hours while leaving minutes blank against the 00 placeholder) triggered:

Please enter a valid departure time (e.g. 07:00).

That toast blocked Generate and put the user in a retry loop. Related parsers (calendar, reminders, API schema) were similarly strict. Starting location also required comma-structured addresses for Census geocoding.

Root cause

  1. Frontend: Split HH/MM validation used parseInt on both fields. Empty minutes → NaN → hard error.
  2. Backend: README claimed compact forms (0700, etc.) were normalized, but the normalizer only matched colon/7am/bare-hour patterns.
  3. API: TravelRequest.departure_time had a strict HH:MM AM/PM regex that rejected free-form input before normalization.
  4. Address: Census geocoding required comma-separated parts; run-on addresses fell through without structure.
  5. CI: Test job installed only requirements.txt, so pytest was missing (No module named pytest).

Fix

  • Shared app/engine/timeparse.py used by planner, calendar ICS export, schedule/reminder parsing, and request/itinerary schemas.
  • Shared app/engine/addressparse.py normalizes free-form US starting locations (commas optional) for Census + UI soft-format on submit.
  • Frontend flexible time parser + soft address normalize; no address toast loop.
  • Unit tests for time + address + TravelRequest free-form acceptance.
  • CI Test workflow installs requirements-dev.txt and runs the full suite.

Test plan

  • pytest locally (49 passed on this branch)
  • GitHub Actions Test check green after CI fix
  • Manual: 08 only + AM → 08:00 AM
  • Manual: 0800 / 0800 AM → no toast loop
  • Manual: starting location 9801 International Dr Orlando FL 32819 (no commas) accepted and normalized
Open in Web Open in Cursor 

Empty minutes on the split HH/MM fields produced a NaN validation
error loop (e.g. typing 08 / 0800 with blank MM). Accept compact
forms like 0800 and 0800 AM on both the frontend and backend
normalizer, default missing parts, and cover with unit tests.

Co-authored-by: jssturm <jssturm@users.noreply.github.com>
@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plan-it Ready Ready Preview Jul 31, 2026 5:51pm

Share timeparse across planner, calendar, API schemas, and reminders.
Accept free-form departure times at the request boundary (drop strict
HH:MM AM/PM pattern). Add addressparse so run-on starting locations
like "9801 International Dr Orlando FL 32819" structure for Census
geocoding without blocking the user on commas.

Co-authored-by: jssturm <jssturm@users.noreply.github.com>
@cursor cursor Bot changed the title fix: gracefully parse free-form departure times (no validation loop) Fix: graceful free-form time + starting-address parsing Jul 28, 2026
…flow

The Test job only installed requirements.txt, which does not include
pytest, so CI failed with "No module named pytest" (including on main).
Install requirements-dev.txt and run the full pytest suite.

Co-authored-by: jssturm <jssturm@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — eae073f9 Deployed Jul 31, 2026 by vercel[bot]
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.

2 participants