Skip to content

Library cleanup: sibling Keys, key writes, closed DnsZone, service agent - #11

Merged
dubinsky merged 6 commits into
masterfrom
cursor/library-cleanup-followups-6a51
Nov 12, 2026
Merged

dubinsky merged 6 commits into
masterfrom
cursor/library-cleanup-followups-6a51

Conversation

@dubinsky

Copy link
Copy Markdown
Owner

Behavior-preserving for the three stacks: same resources and logical names, and the same grokBotKeyFile path for ~/Podval/infra, ~/OpenTorah/infra, and ~/CognoMath/infra. Version stays 0.6.0. The "9.0.0" and "6.20.0" literals stay inline. No new Output bind on the DNS path.

Do not merge. opentorah/infra is not changed here.

Working directory

Besom 0.5.2's Scala language host runs ./gradlew run --console=plain with the process directory set to the Gradle root. For these projects that directory contains both settings.gradle and Pulumi.yaml.

Gradle 9.9's application run task is a JavaExec whose workingDir defaults to project.projectDir. org.podval.conventions does not change it. A probe of that task printed the forked JVM's user.dir and Path.of("").toAbsolutePath as the project directory, both when the client cwd was that directory and when the daemon's own cwd was somewhere else (gradle -p). So Path.of("") is the project directory under pulumi, and the key file is its parent's Keys directory.

Commits

  1. 165a93b — the grok-bot key file is Keys/grok-bot-$infraProjectId.json beside the project directory. grokBotKeysDirectoryName and its domain match are gone. A missing Keys directory fails and names the path; it is not created.
  2. 1591ba5 — write the key on every machine. The /etc/hostname skip and isCloudInfrastructureGuest are gone. The guest file is a redundant owner-only copy; the copy script and .envrc's GOOGLE_CREDENTIALS are what Pulumi uses. This library does not read the file it writes.
  3. 414765a — write (tmp, rw-------, atomic move) only when the file is missing or its contents differ from the decoded JSON. Otherwise leave it untouched. The decision is KeyFile.shouldWriteCredentials, which the unit test calls without Besom.
  4. 750e633 — DnsZone is no longer open, and the scaladoc that existed only for subclassing is gone.
  5. e47dc29 — ServiceAgent is a Principal for a Google-managed gcp-sa-<service> agent. The Gcp.scala AlterRebbe comment is removed.
  6. 1b04fba — the sample drops the grokBotKeysDirectoryName override (and the comment that misstated when the domain match threw). Setup documents the sibling Keys directory.

DnsZone and podval-infra

This commit does not compile against podval-infra until dubinsky/podval-infra PR #1 merges and PodvalOrgZone is gone. This PR does not edit that repo.

Service agent, no alias

opentorah/infra at e6bfee2 registers the artifact-registry agent with logical name project:$projectId/$member/role:storage.objectViewer, member serviceAccount:service-$projectNumber@gcp-sa-artifactregistry.iam.gserviceaccount.com, role roles/storage.objectViewer, and gcpResourceOptions().

ProjectIam already builds project:$projectId/$principalResourceName/role:$role, passes principalMember, prepends roles/ once, and uses gcpResourceOptions(). ServiceAgent's name segment and member are that same member string, including .iam.gserviceaccount.com. Account's Pulumi name drops that suffix; this one does not, which is why the logical name matches and no alias is required. Pass the role unprefixed.

Follow-up call site in AlterRebbe (not in this PR):

val artifactRegistryAgentIam: ProjectIam[ServiceAgent] = ProjectIam(
  project,
  project.project.number.map(number => ServiceAgent(number, "artifactregistry")),
  Seq("storage.objectViewer")
)

WithResources(Seq(
  project,
  facsimilesBucket,
  storeBucket,
  cloudRunDeployServiceAccount,
  artifactRegistryAgentIam
))

Drop the direct IamMember and its imports. No aliases option.

Verification

./gradlew build and ./gradlew -p domain-infra/besom compileScala passed on JDK 25.

Open in Web Open in Cursor 

The file is Keys/grok-bot-$infraProjectId.json beside the project directory
pulumi runs from. Path.of("").toAbsolutePath is that directory under Besom's
gradlew run. grokBotKeysDirectoryName and its domain match are gone.
A missing Keys directory fails and names the path; it is not created.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
Drop the cloud-infrastructure hostname skip. The guest copy is redundant;
the copy script and .envrc are what Pulumi authenticates with.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
Leave an existing file untouched when it already holds the decoded JSON.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
PodvalOrgZone is leaving podval-infra. The subclassing scaladoc goes with open.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
ServiceAgent is the gcp-sa-<service> principal. Its Pulumi name segment is the
member string, so AlterRebbe's logical name stays the same with no alias.
The Gcp.scala comment about the unpinned binding is removed.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
Drop the sample's grokBotKeysDirectoryName override. That comment misstated
when the domain match threw.

Co-authored-by: Leonid Dubinsky <dub@podval.org>
@dubinsky
dubinsky merged commit 7f2a353 into master Nov 12, 2026
2 checks passed
@dubinsky
dubinsky deleted the cursor/library-cleanup-followups-6a51 branch November 18, 2026 21:25
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