refactor(service): type safe pattern & journey - #76
Open
jumpy-cat wants to merge 3 commits into
Open
Conversation
jumpy-cat
marked this pull request as ready for review
August 16, 2026 02:29
Replace the any returned by processJourneys with an actual type that models the two variant nature of the processed legs. Did a similar thing with the journey leg type in `McRaptorAlgorithm.ts`. Both changes should have no semantic difference but behavior and performance should ideally both be checked.
jumpy-cat
force-pushed
the
pattern-schema-and-sum-type-journey
branch
from
August 17, 2026 02:06
a7dbe43 to
99f4c8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Added zod validation of
getpatternsbustime responses, allowing it to be processed in a fully typed way instead of asany. Added discriminated union type for journeys and refactored journey creation code accordingly. The final type is a setset of the flat object with many optional fields it was originally.Type of Change
feat)fix)Related Issues
none
Changes Made
JourneyLegin McRaptor -> turned into discriminated unionFormattedLegtype (also discriminated union)anywhere it was possiblefetchPatternsto use zod validationTesting Done
Flutter: none
Screenshots / Demo (if UI or notification change)
Checklist
[type](scope): short descriptionmainand is our current working update branch (e.g.maizebus2.1)print()/debugPrint()/console.log()left in production code