Skip to content

Complete Channel Invitation Workflow and Resolve Registration UI Bugs - #818

Open
Pranav-d33 wants to merge 15 commits into
hyperledger-cello:mainfrom
Pranav-d33:feat/channel-invitation-workflow-part-6
Open

Complete Channel Invitation Workflow and Resolve Registration UI Bugs#818
Pranav-d33 wants to merge 15 commits into
hyperledger-cello:mainfrom
Pranav-d33:feat/channel-invitation-workflow-part-6

Conversation

@Pranav-d33

Copy link
Copy Markdown
Contributor

Description

This PR marks the completion of the implementation phase for the Channel Invitation Workflow. The core task is now fully complete, and only the final documentation remains to be written. This update introduces several critical UI, security, and integration fixes across the dashboard, ensuring architectural alignment with contributor guidelines and improving the end-to-end reliability of user registration and channel management.

Major Features & UI Polish

  • Channel Invitations: Fully exposed the new Invitation page in the main navigation menu and implemented the end-to-end invitation workflow.
  • Legacy Flow Deprecation: Added clear deprecation notices to the legacy organization update flow to guide users toward the new architectural pattern.
  • UI Cleanups: Cleaned up unused imports and removed dead variables across dashboard components (Overview/index.js, etc.) to improve code quality.

Security & Bug Fixes

  • Registration Workflow: Fixed the persistent "Registration Failed" errors by correctly mapping backend field-level validation messages to the frontend UI.
  • Form ID Conflicts: Eliminated duplicate HTML form ID conflicts that were causing browser interaction issues and ReferenceErrors.
  • Data Integrity: Disabled frontend mock configurations to prevent masked 500 errors and ensure accurate testing against the live Django API.
  • Linting & Code Quality: Resolved no-underscore-dangle issues in models/login.js and fixed unresolved path imports in test files to pass strict ESLint pre-commit hooks.

How to Test

  1. Attempt to register a new user; verify that validation messages (e.g., uniqueness errors) appear correctly under the respective fields.
  2. Navigate to the newly exposed Channel Invitations page in the sidebar.
  3. Create a channel invitation and verify the form submits successfully without 500 errors.
  4. Verify that running npm run lint-staged:js passes with zero errors.

Notes for Reviewers

All frontend modifications have been cross-referenced with the latest backend API schemas to ensure data consistency. The local development Docker environment should now successfully orchestrate the end-to-end flows. The implementation is considered feature-complete; a follow-up PR will contain the official technical documentation.

@Pranav-d33
Pranav-d33 requested a review from a team as a code owner July 21, 2026 11:58
Adds invitation endpoints to the Channel API — replaces the one-step `add_organization` flow with a proper Fabric channel update workflow.

### New Endpoints

- GET /invitations - List invitations visible to org (any member)
- POST /invitations - Create invitation + generate artifact (admin)
- GET /invitations/{id} - Retrieve invitation details (visibility-gated)
- POST /invitations/{id}/cancel - Cancel invitation (member-admin only)

### Design Decisions

- Admin-only mutations: create/cancel require is_admin
- Signature threshold: all current members by default, overridable
- Cancelable states: DRAFT, SIGNING, FAILED, READY
- Cancel vs Reject (PR 6): Cancel hard-stops the whole invitation. Reject is per-invitee decline.
- Who can cancel: Channel member admin only
- Duplicate protection: Rejects if invitee has PENDING invitee on active invitation
- Reinvite allowed after CANCELED or REJECTED

### Files

views.py: 3 @action methods + helpers
serializers.py: create calls agent, CancelSerializer, duplicate validation
service.py: create_invitation_artifact() agent call
tests.py: 12 endpoint tests (APIClient+JWT), 13 model tests with mocks

