Skip to content

Clouds belong to projects, not environments, and pages update live - #24

Merged
juicycleff merged 6 commits into
mainfrom
fix/live-cache-and-cloud-placement
Nov 21, 2026
Merged

juicycleff merged 6 commits into
mainfrom
fix/live-cache-and-cloud-placement

Conversation

@juicycleff

@juicycleff juicycleff commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Two problems behind one symptom on the deploy screen: the placement panel said "No Cloud is assigned to production" with no way forward, and stayed that way after you assigned one until a page reload.

Pages update live

A write or a live event only refreshes a page when it names a cache tag some query carries. Most cloud screens named tags nothing carried:

  • Live events used single-word tags (EnvironmentCloud, Sync, CanaryReport, NotificationList, AgentTask, …) that match nothing; they now name the item and list tags the reads carry. Agent task, request and release report events invalidate the REST records instead of upserting separate event types. cloud_capacity.updated used {cloud_id}, which never resolved against the camelCase frame.
  • Two forge generator bugs dropped list tags on every []*T envelope and kept stream entities on their bare names when only the REST document renamed them (Target vs CloudprofilesTarget, same for Deployment and Source). Fixed in fix(client): keep cache tags on pointer-slice envelopes and renamed stream entities forge#133 and released as cmd/forge/v1.14.3 (#134); FORGE_CLI moves to it.
  • cache-contract.test.ts fails on any write or live event invalidating a tag no read carries, with the remaining gaps listed and explained. Hand-written polling and listener plumbing that stood in for the missing tags is gone.

Clouds belong to projects

Clouds were org-owned and grants ignored environments, but each environment still had to be assigned a Cloud before a service could name a target. Now:

  • Each project has one default Cloud (a flag on its grant). Every environment resolves through it; environments differ only where loomplane.yaml says. A project's first grant becomes its default; revoking a grant ends its default.
  • Changing the default is a reviewed Cloud change covering every environment of the project (POST /projects/:id/default-cloud/preview, loomctl clouds make-default). The review pins both grants, and the new default at the revision the apply gives it.
  • Shared changes (a target edit, a default placement switch) reach every environment of projects whose default the Cloud is, plus any environment running a service placed on it.
  • A Cloud or target can't be deleted while it's a project's default or a serving binding pins it.

A service can also name another granted Cloud:

trainer:
  cloud: GPU Lab
  cloud_target: a100
  environments:
    preview: {cloud_target: eu-run}   # a target without cloud is the default Cloud's

Planning runs one resolution pass per Cloud and holds the other Clouds' services, so pools, capacity intents, Loomplane Cloud rooms and location constraints use the single-Cloud code unchanged. Placements record named; a default change leaves named placements where they are.

Dashboard: the project's Clouds tab drops the environment picker for one card per granted Cloud, the default first, with Make default on the others and where each service runs inside. The deploy screen's Runs on lists every granted Cloud's targets under the Cloud's name and links to the Clouds tab instead of dead-ending.

Migration

project_default_cloud adds the default flag, backfills each project with the Cloud most of its environments used (without moving any revision a plan pinned), rewrites the capacity, workload-scope and admission functions to stop joining the assignment, and drops loomplane_cloud_assignments. Placements and capacity intents keep assignment_revision as an unchecked wire field so stored records hash as they were approved. Down gives every environment its project's default.

For review

  • internal/currentauthority records the new migration in its reviewed source lists (project and Fleet). It calls loomplane_append_event and adds a column to a table Fleet reads; it redefines neither the guarded functions nor a column Fleet reads.
  • applySyncUpgrade replays three historical migrations onto a current database; their pool function body names the dropped table, so the helper restores every function the replay changed to its current definition.
  • Projects whose environments used different Clouds keep running on their pinned bindings; the next plan of a non-default environment shows the move for review.

Verified

  • go build, go vet, the Go unit suite and golangci-lint (integration tags) pass; database/migrations integration suite passes, including a new test for backfill, guards, rollback and re-apply.
  • Integration tests matching Cloud, Shared, Pool, Capacity, Managed, Cleanup, Location, Tags, Usage, Default, Native, Placement, Server, Cluster, Fleet, Node, Model, Azure, Domain, Route and Manifest pass. Seven timed out at 30s under load in the long batch runs (Postgres deadline errors, deployments still uploading); each passes on its own.
  • Dashboard typecheck, lint and all 2,229 tests pass.
  • Specs dumped from an API built at the merge commit; forge client check with cmd/forge@v1.14.3 reports both clients up to date.

