Skip to content

Add protected agreement folders - #267

Open
fortytwode wants to merge 2 commits into
NYLLON-SOFTWARE:mainfrom
fortytwode:feat/agreement-folders
Open

fortytwode wants to merge 2 commits into
NYLLON-SOFTWARE:mainfrom
fortytwode:feat/agreement-folders

Conversation

@fortytwode

@fortytwode fortytwode commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

  • Let administrators create folders, manage membership, and move envelopes from their detail page. Folder links on the dashboard scope search, pagination, uploads, and single-template drafts.
  • Use folder membership for filed envelopes. Existing Teams sharing continues for unfiled envelopes. Drafts stay private to the sender, and recipient links keep their existing permissions.
  • Check folder access on direct file links, audit exports, and owner actions. Copies remain in the source folder, and membership changes affect subsequent requests.

The migration creates no folders and moves no existing envelopes.

Verification

  • npm run typecheck, npm run lint, and npm run format:check
  • Unit tests and focused PostgreSQL tests for Teams compatibility, folder access, envelope ownership, and signing
  • Production-mode Chromium for folder creation, document isolation, moving an envelope, and revoking access

Note

Add protected agreement folders for envelope access and organization

  • Folders are teams flagged with is_folder. A new migration adds the flag, a nullable envelopes.folder_id foreign key, and an index on filed envelopes (agreement folders migration).
  • Users can start envelopes from a folder, pick a folder at upload, and use templates with a folder context. Folder state is carried through the dashboard, templates, and envelope-detail navigation. See docs/agreement-folders.md.
  • Envelope access is now folder-scoped. API reads and lists filter on canAccessEnvelopeFolderCondition, and the new handleApiEnvelope and requireEnvelopeOwnerSession guards only allow envelope owners; other viewers get a 404 (route-session.ts, route.ts).
  • Administrators can move envelopes between folders via a new rate-limited POST /api/envelopes/[id]/folder endpoint, audited as envelope_folder_changed ("Agreement moved").
  • Behavioral Change: many endpoints (send, void, remind, fields, signers, document, download, thumbnail, audit, review, prepare pages) now return 404 for non-owner viewers and fetch data with the resolved owner ID instead of the session user; embedded signing links fail when the folder is inaccessible; team name uniqueness is now case-insensitive and scoped per is_folder.

Macroscope summarized 54dc1c9.

@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

@fortytwode is attempting to deploy a commit to the Basic Intelligence Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Critical impact] The PR appears safe to merge; the expiry-event issue is fixed and no new blocking issues were found.

Summary

Adds protected agreement folders with admin-managed membership, folder-aware envelope access, and folder selection during uploads and template use.

  • Administrators can create folders, add members, and move envelopes into them.
  • Folder links show their agreements and stay selected as people browse.
  • Uploads and template drafts can be placed in a chosen folder.
  • Filed envelopes follow folder access rules across pages, files, and sender actions.

Reviews (2) · Last reviewed commit: "Record a passed deadline even when the s..." · Reviewed by Greptile

Comment thread src/lib/envelope-schedule.ts Resolved
The daily job skipped an expired envelope whose sender could no longer open
its folder, so the expiry was never noted: folder members saw no expired
entry and integrations got no envelope.expired. The expiry is now always
noted, and the folder check only decides whether the sender is emailed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant