Repository navigation
Description
A parser release that changes emitted bytecode will always break the Renovate bump
internal/vm/prelude_frozen_gen.go is generated from internal/vm/prelude.rb by cmd/freeze-prelude and committed, so a closed-world build can link the prelude without the front-end. TestEmbeddedPreludeMatchesSource fails when the two drift:
prelude_frozen_test.go:20: embeddedPrelude() has drifted from prelude.rb; run `go generate ./internal/vm`
That guard is right and should stay. The problem is who can satisfy it.
A bot cannot run go generate. When go-ruby-parser/parser v0.10.0 changed what the compiler emits — unary plus now dispatches #+@ where it was elided — PR #750 bumped the dependency and failed five lanes on this one test. Not a flake, not a bad bump: the bump alone cannot pass, by construction. It took a human rebase onto a main that already carried the regenerated file.
This is not specific to that release. Any parser change that alters emitted bytecode does it again, and the parser is a dependency this repo updates often.
Scale
The regeneration is small — 6 lines for v0.10.0, 11 for the release before it. The cost is not the diff, it is that the PR is red until a person notices why, and a red dependency PR is one people learn to ignore.
Suggested fix
Renovate has postUpgradeTasks for exactly this. In renovate.json (currently just an extends), something of the shape:
{
"postUpgradeTasks": {
"commands": ["go run ./cmd/freeze-prelude"],
"fileFilters": ["internal/vm/prelude_frozen_gen.go"],
"executionMode": "update"
}
}It needs allowedCommands on the bot side, so it is a configuration decision rather than a pure code one — which is why this is an issue and not a PR.
Worth noting what not to do: making the drift test regenerate instead of failing would hide real drift, which is the only thing standing between the committed bytecode and a closed-world binary that runs a prelude nobody wrote.
Two smaller things in the same area, found while diagnosing this:
cmd/freeze-preludetook its paths relative to the working directory, sogo generate ./internal/vm— the command the failure message tells you to run — could not work at all, sincego:generateruns in the directory of the file carrying the directive. Fixed in compiler: read HashLit.Braced and Call.Paren from go-ruby-parser v0.9.0 #742; mentioned here because the message and the tool disagreeing is what made this take longer than it should have.- The same shape exists for any other committed generated artefact in this repo;
prelude_frozen_gen.gois simply the one with a dependency upstream of it.
Activity