ARRIVAL_TIME is currently typed as datetime but defaults to the string sentinel '9999-99-99T99:99Z', which is not a valid or parseable datetime value.
This creates multiple inconsistencies:
- A field typed as
datetime uses an invalid string as its default.
- Validation logic depends on comparing against this sentinel string.
- The datetime validator emits an incorrect error message that references only
DEPARTURE_TIME, even when validating ARRIVAL_TIME.
This results in fragile logic and misleading validation errors.
Why This Matters
- Violates type consistency (
datetime field backed by a string sentinel).
- Introduces unnecessary string comparisons in validation logic.
- Makes error messages inaccurate and confusing.
- Complicates configuration handling and future maintenance.
Proposed Change
-
Change ARRIVAL_TIME to Optional[datetime] = None.
-
Update the datetime validator to:
- Accept
None for ARRIVAL_TIME.
- Keep
DEPARTURE_TIME required.
- Emit correct error messages for both fields.
-
Replace sentinel string comparisons in speed-determination logic with None checks.
-
(Optional for backward compatibility) Accept the old sentinel string as an alias for “unset” and convert it internally to None.
Acceptance Criteria
- Configuration validation succeeds when
ARRIVAL_TIME is omitted.
- Validation fails if both
ARRIVAL_TIME and BOAT_SPEED are specified.
- Validation fails if neither
ARRIVAL_TIME nor BOAT_SPEED is specified.
- Error messages correctly reference the field being validated.
This keeps the schema consistent, simplifies validation logic, and improves clarity without changing intended behavior.
ARRIVAL_TIMEis currently typed asdatetimebut defaults to the string sentinel'9999-99-99T99:99Z', which is not a valid or parseable datetime value.This creates multiple inconsistencies:
datetimeuses an invalid string as its default.DEPARTURE_TIME, even when validatingARRIVAL_TIME.This results in fragile logic and misleading validation errors.
Why This Matters
datetimefield backed by a string sentinel).Proposed Change
Change
ARRIVAL_TIMEtoOptional[datetime] = None.Update the datetime validator to:
NoneforARRIVAL_TIME.DEPARTURE_TIMErequired.Replace sentinel string comparisons in speed-determination logic with
Nonechecks.(Optional for backward compatibility) Accept the old sentinel string as an alias for “unset” and convert it internally to
None.Acceptance Criteria
ARRIVAL_TIMEis omitted.ARRIVAL_TIMEandBOAT_SPEEDare specified.ARRIVAL_TIMEnorBOAT_SPEEDis specified.This keeps the schema consistent, simplifies validation logic, and improves clarity without changing intended behavior.