Repository navigation
ADFA-5094: local-first topic tree (box-served, Studio fallback) — app side - #406
Merged
Merged
Conversation
…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.
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.
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
localhost:8085/k2go-api/kolibri/tree/, tight timeouts) and StudioTreeSource
(internet), composed by FallbackTreeSource (primary, else secondary).
contentnode_tree shape as Studio, so there is one mapper and no branching.
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
/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.
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).