Skip to content

feat(flutter): load agent catalog from server with offline fallback - #90

Merged
TOMOKI977 merged 19 commits into
mainfrom
fix/flutter-onchain-catalog
Oct 5, 2026
Merged

TOMOKI977 merged 19 commits into
mainfrom
fix/flutter-onchain-catalog

Conversation

@moises-cisneros

Copy link
Copy Markdown
Contributor

Closes #89

Stacked on #88 (which is stacked on #86 and #84); retarget to \main\ as each one merges.

Summary

Wires the Flutter marketplace to the Serverpod \�gent.list()\ endpoint added in #88, keeping \AssetAgentRepository\ as a resilient offline fallback when the server is down or unreachable.

  • \ServerAgentRepository\ maps \AgentSummary\ objects from an injectable source function into Flutter domain \Agent\ models.
  • Summary kebab-case skills are mapped to human-readable names via \skillDisplayName\ (covering 17 known skill IDs with capitalized fallback).
  • Agents without an on-chain wallet are filtered out.
  • Unrated agents (
    ating: 0.0) have their \RatingBadge\ cleanly hidden in both card and detail screens without layout shifts or exceptions.
  • \FallbackAgentRepository\ wraps the primary repository with a 20 s timeout and transparently falls back to the asset-backed catalog on error. A valid empty list from the server is preserved.
  • \main.dart\ is composed with \FallbackAgentRepository(ServerAgentRepository(() => client.agent.list()), AssetAgentRepository()).

Acceptance criteria

  • \ServerAgentRepository\ loads agents from server and maps fields, skills, and addresses.
  • Summaries without a wallet are dropped.
  • Rating badge self-hides when rating <= 0.0.
  • Resilient fallback repository activates on timeout/error, but preserves valid empty results.
  • \main.dart\ wires the resilient repository into \Puls3App.

Verification evidence

\
cd puls3_flutter
flutter test -> 66 passed (baseline 29, +37 new tests)
flutter analyze --fatal-infos -> No issues found!
\\

Verification passed with 0 critical findings and 0 blockers (PASS WITH WARNINGS on non-blocking test composition seams).

Notes for reviewers

  • \AssetAgentRepository\ remains untouched and acts as the offline fallback.
  • Rating badge self-hiding ensures unrated on-chain agents display seamlessly without layout breakages.

moises-cisneros added 18 commits October 4, 2026 15:50
@moises-cisneros moises-cisneros added area: frontend Flutter implementation type: feat New functionality labels Oct 4, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Deploying puls3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 486cb62
Status:⚡️  Build in progress...

View logs

@TOMOKI977 TOMOKI977 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El mapeo, el timeout y el fallback cumplen lo que pide el issue, y el RatingBadge está bien testeado. Un ajuste importante antes de mergear:

FallbackAgentRepository (fallback_agent_repository.dart:19-23) cae al catálogo local ante cualquier error, sin avisar al usuario. En builds release solo queda un debugPrint, que se elimina. El problema es que ese catálogo tiene agentes mock con wallets ficticias, así que el usuario podría intentar contratar un agente que no existe on-chain.

Sugerencias:

  • Marcar los datos de fallback como offline en la UI y deshabilitar la contratación para esos agentes.
  • Capturar solo errores de red o timeout (no catch (e) genérico), para que un error de parseo en fromSummary no quede oculto.
  • Considerar un timeout menor a 20 s, o mostrar el estado de carga con opción de reintentar.

@TOMOKI977 TOMOKI977 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The mapping, timeout and fallback meet #89, and with the catalog contract aligned to #88 (see #99) nothing here blocks the Stellar Elite demo.

Follow-ups worth doing after the demo, from my earlier review:

  • FallbackAgentRepository falls back to the bundled catalog on any error, with only a debugPrint (stripped in release). Those mock agents have fake wallets, so mark the fallback as offline in the UI and disable Hire for them.
  • Catch only network and timeout errors instead of a generic catch (e), so a parsing bug in fromSummary doesn't hide behind the fallback.

Merge note: retarget this to main once #88 merges, so CI runs before merging.

@TOMOKI977
TOMOKI977 changed the base branch from fix/server-agent-catalog-endpoint to main October 5, 2026 21:51
@TOMOKI977
TOMOKI977 merged commit bf581c0 into main Oct 5, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: frontend Flutter implementation type: feat New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(flutter): load agent catalog from server with offline fallback

2 participants