From 995b9e5ad0d2181c98177ab424f963e203d71b9e Mon Sep 17 00:00:00 2001 From: Makisuo Date: Mon, 16 Nov 2026 11:36:13 +0100 Subject: [PATCH 1/3] fix(web): GitHub Go live lists only unsynced repos and shows its switches The Go live step repeated every synced repository under a checklist that already counted them, and never said where the integration's switches live. It now lists only repositories still syncing or failed, shows the CI traces and PR review switches, names the Connection tab, and drops Cancel once the source is saved. The sources lab gains GitHub and Go live pages. --- .../src/lab/sources-integrations-fixture.ts | 124 ++++++++++++++---- .../src/page/integrations/view-flow-github.ts | 105 ++++++++------- apps/web/src/page/integrations/view-github.ts | 2 +- .../sources/new/github-flow.scene.test.ts | 4 + apps/web/src/page/sources/new/view.ts | 6 +- 5 files changed, 165 insertions(+), 76 deletions(-) diff --git a/apps/web/src/lab/sources-integrations-fixture.ts b/apps/web/src/lab/sources-integrations-fixture.ts index f6302d3263..40a160e43f 100644 --- a/apps/web/src/lab/sources-integrations-fixture.ts +++ b/apps/web/src/lab/sources-integrations-fixture.ts @@ -1,4 +1,4 @@ -import { CloudflareIntegrationStatus } from "@maple/domain/http" +import { CloudflareIntegrationStatus, GithubIntegrationStatus } from "@maple/domain/http" import { V2PlanetScaleIntegration, V2PlanetScaleOrganizationList } from "@maple/domain/http/v2" import { Result, Schema, Array as Arr } from "effect" import type { PageContext } from "../page/contract" @@ -12,11 +12,25 @@ import { init as newInit, update as newUpdate } from "../page/sources/new/update import { AppRoute } from "../route" import type * as Policy from "@maple/domain/policy" -// `/lab/sources?page=cloudflare|planetscale` (the connect flow one step after Connect) and -// `cloudflare-card|planetscale-card` (the connected integration's card), over fixture statuses. +// `/lab/sources?page=cloudflare|planetscale|github` (the connect flow one step after Connect), +// `-live` (its Go live step) and `cloudflare-card|planetscale-card` (the connected +// integration's card), over fixture statuses. -export const INTEGRATION_PAGES = ["cloudflare", "planetscale", "cloudflare-card", "planetscale-card"] as const +export const INTEGRATION_PAGES = [ + "cloudflare", + "planetscale", + "github", + "cloudflare-live", + "planetscale-live", + "github-live", + "cloudflare-card", + "planetscale-card", +] as const export type IntegrationLabPage = (typeof INTEGRATION_PAGES)[number] +type LabIntegration = "cloudflare" | "planetscale" | "github" + +const integrationOf = (page: IntegrationLabPage): LabIntegration => + page.startsWith("cloudflare") ? "cloudflare" : page.startsWith("planetscale") ? "planetscale" : "github" const NOW = Date.UTC(2026, 10, 6, 12) @@ -87,25 +101,78 @@ const PLANETSCALE = Schema.decodeSync(V2PlanetScaleIntegration)({ expires_at: null, }) +const REPOS = [ + "hazel", + "maple-ui-parity", + "terraform-provider-maple", + "changesets", + "maple-render", + "maple-cost", + "maple", + "effect-orm", + "pulumi-maple", + "maple-portal", + "trace-capture", + "gtm", +] + +/** Every granted repository synced. */ +const GITHUB = Schema.decodeSync(GithubIntegrationStatus)({ + connected: true, + state: "connected", + accountLogin: "acme", + accountType: "organization", + repositorySelection: "all", + ciTracesEnabled: true, + repositoryDiscovery: null, + repositories: Arr.map(REPOS, (name, index) => ({ + id: `0199a005-0000-7000-8000-${String(index).padStart(12, "0")}`, + fullName: `acme/${name}`, + htmlUrl: `https://github.com/acme/${name}`, + isPrivate: false, + status: "active", + syncStatus: "ready", + lastSyncedAt: null, + lastSyncError: null, + trackedBranch: "main", + branches: [{ name: "main", isDefault: true }], + prReviewEnabled: index < 3, + })), +}) + const ORGANIZATIONS = Schema.decodeSync(V2PlanetScaleOrganizationList)({ object: "planetscale_integration.organization_list", organizations: [{ id: "org_1", name: "acme" }], }) -const isCloudflare = (page: IntegrationLabPage) => page === "cloudflare" || page === "cloudflare-card" - -/** The statuses as the hub reads them, then PlanetScale's organization list. */ -const loaded = (model: IntegrationsModel, page: IntegrationLabPage): ReadonlyArray => [ - IntegrationsMessage.CompletedReadClock({ nowMs: NOW }), - isCloudflare(page) - ? IntegrationsMessage.CompletedLoadCloudflare({ +/** The status as the hub reads it. */ +const statusLoaded = (model: IntegrationsModel, integration: LabIntegration): IntegrationsMessage => { + switch (integration) { + case "cloudflare": + return IntegrationsMessage.CompletedLoadCloudflare({ key: model.statuses.cloudflare.key ?? "", result: Result.succeed(CLOUDFLARE), }) - : IntegrationsMessage.CompletedLoadPlanetscale({ + case "planetscale": + return IntegrationsMessage.CompletedLoadPlanetscale({ key: model.statuses.planetscale.key ?? "", result: Result.succeed(PLANETSCALE), - }), + }) + case "github": + return IntegrationsMessage.CompletedLoadGithub({ + key: model.statuses.github.key ?? "", + result: Result.succeed(GITHUB), + }) + } +} + +/** The clock and the status, then PlanetScale's organization list. */ +const loaded = ( + model: IntegrationsModel, + integration: LabIntegration, +): ReadonlyArray => [ + IntegrationsMessage.CompletedReadClock({ nowMs: NOW }), + statusLoaded(model, integration), ] const organizationsLoaded = (model: IntegrationsModel): IntegrationsMessage => @@ -120,15 +187,13 @@ const organizationsLoaded = (model: IntegrationsModel): IntegrationsMessage => export const integrationCardModel = (page: IntegrationLabPage, context: PageContext): IntegrationsModel => { const step = (model: IntegrationsModel, message: IntegrationsMessage) => integrationsUpdate(model, message, context).model - const entered = integrationsInit( - { search: { integration: isCloudflare(page) ? "cloudflare" : "planetscale" } }, - context, - ).model - const withStatus = Arr.reduce(loaded(entered, page), entered, step) - return isCloudflare(page) ? withStatus : step(withStatus, organizationsLoaded(withStatus)) + const integration = integrationOf(page) + const entered = integrationsInit({ search: { integration } }, context).model + const withStatus = Arr.reduce(loaded(entered, integration), entered, step) + return integration === "planetscale" ? step(withStatus, organizationsLoaded(withStatus)) : withStatus } -/** The connect flow, one Continue past Connect. */ +/** The connect flow, one Continue past Connect, or on through to Go live. */ export const integrationFlowModel = ( page: IntegrationLabPage, context: PageContext, @@ -137,14 +202,15 @@ export const integrationFlowModel = ( const step = (model: NewModel, message: NewMessage) => newUpdate(model, message, context).model const inner = (model: NewModel, message: IntegrationsMessage) => step(model, NewMessage.GotIntegrationsMessage({ message })) - const entered = newInit( - AppRoute.SourcesNew({ search: { integration: isCloudflare(page) ? "cloudflare" : "planetscale" } }), - context, - ).model + const integration = integrationOf(page) + const entered = newInit(AppRoute.SourcesNew({ search: { integration } }), context).model const granted = step(entered, NewMessage.CompletedReadGrants({ grants })) - const withStatus = Arr.reduce(loaded(granted.integrations, page), granted, inner) - const ready = isCloudflare(page) - ? withStatus - : inner(withStatus, organizationsLoaded(withStatus.integrations)) - return Arr.reduce([NewMessage.ClickedContinue(), NewMessage.CompletedScrollToTop()], ready, step) + const withStatus = Arr.reduce(loaded(granted.integrations, integration), granted, inner) + const ready = + integration === "planetscale" + ? inner(withStatus, organizationsLoaded(withStatus.integrations)) + : withStatus + const next = [NewMessage.ClickedContinue(), NewMessage.CompletedScrollToTop()] + const once = Arr.reduce(next, ready, step) + return page.endsWith("-live") && once.stage !== "live" ? Arr.reduce(next, once, step) : once } diff --git a/apps/web/src/page/integrations/view-flow-github.ts b/apps/web/src/page/integrations/view-flow-github.ts index 85ca45869c..f51fd42f91 100644 --- a/apps/web/src/page/integrations/view-flow-github.ts +++ b/apps/web/src/page/integrations/view-flow-github.ts @@ -6,7 +6,7 @@ import { button } from "@maple/views/ui/button" import { badge } from "@maple/views/ui/display" import { icon } from "@maple/views/ui/icon" import { meter } from "@maple/views/ui/meter" -import { columnHead, dataTable, dataTableEmpty } from "../kit/data-table" +import { columnHead, dataTable } from "../kit/data-table" import { type CheckRow, flowColumns, @@ -23,7 +23,12 @@ import { activeRepos, githubReach } from "./flow-github" import { Message } from "./message" import type { Model } from "./model" import { githubStatusOf } from "./update-github" -import { githubDeactivated, githubInstallationPicker, githubReconnectButton } from "./view-github" +import { + githubDeactivated, + githubFeatures, + githubInstallationPicker, + githubReconnectButton, +} from "./view-github" import { SYNC_PRESENTATION } from "./view-github-repos" import { typography, typographyClass } from "@maple/views/ui/typography" import { hstack, vstack } from "@maple/views/ui/stack" @@ -78,7 +83,11 @@ const showsUpRail = (h: H): Html => }, { icon: "LayersIcon", title: "Traces", detail: "Spans with a commit SHA link to GitHub" }, { icon: "PullRequestIcon", title: "Code review", detail: "Rules, models and analytics" }, - { icon: "GearIcon", title: "Source page", detail: "Edit data, tracked branches, Disconnect" }, + { + icon: "GearIcon", + title: "Connection tab", + detail: "On the source page: these switches, tracked branches, Disconnect", + }, ], trust: "Large repos can take a few minutes to backfill. Nothing here needs you to stay.", docs: DOCS_HREF === undefined ? null : { label: "Docs", href: DOCS_HREF }, @@ -297,45 +306,43 @@ const repoTable = (h: H, repos: ReadonlyArray): Html => columnHead(h, { label: "Tracked branch", width: "w-36" }), columnHead(h, { label: "Status", width: "w-28", align: "right" }), ], - repos.length === 0 - ? [dataTableEmpty(h, ["No repositories granted yet"])] - : Arr.map(repos, (repo) => { - const presentation = SYNC_PRESENTATION[repo.syncStatus] - return hstack( - h, - { - gap: "4", - className: typographyClass({ - size: "sm", - className: stripClass("row"), - }), - }, + Arr.map(repos, (repo) => { + const presentation = SYNC_PRESENTATION[repo.syncStatus] + return hstack( + h, + { + gap: "4", + className: typographyClass({ + size: "sm", + className: stripClass("row"), + }), + }, + [ + h.span([h.Class("w-0 min-w-48 flex-1 truncate")], [repo.fullName]), + h.span( + [h.Class("w-36 shrink-0 truncate font-mono text-xs text-muted-foreground")], + [repo.trackedBranch ?? EMPTY_VALUE], + ), + h.span( [ - h.span([h.Class("w-0 min-w-48 flex-1 truncate")], [repo.fullName]), - h.span( - [h.Class("w-36 shrink-0 truncate font-mono text-xs text-muted-foreground")], - [repo.trackedBranch ?? EMPTY_VALUE], - ), - h.span( - [ - h.Class( - cn( - "inline-flex w-28 shrink-0 items-center justify-end gap-1 text-xs", - presentation.tone, - ), - ), - ], - [ - icon(h, presentation.icon, { - size: 12, - className: presentation.spin ? "animate-spin" : undefined, - }), - presentation.label, - ], + h.Class( + cn( + "inline-flex w-28 shrink-0 items-center justify-end gap-1 text-xs", + presentation.tone, + ), ), ], - ) - }), + [ + icon(h, presentation.icon, { + size: 12, + className: presentation.spin ? "animate-spin" : undefined, + }), + presentation.label, + ], + ), + ], + ) + }), ) const liveStep = (h: H, model: Model): Html => { @@ -344,6 +351,7 @@ const liveStep = (h: H, model: Model): Html => { const discovery = status?.repositoryDiscovery const isDiscovering = discovery?._tag === "Pending" const discoveryFailed = discovery?._tag === "Failed" + const unsynced = Arr.filter(repos, (repo) => repo.syncStatus !== "ready") const isLive = status !== null && status.connected && @@ -354,11 +362,7 @@ const liveStep = (h: H, model: Model): Html => { return flowColumns( h, [ - savedBanner( - h, - "Saved as a source. Safe to leave; sync keeps running.", - "Nothing to apply on GitHub", - ), + savedBanner(h, "Saved as a source. Safe to leave; sync keeps running."), liveChecklist(h, { title: isLive ? "GitHub is live" : "Going live", rows: @@ -376,7 +380,18 @@ const liveStep = (h: H, model: Model): Html => { : status !== null && !status.connected && !isDiscovering ? [installButton(h, model, "Reconnect GitHub")] : []), - ...(repos.length > 0 || (!isDiscovering && !discoveryFailed) ? [repoTable(h, repos)] : []), + // Once everything synced the checklist says so; the table only lists what still needs a look. + ...(unsynced.length > 0 ? [repoTable(h, unsynced)] : []), + ...(status !== null && status.connected && !isDiscovering && !discoveryFailed + ? [ + stepCard(h, { title: "What Maple does with it" }, [ + githubFeatures(h, model, status), + typography(h, { size: "xs", tone: "muted", as: "p" }, [ + "Change these any time on the source's Connection tab.", + ]), + ]), + ] + : []), ], showsUpRail(h), ) diff --git a/apps/web/src/page/integrations/view-github.ts b/apps/web/src/page/integrations/view-github.ts index 3c484e4af3..7e241c8185 100644 --- a/apps/web/src/page/integrations/view-github.ts +++ b/apps/web/src/page/integrations/view-github.ts @@ -137,7 +137,7 @@ export const githubInstallationPicker = (h: H, model: Model): ReadonlyArray { +export const githubFeatures = (h: H, model: Model, status: GithubIntegrationStatus): Html => { const [ciTraces, prReview] = INTEGRATION_FEATURES.github const active = Arr.filter(status.repositories, (repo) => repo.status === "active") const reviewed = Arr.filter(active, (repo) => repo.prReviewEnabled).length diff --git a/apps/web/src/page/sources/new/github-flow.scene.test.ts b/apps/web/src/page/sources/new/github-flow.scene.test.ts index 71f134e111..2c8b1696f0 100644 --- a/apps/web/src/page/sources/new/github-flow.scene.test.ts +++ b/apps/web/src/page/sources/new/github-flow.scene.test.ts @@ -586,6 +586,10 @@ describe("github connect flow", () => { Command.resolve(ScrollToTop, Message.CompletedScrollToTop()), expectView(role("listitem", { name: "Live (done)" })).toExist(), expectView(text("GitHub is live")).toExist(), + // Synced repos are not listed again, the switches are, and the saved source has no Cancel. + expectView(text("Tracked branch")).toBeAbsent(), + expectView(role("switch", { name: /CI traces/i })).toExist(), + expectView(role("link", { name: "Cancel" })).toBeAbsent(), ) scene( { update: pageUpdate, view }, diff --git a/apps/web/src/page/sources/new/view.ts b/apps/web/src/page/sources/new/view.ts index 9fe1b587d7..6bd5e87dab 100644 --- a/apps/web/src/page/sources/new/view.ts +++ b/apps/web/src/page/sources/new/view.ts @@ -113,7 +113,11 @@ export const view = Submodel.defineView((model, // A member has no steps to take, so no trail either. isRefused(model) ? { title: titleOf(model), actions: cancel(h) } - : { titleContent: titleContent(h, model), actions: cancel(h) }, + : // On Go live the source exists already, so there is nothing left to cancel. + { + titleContent: titleContent(h, model), + actions: model.integration !== null && model.stage === "live" ? undefined : cancel(h), + }, [pageBody(h, model, inputs.context.timeZone)], ), ) From 470a4bb9fe43d74b33c0c84690548048f8303023 Mon Sep 17 00:00:00 2001 From: Makisuo Date: Mon, 16 Nov 2026 11:45:18 +0100 Subject: [PATCH 2/3] fix(web): sources lab fixture uses effect/String --- apps/web/src/lab/sources-integrations-fixture.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/src/lab/sources-integrations-fixture.ts b/apps/web/src/lab/sources-integrations-fixture.ts index 40a160e43f..bd32709a22 100644 --- a/apps/web/src/lab/sources-integrations-fixture.ts +++ b/apps/web/src/lab/sources-integrations-fixture.ts @@ -1,6 +1,6 @@ import { CloudflareIntegrationStatus, GithubIntegrationStatus } from "@maple/domain/http" import { V2PlanetScaleIntegration, V2PlanetScaleOrganizationList } from "@maple/domain/http/v2" -import { Result, Schema, Array as Arr } from "effect" +import { Result, Schema, Array as Arr, String as Str } from "effect" import type { PageContext } from "../page/contract" import { Message as IntegrationsMessage } from "../page/integrations/message" import type { Model as IntegrationsModel } from "../page/integrations/model" @@ -30,7 +30,11 @@ export type IntegrationLabPage = (typeof INTEGRATION_PAGES)[number] type LabIntegration = "cloudflare" | "planetscale" | "github" const integrationOf = (page: IntegrationLabPage): LabIntegration => - page.startsWith("cloudflare") ? "cloudflare" : page.startsWith("planetscale") ? "planetscale" : "github" + Str.startsWith("cloudflare")(page) + ? "cloudflare" + : Str.startsWith("planetscale")(page) + ? "planetscale" + : "github" const NOW = Date.UTC(2026, 10, 6, 12) @@ -126,7 +130,7 @@ const GITHUB = Schema.decodeSync(GithubIntegrationStatus)({ ciTracesEnabled: true, repositoryDiscovery: null, repositories: Arr.map(REPOS, (name, index) => ({ - id: `0199a005-0000-7000-8000-${String(index).padStart(12, "0")}`, + id: `0199a005-0000-7000-8000-${Str.padStart(12, "0")(String(index))}`, fullName: `acme/${name}`, htmlUrl: `https://github.com/acme/${name}`, isPrivate: false, @@ -212,5 +216,5 @@ export const integrationFlowModel = ( : withStatus const next = [NewMessage.ClickedContinue(), NewMessage.CompletedScrollToTop()] const once = Arr.reduce(next, ready, step) - return page.endsWith("-live") && once.stage !== "live" ? Arr.reduce(next, once, step) : once + return Str.endsWith("-live")(page) && once.stage !== "live" ? Arr.reduce(next, once, step) : once } From e3d16569ec8d0779a9d2b5c205cba2a95b05bc29 Mon Sep 17 00:00:00 2001 From: Makisuo Date: Mon, 16 Nov 2026 12:02:06 +0100 Subject: [PATCH 3/3] refactor(web): GitHub repo status cell uses hstack --- .../src/page/integrations/view-flow-github.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/web/src/page/integrations/view-flow-github.ts b/apps/web/src/page/integrations/view-flow-github.ts index f51fd42f91..85f288f86c 100644 --- a/apps/web/src/page/integrations/view-flow-github.ts +++ b/apps/web/src/page/integrations/view-flow-github.ts @@ -323,15 +323,15 @@ const repoTable = (h: H, repos: ReadonlyArray): Html => [h.Class("w-36 shrink-0 truncate font-mono text-xs text-muted-foreground")], [repo.trackedBranch ?? EMPTY_VALUE], ), - h.span( - [ - h.Class( - cn( - "inline-flex w-28 shrink-0 items-center justify-end gap-1 text-xs", - presentation.tone, - ), - ), - ], + hstack( + h, + { + as: "span", + inline: true, + gap: "1", + justify: "end", + className: cn("w-28 shrink-0 text-xs", presentation.tone), + }, [ icon(h, presentation.icon, { size: 12,