Skip to content

refactor(scraper): Phase 2.4 — replace await-then-Match with functional operators#730

Merged
astar-development-jb merged 2 commits into
mainfrom
feature/725-await-then-match-functional-operators
Jul 11, 2026
Merged

refactor(scraper): Phase 2.4 — replace await-then-Match with functional operators#730
astar-development-jb merged 2 commits into
mainfrom
feature/725-await-then-match-functional-operators

Conversation

@jbarden

@jbarden jbarden commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes Phase 2 (Functional Paradigm Compliance) of docs/astar-dev-wallpaper-scraper/code-review-2026-07-10.v2.md by replacing the last await-then-Match patterns in the scraper workflows with functional operators.

  • Adds OrElseAsync fallback operator to AStar.Dev.FunctionalParadigm (Task<Result<T,E>>.OrElseAsync(Func<TError, Task<Result<T,E>>> fallback)) — TDD: failing tests committed first, 4 new tests in GivenOrElseAsync.
  • TopWallpapersWorkflow.LoadStartingPageAsyncOrElseAsync chain falling back to first page.
  • SubscriptionsWorkflow.LoadStartingPageAsync — same OrElseAsync retry chain.
  • SearchWorkflow.ProcessSearchCategoriesAsync — loop early-exit Match replaced with BindAsync accumulator; first failure short-circuits further category processing, behaviour unchanged.

Phase 2 items 5–7 were delivered in #726, #727 and #728; this PR delivers item 8, completing the phase.

Type of change

  • Refactor
  • Feature (new OrElseAsync operator in AStar.Dev.FunctionalParadigm)

Related issues / links

Closes #725. Relates to #729 (tracking issue for the new package operator).

How was this tested?

  • Unit tests added/updated

GivenOrElseAsync: success skips fallback, failure invokes fallback with original error, fallback failure propagates.

Impacted areas

  • packages/core/functional/AStar.Dev.FunctionalParadigm
  • apps/desktop/Scraper/AStar.Dev.Wallpaper.Scraper (Workflows)

TDD Checklist (required)

  • Builds locally (dotnet clean && dotnet build --no-restore — 0 errors, 0 code warnings; only pre-existing NU1903 NuGet advisories in spikes/)
  • Tests pass (dotnet test --no-build — FunctionalParadigm 135/135; scraper 419 pass / 16 fail and OneDrive 2135 pass / 21 fail are identical on main — zero new failures)
  • No new analyzer warnings
  • Public API changes reviewed (OrElseAsync added; no existing signatures changed)
  • Documentation updated (if applicable)

How to run tests locally

# Restore and run tests
dotnet restore AStar.Dev.slnx
dotnet test --verbosity normal

Notes for reviewers

  • SearchWorkflow accumulator: on failure BindAsync skips the binder, so remaining categories are not processed and the first error is returned — same semantics as the previous early return.
  • Ensure CI passed for all OS runners where configured.

🤖 Generated with Claude Code

jbarden and others added 2 commits July 11, 2026 21:02
…perator

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…c operators

Adds OrElseAsync fallback operator to AStar.Dev.FunctionalParadigm and uses it
to remove the last await-then-Match patterns from TopWallpapersWorkflow,
SubscriptionsWorkflow and SearchWorkflow.

Closes #725. Relates to #729.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jbarden jbarden requested a review from a team July 11, 2026 20:12
@astar-development-jb astar-development-jb enabled auto-merge (squash) July 11, 2026 20:13
@github-actions

Copy link
Copy Markdown

Test results

980 tests  +4   963 ✅ +4   29s ⏱️ -11s
 11 suites ±0     1 💤 ±0 
 11 files   ±0    16 ❌ ±0 

For more details on these failures, see this check.

Results for commit 7bd91dd. ± Comparison against base commit bc25716.

@astar-development-jb astar-development-jb merged commit c326573 into main Jul 11, 2026
5 of 7 checks passed
@astar-development-jb astar-development-jb deleted the feature/725-await-then-match-functional-operators branch July 11, 2026 20:16
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.

refactor(scraper): Phase 2.4 — replace await-then-Match with functional operators

2 participants