Test: 32/32 pass, flake8 clean.

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
- Add msp_id field to Organization (auto-derives from name as fallback)
- Update create_invitation_artifact to pass o.msp_id instead of str(o.id)
- Update auth serializer and org service to accept msp_id
- Fix pre-existing enum metaclass crash on Python 3.13
- Fix missing max_length on Organization and Chaincode CharFields
- Add proper error handling for agent failures in view

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Adds POST /channels/{channel_name}/invitations/definition on the Fabric agent.

Service generates unsigned channel update artifact:
  1. Fetch + decode channel config
  2. Build org group entries (MSP + AnchorPeers) with base64 PEM certs
  3. Compute config update diff via configtxlator
  4. Wrap in unsigned envelope, encode to protobuf
  5. Return bytes, clean up temp files

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
- Fabric agent: sign_config_update() service, InvitationSignSerializer, invitation_sign endpoint
- API engine: sign_invitation_artifact() service, ChannelInvitationSignSerializer, sign_invitation endpoint
- Auto-transitions DRAFT->SIGNING->READY at signature threshold; FAILED on agent error
- 42 API engine tests pass (8 new sign tests + 34 existing)
- Fix: invitations POST returning 200 instead of 201 (pre-existing bug)
- Fix: sign endpoint returning 403 instead of 404 for non-members
- Add test_settings.py for SQLite-based local test runs

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Fabric agent:
- join_channel() service: submits signed config update, fetches block, joins peer
- InvitationJoinSerializer, invitation_join endpoint (POST .../invitations/join)

API engine:
- accept_invitation() service helper: contacts agent join endpoint
- ChannelInvitationAcceptSerializer: validates READY status + PENDING invitee,
  calls agent, adds org to channel, marks ACCEPTED
- ChannelInvitationRejectSerializer: validates READY status + PENDING invitee,
  marks REJECTED (no agent call)
- accept_invitation and reject_invitation view actions with 404/400/500 handling
- 49 channel tests pass (7 new accept/reject tests + 42 existing)

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Add the Channel Invitation UI page completing the channel invitation
workflow. This PR covers:

- Invitation list table with status badges (DRAFT/SIGNING/READY/ACCEPTED/
  REJECTED/FAILED/CANCELED) and channel selector dropdown
- Per-row action buttons gated by role, channel membership, and invitation
  state: Sign (member admin), Accept/Reject (pending invitee), and Cancel
  (creator admin)
- Create-invitation modal with org multi-select picker and optional
  required-signatures input
- Invitations row-action link on the Channel Management page
- Route at /channel/invitation (hidden from sidebar)
- Locale strings in en-US and zh-CN (40 keys)
- 48 pure-function unit tests (service URL/method assertions, saga effect
  stepping, permission-gate truth table, form validation) plus jest.config.js
  for @/ alias resolution in test environment
- ESLint clean

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
…ation UI

Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
@Pranav-d33
Pranav-d33 force-pushed the feat/channel-invitation-workflow-part-6 branch from a229e72 to 88544bb Compare July 21, 2026 14:27
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
@Pranav-d33
Pranav-d33 force-pushed the feat/channel-invitation-workflow-part-6 branch 2 times, most recently from 8a88e13 to 4ad0347 Compare July 21, 2026 19:34
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
@Pranav-d33
Pranav-d33 force-pushed the feat/channel-invitation-workflow-part-6 branch from 4ad0347 to 5213f95 Compare July 21, 2026 22:05
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav Dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
Signed-off-by: Pranav dhiran <dhiranpranav72@gmail.com>
@Pranav-d33
Pranav-d33 force-pushed the feat/channel-invitation-workflow-part-6 branch from 5e9fdc8 to 90a5526 Compare July 22, 2026 09:52
@Pranav-d33

Copy link
Copy Markdown
Contributor Author

Hi , @yeasy @YoungHypo @dodo920306

I have completed the implementation of the Channel Invitation Workflow feature for Hyperledger Cello. This workflow introduces a secure, multi-party consensus process to automate the complex lifecycle of adding new organizations to an existing channel.

Below is an overview of the practical implementation, user roles, and the process flow:

