Repository navigation
feat(coord): list messages by sender - #242
Merged
Merged
Conversation
mini-ork's run page shows a run's concord mailbox, but the only message route lists by recipient (`/principals/:id/messages`), so the messages a run *sent* — the run-to-run side of concord — could not be read at all. GET /api/v1/coord/messages?from=<actor>[&limit=N] returns every message `from` sent, across recipients (each message's principal_id is its recipient), newest `limit` kept (default 200, clamped 1..=1000) and emitted oldest first like the inbox route. `from_actor` is free text, so an unknown sender is 200 with an empty list, never 404; a missing or empty `from` is 400. A new idx_messages_from(from_actor, id) index keeps the scan bounded; CREATE INDEX IF NOT EXISTS opens existing coord.db files unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mini-ork's IDE run page lists a run's concord mailbox (
run:<id>), but the only message route lists by recipient, so the messages a run sent — concord's run-to-run side — could not be read. This adds an outbox route keyed on the sender.Contract
GET /api/v1/coord/messages?from=<principal_or_actor>[&limit=N]→200 {"messages": [Message]}, the existingMessageshape; each message'sprincipal_idis its recipient.limitdefaults to 200, clamped to1..=1000, and keeps the newestlimitmessages by id.frommissing or empty →400 {"error": "missing required query parameter 'from'"}.human:amir), →200 {"messages": []}, never 404.CoordStore::list_messages_from(from, limit)next tolist_messages; newidx_messages_from ON messages(from_actor, id)(CREATE INDEX IF NOT EXISTS, so existingcoord.dbfiles open unchanged).Tests
cargo +1.98.1 test --lib coord_store→ 23 passed (new:list_messages_from_is_the_outbox_newest_kept_oldest_first— inbox vs outbox separation, limit keeps newest, oldest-first order, unknown sender → empty).cargo +1.98.1 test --test coord_principals_test→ 9 passed (new:messages_from_lists_the_senders_outbox_across_recipients— 200 list across recipients, limit, unregistered sender →[], 400 on missing/emptyfrom).cargo fmt --check→ clean;cargo build→ ok.cargo clippy --lib --no-deps -- -D warnings→ 616 errors with and without this diff (pre-existing baseline), none in the touched files.