Skip to content

GO-7383 Mirror v1 protos into any-block's format/v1/proto - #3290

Merged
requilence merged 1 commit into
developfrom
go-7383-mirror-into-format-v1
Sep 21, 2026
Merged

requilence merged 1 commit into
developfrom
go-7383-mirror-into-format-v1

Conversation

@requilence

Copy link
Copy Markdown
Contributor

anyproto/any-block#15 removes the four root-level .proto paths this workflow writes to. any-block now keeps a single import graph under format/v1/proto, so the mirror has to write there instead.

Changes

  • Copy into any-block/format/v1/proto/ rather than the repository root.
  • Rewrite import paths to format/v1/proto/<name>.proto instead of flattening them to bare basenames.
  • Rewrite option go_package. The old workflow copied files verbatim, so a mirror run restored "pkg/lib/pb/model" / "pb" over any-block's "github.com/anyproto/any-block/format/v1/...", which its generated bindings depend on. That was already broken before this PR.
  • Mirror pkg/lib/pb/model/protos/export_report.proto, which models.proto has imported since 5fd547c and which has no counterpart in any-block. Without it the mirror pushes an unresolvable import. The steps skip the file when absent, so the workflow still works on branches predating it.
  • Fail the job when any non-google import does not resolve to a mirrored file, so the next unmirrored dependency surfaces here instead of in any-block.
  • Skip the commit when nothing changed; git commit previously exited 1 and failed the step.

Delivery is unchanged: still a direct commit and push to any-block's main.

Verification

Ran the exact sed pair against both develop's protos and the pre-export_report versions on main, then compiled the output in any-block's layout:

  • Rewritten headers match any-block's canonical format/v1/proto/*.proto byte for byte (go_package and all imports).
  • protoc -I . format/v1/proto/{models,events,changes,snapshot}.proto compiles, both with and without export_report.proto present.
  • The import guard fires on a synthetic models.proto importing localstore.proto.

Locally this used BSD sed -i ''; CI uses GNU sed -i on ubuntu. The expressions are POSIX ERE, so only the -i suffix argument differs.

Note for reviewers

any-block generates format/v1/model/models.pb.go and its JSON Schemas from these sources, so a mirror push leaves them stale and reds any-block's main until someone runs go generate ./format/v1 ./codec/anyblockjson. The pushed commit body says so. That tradeoff is inherent to pushing straight to main and predates this PR — today the same push reds a different check.

Merge order

Merge anyproto/any-block#15 first.

any-block dropped the four root-level .proto paths this workflow used to
write; it now keeps a single import graph under format/v1/proto. Copy the
sources there and rewrite both halves of what made the root copies distinct:
the import paths, which used to be flattened to bare basenames, and the
go_package values, which named Heart's own Go bindings and would otherwise
clobber any-block's.

models.proto has since gained export_report.proto as a dependency, so mirror
that too, tolerating its absence on branches that predate it. Guard the copy
with a check that every non-google import resolves to a mirrored file, which
turns the next unmirrored dependency into a failed job here rather than an
unresolvable import in any-block. Skip the commit when nothing changed, which
used to fail the step.
@requilence
requilence merged commit c683863 into develop Sep 21, 2026
14 of 16 checks passed
@requilence
requilence deleted the go-7383-mirror-into-format-v1 branch September 21, 2026 15:48
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant