Skip to content

fix: address 7 high-priority QA bugs (#217, #218, #219, #224, #225, #229, #243) - #268

Merged
kropdx merged 8 commits into
mainfrom
fix/qa-high-priority-batch
Nov 25, 2026
Merged

kropdx merged 8 commits into
mainfrom
fix/qa-high-priority-batch

Conversation

@kropdx

@kropdx kropdx commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Addresses 7 high-priority QA bug reports across signer data requests, document verification, retention cleanup, public legal pages, envelope void/draft concurrency, and SSO two-step sign-in settings.

Fixes #217
Fixes #218
Fixes #219
Fixes #224
Fixes #225
Fixes #229
Fixes #243

Changes

  • fix(signer-data): erasure leaves signer data in stored webhook deliveries #219 (1d706bd, hardened in 1c07a33): Include signer-scoped webhook deliveries in exportSignerData() (preventing cross-party/owner leaks on multi-signer envelopes) and delete associated webhook_deliveries inside the same DB transaction as DELETE FROM envelopes during eraseSignerData() (with a savepoint guarding unmigrated schemas), while preserving active, Part 11, owner-only, and unrelated signers' records.
  • fix(verify): unchanged signed files get a false origin verdict after deletion #218 (3c6b90a, hardened in 1c07a33): Fall back to system_audit_events (event = 'envelope_deleted') in verifyDocumentHash() (non-PII fields only, never sourcePdfHash) backed by partial expression indexes (db/migrations/20261124120000_verify_deleted_audit_indexes.sql), so unchanged signed PDFs/certificates from deleted envelopes receive an accurate origin verdict noting that the envelope record was subsequently deleted.
  • fix(retention): daily cleanup skips retrying failed account and draft file deletions #217 (7f5b85c): Enqueue storage keys in pending_file_deletions inside the same transaction as row deletion for closed-account and stale-draft purges, clean up healthy deletions post-commit, retain failed keys for retry on subsequent runs, and report incomplete cleanup via retentionJobFailed().
  • fix(legal-pages): setup links to three pages that return HTTP 500 on a fresh hosted install #229 (eebb02f): Add non-throwing findPublicSupportAddress() and safe contact-link formatting so /privacy, /terms, and /accessibility return HTTP 200 on fresh HOSTED_MODE=1 installs before SUPPORT_EMAIL is configured (falling back to /contact), and return HTTP 503 instead of 500 on POST /api/contact.
  • fix(api): voiding a sent envelope returns HTTP 500 when email is unconfigured #225 (4b2a771): Initialize email via createEmailServiceForSending() in voidSentEnvelopeOnce() so both /api/envelopes/[id]/void and /api/v1/envelopes/[id]/void return HTTP 503 with actionable email-setup guidance when email is unconfigured and invited signers need notification (leaving the envelope sent), and skip email setup when zero signers were invited.
  • fix(envelopes): field save returns HTTP 500 during signer removal #224 (fd33a8a, hardened in 1c07a33): Increment fields_revision under lockDraftEnvelope() when removing signers or converting signers to approvers, re-validate signers/roles inside the locked field-save transaction (returning HTTP 409 reload guidance or 400 instead of FK 23503 / trigger 23514 HTTP 500), and reject stale concurrent replaceDraftEnvelopeSigners() saves referencing a removed signer ID with HTTP 409 so saved access-code protection cannot be dropped.
  • fix(settings): two-step sign-in setup always fails for SSO-only accounts #243 (45d5dc0): Wire userHasPassword() (requiring a non-empty credential password hash) and SSO provider display name into Settings → Two-step sign-in so SSO-only accounts see that two-step sign-in is managed by their identity provider (no broken password setup or inapplicable org requirement warning), plus a Better Auth before guard returning PASSWORD_REQUIRED_FOR_TWO_FACTOR.

Verification

  • CI / Typecheck, lint, unit tests, build — PASS (+53 new unit tests, Poppler pdfsig, check-function-traces.ts, Next.js production build)
  • CI / End-to-end test — PASS (Postgres 17 npm run test:db including new migration & DB tests for all DB-backed fixes, plus Playwright npm run test:e2e)
  • CodeQL, Dependency review, Macroscope - Correctness Check, Greptile Review (5/5), and Vercel preview — PASS

Note

Fix 7 QA bugs: verification fallback, retention file retries, SSO-only two-factor

  • Adds deleted-envelope verification: verifyDocumentHash checks envelope-deletion audit events when no live envelope matches, with partial SHA-256 indexes in migration
  • Makes retention file deletion durable: storage keys queue in pending_file_deletions during account and stale-draft purge, failed deletions retry on later sweeps, and sweeps with pending-file failures report failure in retentionSweepFailed
  • Treats SSO-only accounts correctly for two-factor: needsTwoFactorSetup requires a non-empty credential password, auth middleware rejects password-based two-factor endpoints with PASSWORD_REQUIRED_FOR_TWO_FACTOR, and the settings panel shows identity-provider-managed status without management controls
  • Fixes draft-edit races: replaceDraftEnvelopeFields and replaceDraftEnvelopeSigners validate against signers read under the transaction lock, refuse stale saves with 409/400, and bump fields_revision when signers or fields are removed
  • Extends signer data export and erasure to include webhook deliveries, with same-transaction cleanup via deleteSignerWebhookDeliveries
  • Risk: signer erasure deletes stored webhook deliveries for erased envelopes — check deleteSignerWebhookDeliveries in signer-data.ts and its Part 11/still-associated exclusions; retention sweep success now depends on pending-file-deletion retries in retention-job.ts

Macroscope summarized 1c07a33.

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
signudoc Ready Ready Preview Nov 25, 2026 3:15am UTC

Comment thread src/lib/envelopes.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; all previous findings are addressed and no new actionable issues were found.

Summary

This PR addresses seven QA bugs across signer data requests, document verification, retention cleanup, public contact pages, void notifications, draft edits, and SSO settings.

  • Retention sweeps retry file cleanup after deleting account and draft rows.
  • Document checks recognize signed files from deleted envelopes.
  • Draft edits catch conflicts when signers and fields change together.
  • Voiding an envelope explains when signer email setup is missing.
  • Signer exports and erasure include matching webhook deliveries.
  • Two-step sign-in follows each account's password and SSO setup.
  • Public legal pages work before a support email is configured.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Erase signer data] --> B[Delete stored files]
  B --> C[Begin database transaction]
  C --> D[Delete finished envelope rows]
  D --> E[Delete matching webhook deliveries]
  E --> F[Commit both deletions]
  E -->|Cleanup fails| G[Roll back both deletions]
  G --> H[Rows remain for another attempt]
Loading

Reviews (2) · Last reviewed commit: "fix: address PR #268 review findings for..." · Reviewed by Greptile

Comment thread src/lib/verify.ts Resolved
Comment thread src/lib/verify-result.ts Resolved
Comment thread src/lib/signer-data.ts Resolved

This branch was successfully deployed

1 active deployment
Preview — 1c07a33f Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment