Skip to content

File completed agreements in Google Drive - #256

Open
fortytwode wants to merge 3 commits into
NYLLON-SOFTWARE:mainfrom
fortytwode:feat/google-drive-filing
Open

fortytwode wants to merge 3 commits into
NYLLON-SOFTWARE:mainfrom
fortytwode:feat/google-drive-filing

Conversation

@fortytwode

@fortytwode fortytwode commented Nov 23, 2026 •

Copy link
Copy Markdown

Self-hosted SignuDoc installations can file completed agreements and their audit certificates in a selected Google Drive folder. Filing is opt-in and scoped to one verified envelope owner and a UTC start time. Filing starts when the final participant completes the envelope. The authenticated retention schedule retries any unfinished uploads.

Google can accept an upload before the connection drops. The job reserves both Drive file IDs before uploading and records each file independently. Retry verifies the existing file's destination and checksum before treating a conflict as success.

The local setup helper uses Google's folder picker and the drive.file scope. Installers can authorize the exact destination and keep the offline token in their deployment secret store.

Verification

  • Ran 493 unit tests, TypeScript, ESLint, and formatting checks against the upstream base.
  • Tested targeted filing with an older backlog, overlapping completion and scheduled filing, owner and completion-time filtering, artifact integrity, and recovery from a partial upload using PostgreSQL.
  • Exercised the local OAuth callback with simulated consent, an invalid state, and a different folder ID. A live folder grant is required for an external upload.

Note

File completed signing agreements in Google Drive

  • Adds a Google Drive filing workflow that uploads signed and certificate PDFs for completed envelopes to a configured folder. A targeted filing runs on signing completion in submitSigningOnce (signing.ts); a sweep of up to 20 pending envelopes runs during authorized retention jobs (retention-job.ts).
  • Adds a Drive client in google-drive.ts that reserves file IDs before upload, verifies folder writability and upload receipts, retries using reserved IDs, and maps failures to bounded, operation-specific errors.
  • Adds a filing journal table (migration), optional config in .env.example, an OAuth/PKCE authorization script (authorize-google-drive.mjs), and setup docs (google-drive-filing.md).
  • Eligibility: only completed envelopes for the configured verified owner, after the configured UTC start time, with checksum verification before upload. Accounts with closure requests are skipped. Filing is disabled when no folder ID is set.
  • Risk: Drive filing failures now mark a retention run as failed via retentionJobFailed in retention-job.ts; signing responses wait for a filing attempt with an 8-second timeout in fileCompletedEnvelopeInDrive.

Macroscope summarized 9b9a2ee.

@vercel

vercel Bot commented Nov 23, 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 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The changes appear safe to merge; no new actionable issue was found.

Summary

Adds Google Drive filing for completed agreements and audit certificates. The latest changes start a short filing attempt before the final signing response.

  • Completed agreements and certificates now copy to one configured Drive folder.
  • The filing job can check its Drive folder and safely retry PDF uploads.
  • Installers can authorize one Drive folder with a limited Google grant.
  • The authenticated retention schedule now retries unfinished Drive copies.

Diagram

sequenceDiagram
  participant Signer
  participant App
  participant DB as PostgreSQL
  participant Drive as Google Drive
  participant Job as Daily job
  Signer->>App: Finish final signature
  App->>DB: Save completed agreement
  App->>DB: Reserve Drive file IDs
  App->>Drive: Upload and verify each PDF
  App->>DB: Save each successful copy
  App-->>Signer: Return completion response
  Job->>DB: Find unfinished copies
  Job->>Drive: Retry with reserved IDs
Loading

Reviews (3) · Last reviewed commit: "File signed agreements in Google Drive o..." · Reviewed by Greptile

Comment thread src/lib/retention-job.ts Resolved
Comment thread src/lib/google-drive-filing.ts Resolved
Comment thread scripts/authorize-google-drive.mjs Resolved

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