forge: build the dev VM forge from the Go program #40
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/archetypes!40
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/forge-go-cutover"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The next rebuild of a dev VM installs
forgeas the Go program from allod/tools instead of the Bash script; nothing else on the VM changes, and no VM changes before a human rebuilds.The pinned Go binary now includes
forge pr snapshot, including the repository-identity and AGit ref checks used by the PR explanation workflow. Its package tests passed during the build, and I compared help, two error paths, four live read commands, and a live pull-request snapshot byte for byte against the Bash tool.The Bash source remains in the same input and runnable from a checkout. If the cutover is wrong, revert this PR and rebuild; that restores both the Bash wrapper and the pre-cutover allod-tools pin at
93eb4baee4d74855eb451a415006d1ca26f3a6ad.Risk
R3, per the migration plan. This swaps the deployed
forgefor every dev VM at the next human rebuild, andforgeis the tool agents use for every Forge operation, so silent contract drift would land everywhere at once.The diff against current master touches only the
forgepackage and advancesallod-toolsby one commit. The other six tools in this module are unchanged. The Bashforgestill ships in the pinned input because deleting it belongs after both cutovers, not in this PR.Two rollback constraints remain. Moving only the input back while leaving the Go wrapper would still build at the recorded pre-cutover revision because that revision contains
cmd/forge, but it would deploy a Go binary withoutpr snapshot; revert this PR so the implementation and wrapper move together. Later, once thenexusinput carries allod/nexus#25, reverting this PR alone would leave the host wrapper and the old tools pin out of sync; from that point, roll thenexusinput back together with this PR.The wrapper's runtime pins change with the implementation. The Bash wrapper pinned
jqandcurl; the Go API client runs in-process and needs neither. The Go binary still runsgitto infer the repository and current branch, so this wrapper pinsgitexplicitly instead of relying on the ambient PATH.Validation
Current master was merged into the cutover branch, resolving the lock conflict without reverting any of master's other input advances. The
allod-toolsinput moves from93eb4baee4d74855eb451a415006d1ca26f3a6adto5649cec426b5d36d740f9286481b5496ab01d4e3, the merged allod/tools#156 revision. That one-commit span adds the Go snapshot implementation and tests; the Bash source is unchanged.I evaluated the package generated for the real
allod-devconfiguration, not a standalone approximation. FilteringnixosConfigurations.allod-dev.config.home-manager.users.allod.home.packagesforpname == "forge"yielded/nix/store/bd2g9k60i2205c8d9pra17c1513ppjqr-forge-0.1.0.drv; building that derivation produced/nix/store/bvwm2lm8z9ik91lgcyqwknfjidif1l58-forge-0.1.0.The derivation uses
buildGoModulewith Go 1.25.10,vendorHash = null,subPackages = cmd/forge, anddoCheck = 1, so thecmd/forgesuite—including the 19 ported snapshot scenarios—ran during the package build.subPackagesscopes that build's check phase, so the separateinternal/package tests remain the responsibility of allod/tools' own checks.The result is a Go package, not a shell application:
bin/forgeis a 394-byte wrapper that prepends the pinned Git 2.51.2 and executesbin/.forge-wrapped; the wrapped file starts with the ELF magic bytes and is about 7.1 MB.Byte-for-byte comparisons against the Bash tool at current allod/tools master all matched, including stderr and exit status:
--helppr viewwith its missing argument (exit 1)issue createwith its missing title (exit 1)pr list,issue list,issue view 98, andauth statuspr snapshot 156, including schema version 1 and its repository/ref projectionThe Git wrapper check also passed with an empty environment. The wrapped package inferred
allod/toolsand reached the deliberately dead API endpoint, reporting the parity labelcurl exit 7; invoking.forge-wrappeddirectly could not find Git and reported that no repository was specified. This proves the deployed wrapper supplies Git and does not imply that the Go client executes curl.The exact source store path used by the derivation still contains an executable Bash
forge, preserving the checkout fallback during deployment.Not covered here: the rebuild itself, which is a human step. The host-side cutover remains allod/nexus#25. This repo pins
nexusseparately, so merging either PR alone changes no running host; the host changes only after that pin advances and a human rebuilds.Refs allod/tools#155
Refs allod/tools#98
allod-agent referenced this pull request from allod/nexus2026-08-19 06:30:05 +01:00
Read-only review pass on this PR, findings and what changed as a result. The code diff is unchanged; every fix below was to the PR body, which was wrong or overstated in three places.
Corrected: the rollback instruction was incomplete. "Revert this commit" is right today, but this flake also builds the host from its
nexusinput, so once that input carries the matching wrapper (allod/nexus#25), the host module in this same flake asks forcmd/forgeas well, and reverting this commit alone would moveallod-toolsback to a rev without it and leave the host configuration unbuildable. The body now says to roll thenexusinput back together with this commit from that point on.Corrected: the cross-repo coupling was stated as merge order. It is not — this repo pins
nexusseparately, and that pin is untouched here, so allod/nexus#25 changes nothing on the host until someone bumps it. Either PR is safe to merge alone; the combination that cannot build is bumping this flake'snexusinput past that wrapper whileallod-toolssits at the old rev.Corrected: two claims narrowed.
doCheckruns thecmd/forgetests only, becausesubPackagesscopes the check phase, so theinternal/tests do not run in this build. And the validation outputforge: GET ... failed: curl exit 7is a label the Go program prints fromcurlExitCodeincmd/forge/api.go, mapping Go transport errors onto curl's exit-code numbering; it is not a curl invocation, which matters because droppingpkgs.curlrests on that.Checked and clean: the only child process anywhere in the Go program is
git, frominternal/gitremote— noLookPath, no shell-out, no editor or pager, and the API client usesnet/httpandencoding/jsonin-process, so droppingjqandcurlis safe. Nothing in this repo or in allod/tools depends onforgebeing a shell script; callers usecommand -v forgeand plain invocations.checks/pi-integration.nixfiltershome.packagesby name, but foryoloandpi-coding-agent, so the derivation name changing fromforgetoforge-0.1.0does not touch it. The bash source is present in the newly pinned input, verified in the store path this build read.Two non-blocking observations for the owner, neither addressed here.
src = allod-toolsis the whole repository, so any commit to allod/tools — a README edit included — changes the source hash and rebuilds the Go binary and reruns its test suite on every dev VM;lib.fileseton the source ordoCheck = falsewould decouple that if rebuild time becomes annoying. And the packaging expression now exists in three places, of which allod/tools' own dev flake is the odd one out: it has no git wrap, sonix buildthere yields an unwrapped binary that differs from what is deployed.Cutover dependency update: agent archetype launchers now require
forge pr snapshot, whose Go port is in allod/tools#156. Please do not merge/rebuild this cutover at its currentallod-toolspin.Once #156 merges, this branch needs current
mastermerged into it, theallod-toolslock refreshed to the merged rev, and the package plus snapshot acceptance checks rerun before the human VM rebuild.Refs allod/tools#155
The owner has approved proceeding with the post-tools-merge refresh now. I am updating this branch against current
master, advancing theallod-toolspin to the revision containing allod/tools#156, and rerunning the package and snapshot acceptance checks.Refs allod/tools#155
Refresh complete at
66f2342.masteris now an ancestor of the PR head and Forgejo reports the PR mergeableallod-toolsnow moves only from93eb4bato merged snapshot rev5649cecallod-devpackage built as/nix/store/bvwm2lm8z9ik91lgcyqwknfjidif1l58-forge-0.1.0cmd/forgetests ran during the build, including the 19 snapshot scenariospr snapshot 156matched the Bash tool byte for byteforgefor rollbackThe PR body now records the current pin range, output paths, validation, and rollback constraints. The remaining gate is merge followed by the human dev-VM rebuild and deployed smoke test.
Refs allod/tools#155