Problem Solved (Practical Implementation)

Historically, adding a new organization to a Fabric channel required a sequence of manual tasks (fetching the config block, converting to JSON, appending MSP credentials, calculating the configuration delta, gathering cryptographic signatures from existing members, and submitting the update transaction).

This implementation automates this entire lifecycle. Cello now handles the orchestration, coordinating artifact generation, signature collection, and the channel-joining step directly via Agent APIs and a new web dashboard interface.


User Roles & Access Control

  • Existing Channel Admins (Creator/Signing Orgs):
    • Privileges: Can create new invitations for target organizations, define signature thresholds (defaulting to a majority of current channel members), and sign the configuration update blocks.
    • Security: Write actions (create, sign, cancel) are guarded backend-side to ensure only users with is_admin = True belonging to member organizations can execute them.
  • Invited Organization Admins (Invitees):
    • Privileges: Once the invitation is signed and ready, they can choose to Accept (which instructs their peer agent to join the channel and registers them as a member in Cello) or Reject the invitation.
  • Regular Members (Non-Admins):
    • Privileges: Have read-only permissions to view the active invitation list, signature progress (e.g., 2/3 signatures), and membership statuses. They cannot perform write operations (attempts return a 403 Forbidden).

Process Flow & Lifecycle

The invitation status transitions through a strict state machine:

  1. Proposal (DRAFT): A channel admin initiates the invite. Cello requests the creator's agent to construct the Fabric config update transaction block (definition of target MSPs) and stores this update block as a binary artifact.
  2. Consensus (SIGNING $\rightarrow$ READY): Other channel members see the invitation. Admins click "Sign," routing the artifact to their respective agents to cryptographically sign the block. Once the threshold of signatures is met, the invitation moves to READY.
  3. Onboarding (READY $\rightarrow$ ACCEPTED): The invitee organization’s admin accepts the invitation. Their agent downloads the fully signed block and joins its peers to the Fabric channel. The organization is then registered as a channel member in Cello, and the invitation status updates to ACCEPTED.
  4. Cancellation & Rejection: Channel members can cancel an invitation during the consensus phase, and invitees can reject an invitation at any time.

Validation & Integrity Guardrails

  • Scoped Visibility: Organizations only see invitations they are a member of or are actively invited to.
  • Database Constraints: Added unique constraints to prevent duplicate signatures or duplicate invitees on the same invitation.
  • Failure Recovery: If any agent-level join operation fails, the invitation transitions to FAILED and surfaces the agent's error details back to the UI.

I look forward to your feedback and review on this contribution.

@YoungHypo

Copy link
Copy Markdown
Member

Thanks for the work here, @Pranav-d33 — but this PR is quite large and mixes the invitation feature with unrelated changes (CI/lockfile, compose edits, docs whitespace, an Overview rewrite), which makes it hard to review properly. Could you split it into smaller, independently reviewable PRs (e.g. invitation backend+agent / dashboard UI / CI+compose / registration fixes)?

@Pranav-d33

Pranav-d33 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@YoungHypo
Thanks for the feedback! I completely understand—the PR definitely grew quite large.

To give some context: while I was building out the invitation architecture we discussed, I ran into several local environment issues (like the registration flow being broken and some compose misconfigurations) that I had to fix just to test the feature end-to-end. I also bundled in some CI linting fixes and documentation updates that I noticed along the way. Because it was all done on stacked branches, it got mixed into this single PR.

I agree it will be much easier to review if separated. I will go ahead and close this PR (or leave it open as a reference) and break the work out into the smaller, independently reviewable PRs as you suggested:

Infrastructure & Bug Fixes: CI/lockfile, compose edits, and registration fixes.
Documentation: The Overview rewrite and docs whitespace.
Core Feature Backend: The invitation backend + agent logic.
Core Feature UI: The dashboard UI for the invitation workflow.

I'll link the new PRs here once they are up.

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.

2 participants