Skip to content

PDJB-896: Merge Task and DuplicableTaskWithDependencies - #1665

Draft
AEPR wants to merge 2 commits into
mainfrom
chore/PDJB-896-merge-task-classes
Draft

PDJB-896: Merge Task and DuplicableTaskWithDependencies#1665
AEPR wants to merge 2 commits into
mainfrom
chore/PDJB-896-merge-task-classes

Conversation

@AEPR

@AEPR AEPR commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Ticket number

PDJB-896

Goal of change

Fold DuplicableTaskWithDependencies into Task now that every task in the codebase owns its own state, so the journey framework exposes a single concrete task base rather than three.

Description of main change(s)

  • Task<TState, TDependencies> becomes the merged base — always route-scoped, self-stated via AbstractJourneyState, with an optional typed dependencies reference to the enclosing state.
  • The zero-dependencies convenience subclass DuplicableTask is renamed to TaskWithoutDependencies (after the merge, "duplicable" no longer distinguishes anything — every task is).
  • Collapses the redundant DSL split: duplicableTask { }task { } and duplicableCheckAnswerTaskcheckAnswerTask (the previously unused bare-Task overloads are deleted).
  • Updates ~45 call sites across journeys/** and 11 task-subclass supertypes; consolidates DuplicableTaskTests + DuplicableTaskWithDependenciesTests into TaskTests with three nested groupings; introduces OccupationTask.inJourney(journey) (called at the mount site) so the legacy task's taskState get() = dependencies binding is safe against eager evaluation by the DSL.
  • Behaviour-preserving refactor. No user-visible change, no migrations, no feature flag.

Anything you'd like to highlight to the reviewer?

OccupationTask.inJourney(journey) is a legacy shim needed because that task's taskState get() = dependencies would otherwise be evaluated by the DSL before withDependencies { } runs. It's called at the four mount sites and will be removed with OccupationTask itself under PDJB-1340.

Checklist

  • Unit tests for new logic (e.g. new service methods) have been added
  • Test suite has been run in full locally and is passing
  • Branch has been rebased onto main and run locally, with everything working as expected (both for your new feature and any related functionality)
  • TODO comments referencing this JIRA ticket have been searched for and removed - if a future PR will address them, mention that here
  • This feature is not behind a feature flag. I've checked that this is appropriate and we're happy with this code becoming live as soon as we release

AEPR added 2 commits July 30, 2026 15:49
Fold DuplicableTaskWithDependencies into Task<TState, TDependencies>: every task now owns its own JourneyState (via AbstractJourneyState), is route-scopable, and can optionally declare typed dependencies on the enclosing state.

Rename the zero-dependencies convenience subclass DuplicableTask to TaskWithoutDependencies to reflect that after the merge every task is 'duplicable'.

Collapse the redundant DSL split: duplicableTask { } becomes task { } and duplicableCheckAnswerTask becomes checkAnswerTask (the previously unused bare-Task overloads are deleted). Update ~45 call sites and 11 task-subclass supertypes accordingly, and consolidate DuplicableTaskTests + DuplicableTaskWithDependenciesTests into TaskTests with nested groupings.
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