Add service on a Cloud target

add_service takes cloud_target and cloud. The Add service dialog's Runs on lists every Cloud's targets under its name, reusing the deploy screen's list, and loomctl services add takes --cloud-target and --cloud. Verified with Go, manifest integration and dashboard tests (2,230), and a clean forge client check.

…fresh

A write or a live event only refreshes a screen when it names a tag some
query carries. Many named nothing, so pages stayed stale until a reload,
including the placement panel saying no Cloud was assigned after one was.

Server declarations:
- Live events used single-word tags ("EnvironmentCloud", "Sync",
  "CanaryReport", "NotificationList", "AgentTask", ...), which match only
  a query carrying exactly that word, and none did. They now name the
  item and list tags the reads carry.
- Agent task, request and release report events carry separate event
  types, so upserting them never touched what REST reads hold. They
  invalidate the REST tags instead.
- cloud_capacity.updated used {cloud_id}; frames are decoded to camelCase
  before tags resolve, so it never resolved.
- Cluster writes and two DELETE routes named types the reads don't use
  (CloudClusterPage, Source, BitbucketWorkspace).

Generated client: regenerated with a forge build carrying two generator
fixes (pointer-slice envelopes lost their list tags; stream entities kept
their bare name when only the REST document renamed them). That brings
Profile[], CloudprofilesTarget[], Sync[], Pool[], Server[], Zone[],
Report[], Request[] and ReleaseReport[] to life, and live Target, Source
and Deployment events now land on the records the pages read. Forge now
keeps stream routes out of the operation manifest, so their paths live in
client/streams.ts.

Dashboard:
- cache-contract.test.ts fails on any write or live event invalidating a
  tag no read carries, with the remaining gaps listed and explained.
- The release report listener plumbing is gone; the list refetches from
  its tag.
- Hand-written deployment tags derive the typename from the generated
  contract.
- The placement panel reads the environment's Cloud fresh when it opens,
  and says when the Cloud has no usable targets rather than claiming none
  is assigned.

Needs the forge release carrying the generator fixes: CI's FORGE_CLI pin
(v1.14.1) generates a different client, so `forge client check` fails
until the pin moves.

Verified: dashboard typecheck, lint and all 2213 tests pass; go build,
vet and tests for realtime, discovery and cloudinfra pass; the specs were
dumped from an API built from this branch with the same 452 operations as
before.
A Cloud was org-owned and a project's grant to it ignored environments, but
each environment still had to be assigned one Cloud before any service could
name a target, and cloud_target resolved only inside that assignment. The
deploy screen's "No Cloud is assigned to production" was that model showing
through.

Now each project has one default Cloud, every environment of the project
resolves through it, and environments differ only where loomplane.yaml says.

Model and storage (migration project_default_cloud):
- The default is a flag on the project's grant, unique per project among live
  grants. A project's first grant becomes its default; revoking a grant ends
  its default however the revocation is written. Backfill picks the Cloud
  most of a project's environments used, without moving any revision.
- loomplane_cloud_assignments is dropped. The capacity, workload-scope and
  admission functions stop joining it and stop comparing assignment_revision;
  the grant revision they already pin covers a default switch, since the
  switch advances both grants. Placements and capacity intents keep the
  assignment_revision field so stored records hash as they were approved.
- A target can't be deleted while its Cloud is a project's default or a
  serving binding pins it; a Cloud can't be deleted in either case either
  (its grants used to vanish with it).
- project_cloud.updated replaces environment_cloud.updated, readable with the
  same permission.

Behaviour:
- Changing the default is a reviewed Cloud change (project_default) covering
  every environment of the project. The review pins both grants, and the new
  default at the revision the apply gives it, so the sync's own runs aren't
  refused as stale.
- Shared changes (a target edit, a default placement switch) reach every
  environment of projects whose default the Cloud is, plus any environment
  running a service placed on it.
- API: GET/POST /projects/:id/default-cloud[/preview] replace the
  environment cloud routes. loomctl: clouds default, clouds make-default.

Dashboard:
- The project's Clouds tab has no environment picker: one card per granted
  Cloud, the default first and open, "Make default" on the others, targets
  and where each service runs inside. Placing a service there applies to
  every environment and clears the placement an environment set for it.
- The deploy drawer lists the default Cloud's targets under its name, and
  links to the Clouds tab when there's no Cloud or no target, instead of the
  dead end.
- Polling that stood in for missing cache tags is gone.

Docs and the agent's docs bundle describe the project default Cloud.

