Skip to content

refactor(messages): own the annotation repository - #10059

Closed
404Wolf wants to merge 2 commits into
mainfrom
wolf/reorg-annotation-repository
Closed

404Wolf wants to merge 2 commits into
mainfrom
wolf/reorg-annotation-repository

Conversation

@404Wolf

@404Wolf 404Wolf commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Why

macro_db_client implemented the messages domain's AnnotationRepository
port, so it depended on messages (and through it on initiative,
entity_access and their adapters). About 50 crates depend on
macro_db_client, so all of them compiled the message domain. The hexagonal
rule in this repo is that a domain owns the adapters for its own ports. This
edge is N7 in the repository reorganization plan.

MACRO-4994

How it works

  • PgAnnotationRepository and the PDF anchor edit/delete SQL move, with git
    history, from crates/macro_db_client/src/annotations/{repository,edit_anchor,delete_anchor}.rs
    to crates/messages/src/outbound/pg_annotation_repo{,/edit,/delete}.rs,
    behind messages' existing outbound + annotations features.
  • The SQL helpers now return MessageError directly. Before, the adapter
    re-wrapped an anyhow error into MessageError::Repository as a string.
  • DSS builds the repository from its new path. macro_db_client keeps
    messages only as a dev-dependency, for its remaining create/get tests, and
    drops rootcause and the dev-only entity_access, which the move left unused.
  • The moved tests use MACRO_DB_MIGRATIONS and the existing
    crates/macro_db_client/fixtures/message_annotations.sql, unchanged.

Closures (.github/workspace-dep-closures.json):

Crate Before After
macro_db_client closure 68 crates 42 crates
crates that compile messages 105 97
crates that compile entity_access 128 120
crates that compile initiative 106 98

No SQL, route or wire format changes. The seven moved annotation tests pass
against a migrated database.

macro_db_client implemented messages' AnnotationRepository port, so it
depended on the messages domain and every crate that uses
macro_db_client compiled messages, initiative and entity_access. The
hexagonal rule is that a domain owns the adapters for its own ports.

Move PgAnnotationRepository and the PDF anchor edit and delete SQL into
messages::outbound::pg_annotation_repo (behind its outbound and
annotations features), returning MessageError directly instead of an
anyhow error re-wrapped by the adapter. DSS builds the repository from
its new path, and macro_db_client keeps messages only as a
dev-dependency for its own tests.

MACRO-4994
@macro-application

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d7cb768 and f4acec6.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock, !**/Cargo.lock
Files selected for processing: 12

  • .github/workspace-dep-closures.json
  • crates/macro_db_client/Cargo.toml
  • crates/macro_db_client/src/annotations.rs
  • crates/messages/Cargo.toml
  • crates/messages/src/outbound/mod.rs
  • crates/messages/src/outbound/pg_annotation_repo.rs
  • crates/messages/src/outbound/pg_annotation_repo/delete.rs
  • crates/messages/src/outbound/pg_annotation_repo/delete/test.rs
  • crates/messages/src/outbound/pg_annotation_repo/edit.rs
  • crates/messages/src/outbound/pg_annotation_repo/edit/test.rs
  • services/document_storage_service/src/api/context.rs
  • services/document_storage_service/src/server.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@404Wolf 404Wolf added the run-ci Run CI on the PR's head commit; removed when the run starts label Nov 7, 2026
@github-actions github-actions Bot added cloud-storage and removed run-ci Run CI on the PR's head commit; removed when the run starts labels Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

@404Wolf

404Wolf commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Folded into the single reorg PR #10111 (one PR for the whole reorganization). Its commits are there; closing this one.

@404Wolf 404Wolf closed this Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant