Skip to content

920 sync new signatory#921

Merged
tompro merged 7 commits into
masterfrom
920-sync-new-signatory
May 22, 2026
Merged

920 sync new signatory#921
tompro merged 7 commits into
masterfrom
920-sync-new-signatory

Conversation

@tompro
Copy link
Copy Markdown
Collaborator

@tompro tompro commented May 21, 2026

📝 Description

This is a a fix plus an enhancement. First when we are added as signatory we also add a subscription with a limit param for DMs of the organization (this should fix message receive gaps when we where just invited and the transport was not reloaded with the new identity set). After the invite is accepted a background job is launched that pull in historic bill invites that the company received so we have the full company state local (blocks only pull bills that are issued by the company but not the ones it was invited to). This should create the same company final state as we have with recover.

Relates to #920


✅ Checklist

Please ensure the following tasks are completed before requesting a review:

  • My code adheres to the coding guidelines of this project.
  • I have run cargo fmt.
  • I have run cargo clippy.
  • I have added or updated tests (if applicable).
  • All CI/CD steps were successful.
  • I have updated the documentation (if applicable).
  • I have checked that there are no console errors or warnings.
  • I have verified that the application builds without errors.
  • I've described the changes made to the API. (modification, addition, deletion).

📋 Review Guidelines

Please focus on the following while reviewing:

  • Does the code follow the repository's contribution guidelines?
  • Are there any potential bugs or performance issues?
  • Are there any typos or grammatical errors in the code or comments?

@tompro tompro self-assigned this May 21, 2026
Copilot AI review requested due to automatic review settings May 21, 2026 08:06
@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 29.41176% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.51%. Comparing base (7d81b95) to head (d563095).

Files with missing lines Patch % Lines
...rates/bcr-ebill-api/src/service/company_service.rs 0.00% 7 Missing ⚠️
crates/bcr-ebill-transport/src/nostr.rs 16.66% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #921      +/-   ##
==========================================
- Coverage   70.52%   70.51%   -0.02%     
==========================================
  Files         139      139              
  Lines       28361    28377      +16     
==========================================
+ Hits        20001    20009       +8     
- Misses       8360     8368       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

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

This PR addresses issue #920 by improving post-invite synchronization for newly accepted company signatories: it strengthens DM subscription backfill behavior and adds a background sync step to reconstruct company state from historical bill-invite DMs.

Changes:

  • Added a transport-level flow to query/decrypt historical private events for a company identity and process bill chain invites found there.
  • Extended the transport client API with generic event resolution and a “try decrypt with any local signer” helper, and adjusted DM subscription filters to include a backfill limit.
  • Updated company invite acceptance to ensure relevant Nostr contacts are present and to spawn the historical-invite processing job; updated mocks/tests accordingly.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/bcr-ebill-transport/src/transport_service.rs Adds process_company_historical_bill_invites and wires in a bill-invite handler dependency to process recovered invites.
crates/bcr-ebill-transport/src/test_utils.rs Extends the transport client mock with resolve_events and try_decrypt_private_event for updated trait coverage.
crates/bcr-ebill-transport/src/nostr.rs Implements resolve_events and try_decrypt_private_event; adds a DM subscription backfill limit(1000) when adding an identity.
crates/bcr-ebill-transport/src/lib.rs Passes the bill-invite handler into TransportService::new.
crates/bcr-ebill-api/src/service/transport_service/transport.rs Extends TransportServiceApi with process_company_historical_bill_invites.
crates/bcr-ebill-api/src/service/transport_service/transport_client.rs Extends TransportClientApi with resolve_events and try_decrypt_private_event.
crates/bcr-ebill-api/src/service/file_reference_helper.rs Updates the local test mock to include the newly added transport service method.
crates/bcr-ebill-api/src/service/company_service.rs Ensures contacts for company/signatories and spawns the historical bill-invite processing job after accepting a company invite; updates the baseline test expectations.

Comment thread crates/bcr-ebill-transport/src/transport_service.rs Outdated
Comment thread crates/bcr-ebill-transport/src/transport_service.rs
Comment thread crates/bcr-ebill-transport/src/nostr.rs
Comment thread crates/bcr-ebill-transport/src/transport_service.rs
Copy link
Copy Markdown
Collaborator

@zupzup zupzup left a comment

Choose a reason for hiding this comment

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

Very nice, LGTM 👍

@tompro tompro merged commit 1cde7c4 into master May 22, 2026
8 of 10 checks passed
@tompro tompro deleted the 920-sync-new-signatory branch May 22, 2026 11:06
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.

3 participants