Review notes:
- internal/currentauthority records the new migration in its reviewed source
  lists (project and Fleet). The migration calls loomplane_append_event and
  adds a column to a Fleet-read table; it redefines neither the guarded
  functions nor any column Fleet reads.
- applySyncUpgrade replays three historical migrations onto a current
  database; their pool function body now names a dropped table, so the
  helper restores every function the replay changed to its current
  definition.

Verified: go build/vet and the full Go unit suite pass; golangci-lint clean
on the change; database/migrations integration suite passes; integration
tests matching Cloud, Shared, Pool, Capacity, Managed, Cleanup, Location,
Tags, Usage, Default, Native, Placement, Server, Cluster, Fleet, Node,
Model, Azure, Domain and Route pass (after the fixes in this commit, the
affected ones re-run); dashboard typecheck, lint and all 2213 tests pass;
the client regenerates without a diff from an API built from this commit.
A project resolves through its default Cloud; a service can now name any
other Cloud granted to the project:

    trainer:
      cloud: GPU Lab
      cloud_target: a100
      environments:
        preview: {cloud_target: eu-run}    # the default Cloud's eu-run
        staging: {cloud: GPU Lab EU}       # same target, another Cloud

`cloud` alone uses that Cloud's default placement. An environment that names
a target also says which Cloud it's in, so an override with a target and no
cloud goes back to the default; one with only cloud keeps the target. Clouds
are named by name, unique per organization.

Planning:
- One resolution pass per Cloud: the default, then each Cloud a service
  names. A pass holds the other Clouds' services, so the single-Cloud
  resolution (pools, capacity intents, Loomplane Cloud rooms, location
  constraints) runs unchanged and the placements merge. The database gateway
  and composed resources stay on the default Cloud.
- A Cloud the project can't use fails at services.<name>.cloud
  (cloud-unknown), and so does a named Cloud with no target and no default
  placement (cloud-default-missing) rather than silently skipping. Errors
  say which Cloud a target was looked up in.
- Placements record named. A project default change keeps named
  placements; a change to a Cloud itself still reaches every service on it.
  Pool relocation and location moves revalidate each pin against its own
  Cloud.

API, CLI and dashboard:
- ProjectCloud carries the Cloud's name; placement edits accept cloud.
- The deploy drawer's "Runs on" lists every granted Cloud's targets under
  the Cloud's name, and choosing one writes cloud and cloud_target together.
  Every Cloud on the Clouds tab can take services.

CI: FORGE_CLI moves to cmd/forge v1.14.3. cmd/forge v1.14.2 still required
the pre-release root module, so its generator lacks the cache-tag fixes this
client was generated with (xraph/forge#134).

Verified: go build/vet, the Go unit suite and golangci-lint pass; new tests
cover the merge rule, named-Cloud planning and findings, the default change
keeping named services, and ResolveNamedCloud against Postgres; dashboard
typecheck, lint and 2,217 tests pass, with new ones for choosing another
Cloud's target in the drawer and on the Clouds tab; the integration tests
matching Cloud, Shared, Pool, Capacity, Location, Server, Managed, Default,
Tags, Usage, Placement and Cluster pass (six timed out under load in the
batch run and pass on their own); a CLI built from xraph/forge#134
regenerates the client with no diff.
…oud-placement

Brings in add-service (#23). The generated client and the agent's docs bundle
conflicted; both were regenerated from the merged code: specs from an API
built at this merge, the client with forge cmd/forge v1.14.3.
@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loomplane-docs Ready Ready Preview Nov 21, 2026 2:24am UTC

Request Review

Adding a service could only place it on a provider account. Now it can go
on a Cloud target too, as any service in loomplane.yaml can:

- add_service takes cloud_target and cloud, written as the service's own
  placement. Neither can be set with provider or target.
- The Add service dialog's Runs on lists the default Cloud's targets, then
  each other Cloud the project may use, each under its name, then the
  providers. It reuses the deploy screen's per-Cloud list.
- loomctl services add takes --cloud-target and --cloud. A Cloud target
  replaces the provider a suggestion came with.

Verified: Go tests for manifests, pkg/manifest, ctl, client and planning,
golangci-lint and the manifest integration tests pass; dashboard typecheck,
lint and 2,230 tests pass, with a new one adding a service on another
Cloud's target; forge client check (cmd/forge v1.14.3) is clean.
@juicycleff
juicycleff merged commit c0d2db8 into main Nov 21, 2026
28 of 29 checks passed
@juicycleff
juicycleff deleted the fix/live-cache-and-cloud-placement branch November 21, 2026 02:24
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