Repository navigation
ADFA-5364 refactor(content): one admission rule for the REST content streams - #515
Merged
luisguzman-adfa merged 2 commits intoSep 1, 2026
Merged
Conversation
…streams Books, ZIM and Kolibri each carried the same deferral rule word for word — proot or a dashboard update in flight, then another stream with unfinished work — so a fourth stream would have carried a fourth copy. It now lives once, in system/data next to the PendingContent it consults, which is a package that already depends on both callers' packages: no new dependency direction. Behaviour is unchanged: same checks, same order, same reasons. The only observable difference is the log wording, unified on "deferred" (Kolibri said "blocked"), which is the accurate word — a deferred order stays in the wishlist and the next pass takes it. Not touched: the proot provisioners (maps, modules). Their gate looks similar but is a different rule for a different family — they are what this one defers to, and sharing it would make maps defer on REST work it must ignore. First slice of ADFA-5364: the gate now exists in one place, so the connection dimension lands there instead of in three copies. No behaviour to verify by test; the device check is that queueing content during a module install still defers, on all three streams.
…not by name Review follow-up on the collapse. The shared rule took the stream's name as a free string, so the three callers carried three literals of an identity that system/domain/ContentType already owns — the same drift its own javadoc was written about. It now takes the type: the log output is byte-identical (key() is "books" / "zim" / "kolibri"), the signature carries the execution class that says which types this gate is even about (MAPS is STOPPED — not a caller here but one of the things this rule defers to), and a fifth content type needs no edit in this class. Also drops the MapsProvisioner import KolibriProvisioner no longer uses — it only ever served the rule that moved out, and an unused import is a lint warning, not an error, so it would have landed.
luisguzman-adfa
deleted the
refactor/ADFA-5364-content-admission-collapse
branch
September 1, 2026 19:26
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.
Books, ZIM and Kolibri each carried the same deferral rule word for word — proot or a dashboard
update in flight, then another stream with unfinished work — so a fourth stream would have carried a
fourth copy. It now lives once, in
system/data/ContentAdmission, next to thePendingContentitconsults: a package that already depends on both callers' packages, so no new dependency direction.
First slice of ADFA-5364. No new capability — the connection dimension lands on this gate later,
in one place instead of three.
Changes
ContentAdmission.canStart(ctx, ContentType)— the rule, once.KolibriProvisioner.canDrainNowstays as a one-line wrapperbecause its javadoc records why it stopped being public API.
ContentType, not the stream's name: the type already owns that identity, and it carriesthe execution class that says which types this gate is about —
MAPSisSTOPPED, so it is not acaller here but one of the things this rule defers to.
−59 / +11 in the callers. No behaviour change: same checks, same order, same reasons. The only
observable difference is the log wording, unified on "deferred" (Kolibri said "blocked") — the
accurate word, since a deferred order stays in the wishlist for the next pass.
Not touched, on purpose
Maps and Modules have a similar-looking gate that is a different rule for a different family
(proot operations) — they are what this rule defers to. Sharing it would make maps defer on REST
work it must ignore. The ticket's first draft said "five copies"; it is three.
Verification
:app:testDebugUnitTest+:app:lintDebuggreen. On device, both branches of the rule:handing 3 to BooksDownloadServicehanding 2 to ZimDownloadServicehanding 1 to KolibriSeedServiceAll three emitted the right
ContentType.key()label, which is the only thing the signature changecould have broken. Courses' defer branch is not reachable through the pump:
KolibriProvisionerclears its wishlist at hand-off (unlike Books/ZIM,
TODO(ADFA-4874)), sohasPendinggoes falseimmediately and nothing asks again.
No JVM test:
canStartholds no logic, only which four collaborators it asks. With stubs a testcould assert
!false && !false— the implementation restated. The risk it would have covered (astream consulting a different rule) is now the compiler's.
Note for the ticket
Recon for the next slice found that FQR is a live REST stream outside this rule in both
directions —
FqrControllernever consults it, andPendingContent(built onContentType)cannot see an FQR job, so the others do not defer for it either. Recorded in ADFA-5364 as fork D;
not addressed here.