Upgrade order: open one gascity-root PR moving pack imports #11

Merged
mikluko merged 2 commits from worker/gascitypacks-8yl into main 2026-11-11 14:48:19 +00:00
Contributor

Adds the upgrade order to the roles pack, next to apply: exec, no LLM, every 10 minutes, city-scoped. In a staged worktree of the city's origin/main it runs gc import upgrade; if pack.toml, city.toml or packs.lock changed, it validates as apply does, commits to upgrade/packs as the city's git identity, force-pushes that one branch and opens (or finds) the one pull request with gc <forge> pr open. A failure mails the Operator, deduplicated as in apply.

  • sha: pins: checked with the real gc, gc import upgrade moves nothing against one but still rewrites every fetched time in packs.lock, so "a file changed" would open a PR every 10 minutes. The order ignores fetched: a city that pins by sha: gets no PR, and only an import that follows the releases (^0.N) can move.
  • One proposal per upgrade: what was proposed is recorded under GC_PACK_STATE_DIR, after the PR is open. The same upgrade is not re-validated, re-pushed or reopened while pending, so a PR you close stays closed until a different upgrade replaces it (delete the state file to propose it again).
  • You may not expect: gc forgejo pr open gains --title (it required a bead and the order has none); the Operator skill gets a sentence on the upgrade: mails; the city's beads git hooks are bypassed for the order's own switch/commit/push (a staged worktree has no beads store).
  • Verified: gc lint ., go vet, go test, shellcheck, tests/upgrade.sh (new, in CI: stub gc over throwaway repos; a dozen deliberate breakages of the script are each caught), tests/merge.sh, tests/worktree-setup.sh. One run with the real gc on a throwaway copy of the city plus a local semver pack: nothing while only sha: pins existed, one packs.lock-only commit once the pack released 1.1.0, nothing at the next run.
  • To use it (gascity-root, not in this PR): pin gascitypacks to a commit with this order and pr open --title; give the order FORGEJO_TOKEN_FILE through an [[orders.overrides]] entry named upgrade (exec orders get no workspace.env); let the supervisor's git push to the city's origin. An upgrade PR's diff carries every pack's new fetched time, which is gc's doing. Follow-up filed: gascitypacks-t12.

Bead: gascitypacks-8yl

Adds the `upgrade` order to the `roles` pack, next to `apply`: exec, no LLM, every 10 minutes, city-scoped. In a staged worktree of the city's `origin/main` it runs `gc import upgrade`; if `pack.toml`, `city.toml` or `packs.lock` changed, it validates as `apply` does, commits to `upgrade/packs` as the city's git identity, force-pushes that one branch and opens (or finds) the one pull request with `gc <forge> pr open`. A failure mails the Operator, deduplicated as in `apply`. - **`sha:` pins:** checked with the real gc, `gc import upgrade` moves nothing against one but still rewrites every `fetched` time in `packs.lock`, so "a file changed" would open a PR every 10 minutes. The order ignores `fetched`: a city that pins by `sha:` gets no PR, and only an import that follows the releases (`^0.N`) can move. - **One proposal per upgrade:** what was proposed is recorded under `GC_PACK_STATE_DIR`, after the PR is open. The same upgrade is not re-validated, re-pushed or reopened while pending, so a PR you close stays closed until a different upgrade replaces it (delete the state file to propose it again). - **You may not expect:** `gc forgejo pr open` gains `--title` (it required a bead and the order has none); the Operator skill gets a sentence on the `upgrade:` mails; the city's beads git hooks are bypassed for the order's own switch/commit/push (a staged worktree has no beads store). - **Verified:** `gc lint .`, `go vet`, `go test`, `shellcheck`, `tests/upgrade.sh` (new, in CI: stub gc over throwaway repos; a dozen deliberate breakages of the script are each caught), `tests/merge.sh`, `tests/worktree-setup.sh`. One run with the real gc on a throwaway copy of the city plus a local semver pack: nothing while only `sha:` pins existed, one `packs.lock`-only commit once the pack released 1.1.0, nothing at the next run. - **To use it (gascity-root, not in this PR):** pin gascitypacks to a commit with this order and `pr open --title`; give the order `FORGEJO_TOKEN_FILE` through an `[[orders.overrides]]` entry named `upgrade` (exec orders get no `workspace.env`); let the supervisor's git push to the city's origin. An upgrade PR's diff carries every pack's new `fetched` time, which is gc's doing. Follow-up filed: gascitypacks-t12. Bead: gascitypacks-8yl
pr open took the pull request's title from a bead and named the bead in the body, so only a pull request that carries a bead could be opened with it. The upgrade order has no bead, and needs the same find-or-create behaviour for the one pull request it keeps on the city repository.

--title <text> now stands in for --bead <id>: the title is the text, and the body is the summary file's text with no Bead line. Exactly one of the two is required; neither, both or a blank title is a usage error (exit 2). The bead path is unchanged, and the bead is looked up only when --bead is given. Finding the open pull request for the branch is unchanged too, which is what keeps a branch that several runs push to on one pull request.

Covered in main_test.go: a pull request created from a title with and without a summary, the open pull request found again from a title, and the usage errors. go vet, gofmt and go test pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
feat: add the upgrade order, which proposes pack upgrades as one pull request (gascitypacks-8yl)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / scripts (pull_request) Successful in 5s
test / lint (pull_request) Successful in 3m19s
c3bf15d1dd
The roles pack gets an order that proposes the city's pack upgrades as a pull request. Every ten minutes it runs gc import upgrade in a worktree of the city repository's origin/main and, when an import moved, validates the result as apply does (gc import install, gc config show --validate), commits it to upgrade/packs as the city's git identity, pushes the branch and opens the pull request with gc <forge> pr open, which finds the one already open. A failure mails the Operator under a dedup key, as apply does.

Against a sha: pin gc import upgrade moves no import but still rewrites every fetched time in packs.lock (checked with the real gc), so comparing the files would open a pull request at every run. The order compares them without those times. It also records a hash of what it proposed under GC_PACK_STATE_DIR: the same upgrade is not validated, pushed or opened again while it is pending, and a pull request the user closed is not reopened until a different upgrade replaces it. The state is written only after the pull request is open, so a failed pr open is retried at the next run. The city's git hooks (beads') are bypassed for the order's worktree add, switch, commit and push: a staged worktree has no beads store for them to act on. Signing is left to git's configuration.

tests/upgrade.sh drives the script with a stub gc against throwaway repositories and runs in CI beside tests/worktree-setup.sh: a sha: pin and an idle city propose nothing; a move is pushed one commit onto origin/main as the city's identity, validated before the push, proposed once, replaced by a later upgrade and not proposed again once merged; each failure mails the Operator and pushes nothing it should not. I also checked that the tests fail when the script loses the fetched-time rule, the hook bypass, the state check, the cleanup, the force push, the identity check or the origin/main base. Separately, one run against the real gc and a throwaway copy of the city plus a local semver pack did nothing while only sha: pins existed, then pushed a packs.lock-only commit once the pack released 1.1.0, and nothing again at the next run. gc lint ., go vet, go test and shellcheck pass.

The README says what the order needs of the city (push access to origin, and FORGEJO_TOKEN_FILE through an orders override, which exec orders do not get from workspace.env), and the Operator skill what its upgrade: mails mean. Until the city pins a gascitypacks commit that carries this order, which also carries pr open --title, there is nothing to run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!11
No description provided.