Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
3.2 KiB
3.2 KiB
Scratchpad — Email Attachments → Ticket Documents
Summary (Implemented)
-
Implemented a workflow-worker override for
process_email_attachmentthat:- Enforces eligibility rules: skip inline/CID, max 100MB, require filename, allow all file types.
- Downloads attachment bytes from provider (Microsoft Graph or Gmail).
- Uploads bytes via
StorageProviderFactoryand createsexternal_files,documents, anddocument_associationsrows. - Attributes
uploaded_by_id,created_by,user_idto the configured inbound email “system user” (inbound_ticket_defaults.entered_by). - Uses strict idempotency via
email_processed_attachments(stable PK:{tenant, provider_id, email_id, attachment_id}) with status + error recording. - Treats unsupported Microsoft attachment shapes as
skipped(not a workflow failure).
-
Citus compatibility:
- Added tenant predicates to
UPDATE email_providers ...in webhook routes to avoid scatter/gather updates and RLS issues. - Added a Citus distribution migration for
email_processed_attachments(distributed bytenant, colocated withtenants).
- Added tenant predicates to
Key Files
- Worker action override:
services/workflow-worker/src/actions/registerEmailAttachmentActions.ts - Worker wiring:
services/workflow-worker/src/index.ts - Schema:
server/migrations/20260111121500_create_email_processed_attachments.cjsee/server/migrations/citus/20260111123000_distribute_email_processed_attachments.cjs
- Provider downloads:
- Microsoft:
shared/services/email/providers/MicrosoftGraphAdapter.ts(downloadAttachmentBytes,isInline) - Gmail:
server/src/services/email/providers/GmailAdapter.ts(downloadAttachmentBytes,isInline/contentIdparsing)
- Microsoft:
- Citus webhook fixes:
server/src/app/api/email/webhooks/microsoft/route.tsserver/src/app/api/email/webhooks/google/route.ts
Test Coverage
-
Vitest integration tests (business logic + DB assertions):
server/src/test/integration/emailAttachmentIngestion.integration.test.tsserver/src/test/integration/systemEmailProcessingWorkflowAttachments.integration.test.tsserver/src/test/integration/citusTenantFilterEmailProviders.integration.test.ts
-
Playwright UI verification (documents visible on ticket):
ee/server/src/__tests__/integration/email-attachments-to-ticket-documents.playwright.test.ts
Playwright Notes ($playwright-testing)
- Cookie naming: the app suffixes the dev session cookie by port (
authjs.session-token.<port>). Updated Playwright auth helpers to mint cookies using the suffixed cookie name/salt so sessions work on non-3000 ports. - Secret providers: Playwright runs force secret provider read/write to
env(avoid developer filesystem secrets clobbering test DB creds).
Isolated Local Test Env Notes ($alga-test-env-setup)
- For side-by-side worktrees/environments, use the
alga-test-env-setupscripts to generate unique ports + secrets and avoid collisions:- Port detection:
~/.claude/skills/alga-test-env-setup/scripts/detect_ports.py --env-num <N> --json - Secrets generation:
~/.claude/skills/alga-test-env-setup/scripts/generate_secrets.py --secrets-dir <worktree>/secrets - Then wire
server/.envusing the detected ports (unified port model: internal + exposed ports match).
- Port detection: