Skip to content

Make ARRIVAL_TIME validation consistent and remove invalid sentinel default #145

@Agarwalchetan

Description

@Agarwalchetan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions