Skip to content

refactor: keep protobuf messages at the server API boundary - #74

Merged
alecthomas merged 1 commit into
mainfrom
aat/protobuf-at-api-boundary
Oct 28, 2026
Merged

alecthomas merged 1 commit into
mainfrom
aat/protobuf-at-api-boundary

Conversation

@alecthomas

@alecthomas alecthomas commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

The generated protocol messages were passed through storage, the mirror's reporter, and the command line. That tied the internals to the public protocol and left validation to whoever happened to hold a message. This change converts messages at the server's API boundary, so everything else works with validated domain values.

  • Divergences and the list filter are now domain types in the data model package.
  • A new wire package holds every conversion between protocol messages and domain types. It validates reported divergences as it converts them. The server's handler and its client share it.
  • The store interface and both backends use domain types. Redis now stores JSON instead of protobuf. The Redis backend is unreleased, so there is no migration. "Latest quarantine wins" and the concurrent-retry behaviour are unchanged.
  • The reporter moves to its own package, so the import rule covers it.
  • divergences --json prints the same protocol JSON as before.
  • The architecture linter now rejects imports of spectrepb and spectrepbconnect outside the handler, wire, and the client.

🤖 Generated with Claude Code

@alecthomas
alecthomas marked this pull request as ready for review October 28, 2026 10:12
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T10:12:11.171637Z 66160ba Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from feat/server-redis-storage to main October 28, 2026 10:30
Storage, the reporter, and the command line passed generated protocol
messages around, which tied the internals to the public protocol and
spread validation across callers. Converting at the API boundary lets
every other package work with validated domain values, and the
architecture linter now rejects protocol imports outside it.

The Redis backend stores JSON of the domain type instead of protobuf.
It has not been released, so existing data needs no migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alecthomas
alecthomas force-pushed the aat/protobuf-at-api-boundary branch from 66160ba to c8b7da9 Compare October 28, 2026 10:31
@alecthomas
alecthomas merged commit e844dd5 into main Oct 28, 2026
4 checks passed
@alecthomas
alecthomas deleted the aat/protobuf-at-api-boundary branch October 28, 2026 10:32
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