Skip to content

ADFA-5094: local-first topic tree (box-served, Studio fallback) — app side - #406

Merged
luisguzman-adfa merged 4 commits into
mainfrom
feat/ADFA-5094-kolibri-depth
Aug 14, 2026
Merged

luisguzman-adfa merged 4 commits into
mainfrom
feat/ADFA-5094-kolibri-depth

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

App-side half of ADFA-5094's depth work: route the Kolibri topic tree local-first so it
can be browsed offline once a channel's metadata is on the box, falling back to Studio.

What changes

  • New TreeSource seam with two implementations: LocalTreeSource (box, GET
    localhost:8085/k2go-api/kolibri/tree/, tight timeouts) and StudioTreeSource
    (internet), composed by FallbackTreeSource (primary, else secondary).
  • CatalogRepositoryImpl serves fetchTree through that composite (local over Studio).
  • LocalTreeSource reuses StudioCatalogMapper.tree — the box returns the same
    contentnode_tree shape as Studio, so there is one mapper and no branching.
  • ADR-5094-offline-tree-depth.md documents the contract and the local-first decision.

Why
Topic browsing is the last step that still needs connectivity (ADR-4954): the tree is
fetched live from Studio. With the channel's metadata imported on the box, the whole tree
can be served locally, so the picker works offline.

Coordination / safety

  • Independent of the box/dashboard half (PR3, which adds the metadata-only import and the
    /kolibri/tree endpoint). Until PR3 ships, LocalTreeSource always misses and the tree
    comes from Studio exactly as before — nothing user-visible changes, nothing to gate.
  • ADFA-5094 stays open for PR3. Device verification (offline browsing of an imported
    channel) lands with PR3.

Verification
javalang parse on the changed Java; FallbackTreeSourceTest covers the routing (hit skips
the fallback, miss falls through with the same id, both-miss returns null, null sources
rejected).

…t + Studio fallback

Sibling ADR to the catalog-service one: the depth half. Box serves the topic tree
Studio-shaped at /k2go-api/kolibri/tree/:id (PR3); app routes local-first with Studio
fallback (PR2). Amends ADR-4954's "topic selection needs connectivity".
FallbackTreeSource(primary, secondary) returns primary's node or, on a miss, secondary's
— the one place the local-first policy lives, pure and unit-tested. CatalogRepositoryImpl
composes LocalTreeSource over StudioTreeSource behind fetchTree; PR1's refresh scheduling
is untouched. With PR3 unshipped the box always misses, so behaviour is unchanged.
Introduce TreeSource so the tree can come from the box or Studio interchangeably.
StudioTreeSource implements it; new LocalTreeSource reads localhost:8085/k2go-api/
kolibri/tree/<id> with tight timeouts, reusing StudioCatalogMapper.tree (same shape).
Never throws; a miss (box down, channel not imported, PR3 not shipped) returns null.
Introduce TreeSource so the tree can come from the box or Studio interchangeably.
StudioTreeSource implements it; new LocalTreeSource reads <box>/k2go-api/kolibri/tree/<id>
with tight timeouts and a test-overridable base, reusing StudioCatalogMapper.tree (same
shape). Never throws; a miss (box down, channel not imported, PR3 not shipped) returns
null. LocalTreeSourceTest covers the box path and the 404->null fallback case.
@luisguzman-adfa
luisguzman-adfa merged commit bf715f9 into main Aug 14, 2026
3 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/ADFA-5094-kolibri-depth branch August 14, 2026 14:49
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