Skip to content

K2GO-422 feat(forgejo): post-install "Install repos" action + status endpoint - #593

Merged
luisguzman-adfa merged 7 commits into
mainfrom
feat/K2GO-422-forgejo-repos-post-install
Sep 25, 2026
Merged

luisguzman-adfa merged 7 commits into
mainfrom
feat/K2GO-422-forgejo-repos-post-install

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

What this changes:

On an installed Forgejo with no example repos, the module detail ("About this
app") now offers "Install example repositories". Tapping it seeds the repos Get
More style: it banks the seed, starts the foreground ForgejoSeedService, and
opens SetupProgressActivity, which tracks the running seed to completion, then
opens the Library.

Box:

  • New read-only GET /k2go-api/forgejo/status -> { reachable, adminExists,
    adminAuthenticable, repos, manageable }, from in-process HTTP to the forge API
    (no CLI, no fork, so it answers even when dash-node is off-proot). manageable =
    we authenticate as the K2Go admin OR the admin is absent (the seed can create
    it); an admin we cannot authenticate is not manageable, so the button is
    withheld instead of guessing.
  • dash-node 1.3.5 -> 1.3.6 (package.json + CHANGELOG).

App:

  • ForgejoStatusClient reads the status; the module detail shows "Install repos"
    (manageable and no repos yet), nothing (repos present), or a blocked note.
  • The button hands off to SetupProgressActivity via EXTRA_FORGEJO_SEED and is
    tracked there; no separate progress screen.
  • ForgejoSeedClient gains a force flag so an intentional re-seed is not
    short-circuited by a prior seed's leftover "done" status (a single shared
    marker); the box POST rewrites the status to "running" synchronously.
  • New UI strings translated to all locales.

Why:

Declining the example repos at install (or a seed that did not finish) leaves the
forge without them, with no way to add them later. This is a one-tap,
box-state-driven way to seed the repos onto an already-installed forge.

Scope:

First deliverable of K2GO-422 (the post-install repos action). The
non-destructive "Update repos" refresh and the general module-update path are
later deliverables.

Verification:

Device-validated on arm64: on a forge with admin and org but no repos, the button
appeared, seeded the 3 example repos, and returned to the Library. Multi-pass
code review done.

Add GET /k2go-api/forgejo/status so the app can decide the post-install repos
action without mutating anything. It returns { reachable, adminExists,
adminAuthenticable, repos, manageable } from in-process HTTP to the forge API
(no CLI, no fork), so it answers even when dash-node is off-proot (unlike the
seed). manageable = we authenticate as the K2Go admin, OR the admin is absent so
the seed can create it; a K2Go admin that exists but cannot be authenticated
(password changed) is not manageable, so the app blocks instead of guessing.

dash-node 1.3.5 -> 1.3.6 (package.json + CHANGELOG).
On an installed Forgejo, the module detail now offers "Install example
repositories" when the box status (GET /forgejo/status) says the forge is
manageable and has no repos yet. Tapping it enqueues the seed to the tasks index
Get More style: bank the seed, start the foreground ForgejoSeedService, and open
SetupProgressActivity, which tracks the running seed to completion via a new
EXTRA_FORGEJO_SEED launch flag.

- ForgejoStatusClient: reads the box status; canInstallRepos / hasRepos / blocked.
- SetupProgressActivity: EXTRA_FORGEJO_SEED marks a post-install seed run, so the
  completion gate waits on it (seedPendingRun = ... && (moduleShown ||
  postInstallSeed)) and the seed row shows. The stranded case (a banked seed
  leaking into an unrelated Get More flow) has neither signal, so it still does
  not block: no hang reintroduced.
- ModuleDetailFragment: the installed branch queries the status off the main
  thread and shows "Install repos", nothing (repos present), or a blocked note
  (an admin exists that K2Go cannot authenticate).

Update/refresh of existing repos (non-destructive) remains a later deliverable
(K2GO-422 section A). New strings are parked for translation before merge.
…action

Device test: the "Install repos" button returned "done" in ~6 ms without
seeding. The box seed status is a single shared marker; the prior admin/org seed
left it "done", and ForgejoSeedClient.drive short-circuits on a leftover "done"
before it POSTs (finding D, deferred from the analysis, now hit).

Add drive(includeRepos, force, listener): force ignores the leftover "done" and
POSTs a fresh seed (the box POST rewrites the status to "running" synchronously,
so the poll follows the fresh run); non-forced keeps the re-attach optimization
for the install flow. ForgejoSeedService.start(ctx, force) threads it; the
post-install button forces. Device-validated on arm64: the seed ran ~58 s and
adopted the 3 example repos.
Two-pass review follow-ups on the status path:
- ForgejoStatusClient: raise the read timeout to 30s. The box makes a couple of
  short forge calls before answering, and a 10s client timeout could expire on a
  warming forge, silently hiding the "Install repos" button.
- forgejo.status.ts: run the independent probes (public users lookup + authed
  /user) with Promise.allSettled instead of sequentially, and lower the per-call
  timeout to 5s, so the worst-case latency is roughly halved.
… locales

Migrate k2go_forgejo_install_repos and k2go_forgejo_repos_blocked from
strings_untranslated.xml into strings.xml (English) and all 33 locale files.
Machine translations, marked for human review. Tracker is empty again.
Third-pass review: seedPendingRun released the completion gate on
mq.didFail("forgejo") in the post-install flow too, where the module queue is a
stale/unrelated verdict. Scope it to moduleShown so a post-install seed run
waits on its own state. Behavior-preserving for the module-install and
post-install flows; closes the fragile coupling.
@luisguzman-adfa
luisguzman-adfa merged commit 8d10ae0 into main Sep 25, 2026
4 checks passed
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