Skip to content

[api2] events: add source_conversation_seen event#7784

Merged
legoktm merged 3 commits intodevelopfrom
vicki/conversation-seen
Mar 16, 2026
Merged

[api2] events: add source_conversation_seen event#7784
legoktm merged 3 commits intodevelopfrom
vicki/conversation-seen

Conversation

@vickiniu
Copy link
Contributor

@vickiniu vickiniu commented Mar 5, 2026

Adds a source_conversation_seen event that marks all items in a source conversation as seen before a given interaction_count. This allows the client to update potentially large conversations with a single event.

Test plan

Checklist

This change accounts for:

  • any required additional documentation
  • any necessary AppArmor changes (added or removed application files)
  • any impact on new SecureDrop installs and upgrades
  • our dependency update policy

@vickiniu vickiniu requested a review from a team as a code owner March 5, 2026 16:20
@vickiniu vickiniu force-pushed the vicki/conversation-seen branch from f7555af to 7c5032b Compare March 5, 2026 16:30
@vickiniu vickiniu moved this to In Progress in SecureDrop Mar 5, 2026
@vickiniu vickiniu moved this from In Progress to Ready For Review in SecureDrop Mar 10, 2026
@nathandyer nathandyer requested a review from legoktm March 10, 2026 16:04
@legoktm legoktm requested a review from Copilot March 11, 2026 18:07
@legoktm legoktm moved this from Ready For Review to Under Review in SecureDrop Mar 11, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an API2 event intended to let clients mark a whole source conversation as “seen” up to a given interaction_count, reducing the need to send many per-item events for large conversations.

Changes:

  • Adds a new API2 event data payload for “conversation seen” with upper_bound validation.
  • Registers and implements a server-side handler to mark qualifying items as seen.
  • Adds an integration test covering OK / AlreadyReported / Gone behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
securedrop/journalist_app/api2/types.py Introduces a new event type + payload, and wires it into EVENT_TYPES.
securedrop/journalist_app/api2/events.py Registers the new event handler and implements “mark conversation seen” processing.
securedrop/tests/test_journalist_api2.py Adds test coverage for processing the new event through /api/v2/data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@vickiniu vickiniu force-pushed the vicki/conversation-seen branch from 8382e52 to 1b7c63d Compare March 12, 2026 15:56
@vickiniu vickiniu force-pushed the vicki/conversation-seen branch from 1b7c63d to f424707 Compare March 12, 2026 17:32
@legoktm
Copy link
Member

legoktm commented Mar 16, 2026

test_api2_source_conversation_seen is failing with:

>           response = app.post(
                url_for("api2.data"),
                json={"events": [asdict(event)]},
                headers=get_api_headers(journalist_api_token),
            )

...
                for uuid, item in result.items.items():
>                   response.items[uuid] = item.to_api_v2(minor) if item is not None else None
E                   AttributeError: 'str' object has no attribute 'to_api_v2'

@vickiniu vickiniu requested a review from legoktm March 16, 2026 19:50
@vickiniu vickiniu moved this from Under Review to Ready For Review in SecureDrop Mar 16, 2026
Copy link
Member

@legoktm legoktm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks :)

@legoktm legoktm added this pull request to the merge queue Mar 16, 2026
Merged via the queue into develop with commit ef5b55e Mar 16, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in SecureDrop Mar 16, 2026
@legoktm legoktm deleted the vicki/conversation-seen branch March 16, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants