Skip to content

fix(sharing): clear stale pending access_request on team share + Sharing UX (#446) - #450

Merged
vybe merged 2 commits into
mainfrom
feature/446-team-share-gate-and-sharing-ux
Apr 22, 2026
Merged

vybe merged 2 commits into
mainfrom
feature/446-team-share-gate-and-sharing-ux

Conversation

@vybe

@vybe vybe commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Gate hardening: share_agent now atomically deletes any stale pending access_requests row for the same (agent, email) so manually adding someone to Team Sharing clears the Pending list (closes the reported "team-shared user stays queued" symptom).
  • Defense-in-depth: every gate boundary (email_has_agent_access, is_agent_shared_with_email, routers/public.py, both DM + group paths in adapters/message_router.py) now normalizes email.strip().lower() so mixed-case session emails can't bypass the allow-list.
  • UX: SharingPanel.vue restructured to make the two-layer model explicit — Identity Proof (require_email proves who they are) vs. Authorization (Team Sharing allow-list + pending approval). Adds a dead-end warning banner when require_email=true && !open_access && shares.length===0.

Changes

  • src/backend/db/agent_settings/sharing.py — share_agent clears stale pending rows; input normalized
  • src/backend/routers/public.py — gate boundary normalization
  • src/backend/adapters/message_router.py — DM + group branch normalization
  • src/frontend/src/components/SharingPanel.vue — framing banner, renamed sections, dead-end warning
  • tests/test_team_share_gate_unit.py — 8 new unit tests (casing, cleanup scope, no-op paths)
  • Feature flow docs updated (agent-sharing.md, unified-channel-access-control.md)

Test plan

  • pytest tests/test_team_share_gate_unit.py — 8/8 pass (run inside trinity-backend)
  • pytest tests/test_sharing_null_email_unit.py — 5/5 still pass (no regression)
  • Backend imports cleanly (db.agent_settings.sharing, routers.public, adapters.message_router)
  • Frontend HMR reloads SharingPanel.vue without errors
  • Visual: Sharing tab shows new framing banner + renamed sections
  • Visual: Enabling "Require verified email" with zero shares and Open access off surfaces the amber "Heads up" warning
  • Manual end-to-end reproducer (optional): team-share + email-verify + public chat → 200, no new access_requests row

Closes #446

🤖 Generated with Claude Code

vybe and others added 2 commits April 22, 2026 09:21
…ing UX

Team-shared users were still landing in the public-link approval queue
because a prior chat attempt left a stale `access_requests` row that the
owner saw as "pending" even after they added the email to Team Sharing.
`share_agent` now atomically deletes any pending `(agent, email)` row so
the Pending list reflects reality after a manual share.

Also adds defense-in-depth email normalization (`.strip().lower()`) at
every gate boundary — `email_has_agent_access`, `is_agent_shared_with_email`,
`routers/public.py`, and both DM + group paths in `adapters/message_router.py`
— so a mixed-case session email can never bypass the allow-list match.

Restructures SharingPanel.vue to make the two-layer model explicit:
identity proof (`require_email`) vs. authorization (Team Sharing allow-list
+ pending-approval queue). Adds a "Heads up" warning when `require_email`
is on but no emails are in Team Sharing and `open_access` is off — the
dead-end configuration that locks everyone out.

New test file: `tests/test_team_share_gate_unit.py` (8 isolated unit tests
over SharingMixin covering gate casing, stale-row cleanup scope, and
normalization invariants).

Closes #446

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds test_team_share_gate_unit.py to the Agent Lifecycle & Management
category and a 2026-04-22 Recent Test Additions entry. Bumps suite
stats: 122 files, ~2,219 total, ~98 unit, ~2,084 core.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vybe
vybe merged commit be9f6b0 into main Apr 22, 2026
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.

bug: Team-shared users still hit public-link approval queue + Sharing UX conflates identity proof with authorization

1 participant